8

I have a problem with a specific device that is not an android / mobile device.
It is a media player with an internal hard drive that I am trying to connect as a mass storage device so I can copy movies/series too and from it.

I see the following when I connect it to my system

kernel: usb 1-4: new high-speed USB device number 7 using xhci_hcd
systemd[1]: Starting Cleanup of Temporary Directories...
systemd[1]: Started Cleanup of Temporary Directories.
mtp-probe[4978]: checking bus 1, device 7: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-4"
kernel: usb 1-4: can't set config #1, error -110
mtp-probe[4978]: bus: 1, device: 7 was not an MTP device
kernel: usb 1-4: USB disconnect, device number 7

lsusb shows me

Bus 001 Device 008: ID 174c:5106 ASMedia Technology Inc. ASM1051 SATA 3Gb/s bridge
Couldn't open device, some information will be missing
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.10
  bDeviceClass            0 
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x174c ASMedia Technology Inc.
  idProduct          0x5106 ASM1051 SATA 3Gb/s bridge
  bcdDevice            0.01
  iManufacturer           2 
  iProduct                3 
  iSerial                 1 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xc0
      Self Powered
    MaxPower                0mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk-Only
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0

My kernel and distro

uname -a
Linux aaron-pc 4.9.24-1-MANJARO #1 SMP PREEMPT Fri Apr 21 08:32:28 UTC 2017 x86_64 GNU/Linux
7

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
3
  • 1
    seems to work only for one concrete usb flash drive.
    – kyb
    Oct 6 '17 at 21:33
  • 1
    @kyb that is correct this is an example of how to add that rule so it work for my drive. I will update the answer show I show how I got my drives device ID
    – nelaaro
    Oct 7 '17 at 14:24
  • Archlinux was indeed wrongly detecting my Kindle paperwhite as an MTP device, forcing it to be a USB storage with this udev rule worked, thank you!!
    – Terseus
    Feb 12 '19 at 20:50
3

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

5
  • 1
    That's incorrect, don't manually edit files under /lib. Your changes will be wiped by the next package update. Make an override under /etc/udev/rules.d instead.
    – ulidtko
    Jan 11 '18 at 21:47
  • @ulidtko: I saw this on some official forums. But you are right. Should I copy whole 69-libmtp.rules from /lib to /etc/udev/rules.d, then make changes into it? Jan 12 '18 at 9:10
  • 2
    Yes. Rule files under /etc/udev/rules.d override those in /lib/udev/rules.d if they're named identically. Sort of similar to how systemd allows overriding unit files.
    – ulidtko
    Jan 12 '18 at 12:29
  • @ulidtko: Have updated the answer Jan 12 '18 at 13:41
  • This was useful to disable my Ticwatch Pro being shown as an MTP device, even though I'm not exactly able to use it as so and only wanted to charge it. Mar 9 '19 at 1:51
-2

I'm experimenting peripherical disconnections using thinkpad dock (here) Checking journalctl I found that last lines before disconnection shows mtp-probe device error, and I think the cause it could be the same exposed here but with my monitor. How could I find my devices in order to exclude them for mtp-probe?

My lsusb:

Bus 002 Device 008: ID 17ef:1010 Lenovo Lenovo ThinkPad Dock   
Bus 002 Device 002: ID 0bda:0316 Realtek Semiconductor Corp. USB3.0-CRW
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 006: ID 138a:0097 Validity Sensors, Inc. 
Bus 001 Device 005: ID 5986:2118 Acer, Inc Integrated Camera
Bus 001 Device 030: ID 046d:c084 Logitech, Inc. G203 Gaming Mouse
Bus 001 Device 029: ID 17ef:100f Lenovo Lenovo ThinkPad Dock   
Bus 001 Device 028: ID 17ef:1010 Lenovo Lenovo ThinkPad Dock   
Bus 001 Device 027: ID 04b4:1007 Cypress Semiconductor Corp. 
Bus 001 Device 008: ID 2386:340e Raydium Corporation Raydium Touch System
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
1
  • Please do not submit questions as answers to previous questions. Instead, create a new post.
    – gnubeard
    Mar 26 '20 at 19:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.