disable MTP udev rules for specific device so it can be mount as a USB Mass Storage device

After much reading and testing.

I found out that this is related to a recent change in the default Udev rules to set a catch-all rule for devices to be handled by MTP if they don't match any other udev rules for USB devices.

Instead of my device being mounted as a USB mass storage device as it used to.

I found that I need to let udev know that this device should be managed a USB mass storage device instead of the MTP catch all rule

First I need my devices ID. Below it is the last one in the list

$ lsusb                                                                                                             
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 8087:0a2a Intel Corp. 
Bus 001 Device 002: ID 04f2:b51d Chicony Electronics Co., Ltd 
Bus 001 Device 006: ID 04e8:6860 Samsung Electronics Co., Ltd Galaxy (MTP)
Bus 001 Device 005: ID 0b05:181b ASUSTek Computer, Inc. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 007: ID 174c:5106 ASMedia Technology Inc

I am sure there is more to this then what I have here, but this works for me. I take the device ID which 174c:5106 and replace it in the udev rules below.

$ cat /etc/udev/rules.d/90-myrules.rules 
SUBSYSTEMS=="usb", ENV{MODALIAS}=="usb:174c:5106", ENV{MODALIAS}="usb-storage"

I now see the following in my system logs

journalctl -fe

kernel: usb 1-2: USB disconnect, device number 9
kernel: usb 1-2: new high-speed USB device number 10 using xhci_hcd
mtp-probe[9850]: checking bus 1, device 10: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-2"
mtp-probe[9850]: bus: 1, device: 10 was not an MTP device
kernel: usb-storage 1-2:1.0: USB Mass Storage device detected
kernel: scsi host3: usb-storage 1-2:1.0
kernel: usbcore: registered new interface driver usb-storage
kernel: usbcore: registered new interface driver uas
kernel: scsi 3:0:0:0: Direct-Access     ST310005 24AS             JC4B PQ: 0 ANSI: 0
kernel: sd 3:0:0:0: Attached scsi generic sg2 type 0
kernel: sd 3:0:0:0: [sdb] 1953525168 512-byte logical blocks: (1.00 TB/932 GiB)
kernel: sd 3:0:0:0: [sdb] Write Protect is off
kernel: sd 3:0:0:0: [sdb] Mode Sense: 23 00 00 00
kernel: sd 3:0:0:0: [sdb] No Caching mode page found
kernel: sd 3:0:0:0: [sdb] Assuming drive cache: write through
kernel:  sdb: sdb1
kernel: sd 3:0:0:0: [sdb] Attached SCSI disk

First copy the file /lib/udev/rules.d/69-libmtp.rules to /etc/udev/rules.d/69-libmtp.rules:

$ sudo cp /lib/udev/rules.d/69-libmtp.rules /etc/udev/rules.d/69-libmtp.rules

At the top of this file you can find:

# Some sensitive devices we surely don't wanna probe
ATTR{idVendor}=="0670", GOTO="libmtp_rules_end"
ATTR{idVendor}=="0471", ATTR{idProduct}=="083f", GOTO="libmtp_rules_end"

Then exclude the device from mtp-probe by adding next line after mentioned lines:

ATTR{idVendor}=="093a", ATTR{idProduct}=="2516", GOTO="libmtp_rules_end"

I found my USB device ID with lsusb shell command. It is 093a:2516