Linux, USB + MIDI, "Unable to open MTP device"

ithinu

Active member
Hi,

I have a Teensy 3.6 project with some references to usbMIDI. When I select the port type Serial and comment out these references, the device connects properly as Serial. However, when I change the port type to Serial + MIDI, the device connects as Serial + MIDI but also a dialog pops up "Unable to open MTP device 005/028". Teensy udev rules are installed.

Here is the syslog:
Code:
2024-09-22T13:16:58.314684+02:00 kernel: usb 5-1: new full-speed USB device number 29 using xhci_hcd
2024-09-22T13:16:58.462877+02:00 kernel: usb 5-1: New USB device found, idVendor=16c0, idProduct=0489, bcdDevice= 2.77
2024-09-22T13:16:58.462892+02:00 kernel: usb 5-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
2024-09-22T13:16:58.462893+02:00 kernel: usb 5-1: Product: Teensy MIDI
2024-09-22T13:16:58.462895+02:00 kernel: usb 5-1: Manufacturer: Teensyduino
2024-09-22T13:16:58.462896+02:00 kernel: usb 5-1: SerialNumber: 3069870
2024-09-22T13:16:58.528679+02:00 kernel: cdc_acm 5-1:1.0: ttyACM0: USB ACM device
2024-09-22T13:16:58.534664+02:00 kernel: usb 5-1: Quirk or no altset; falling back to MIDI 1.0
2024-09-22T13:16:58.546860+02:00 colord[2165]: CdMain: failed to emit DeviceAdded: failed to register object: An object is already exported for the interface org.freedesktop.ColorManager.Device at /org/freedesktop/ColorManager/devices/sysfs__null_
2024-09-22T13:16:58.547777+02:00 colord[2165]: CdMain: failed to emit DeviceAdded: failed to register object: An object is already exported for the interface org.freedesktop.ColorManager.Device at /org/freedesktop/ColorManager/devices/sysfs__null_
2024-09-22T13:16:58.550183+02:00 (udev-worker)[115091]: controlC4: Process '/usr/sbin/alsactl -E HOME=/run/alsa -E XDG_RUNTIME_DIR=/run/alsa/runtime restore 4' failed with exit code 99.
2024-09-22T13:16:58.571070+02:00 gvfsd[115116]: LIBMTP PANIC: Unable to find interface & endpoints of device
2024-09-22T13:16:59.803676+02:00 gvfsd[115116]: Device 0 (VID=16c0 and PID=0489) is a Niteto ADF-Drive.
 
This is an OS MIDI 2.0 implementation, looking for a MIDI 2.0 device, failing, and falling back to MIDI 1.0 as required by the spec.
 
Thank you Nantonos, but what it has to do with libmtp? See the two last lines of the log.

Maybe it does, because MTP shows these dialogs only after MIDI is enabled. A problem with teensyduino? A problem with libmtp? Whatever else?
 
2024-09-22T13:16:58.462877+02:00 kernel: usb 5-1: New USB device found, idVendor=16c0, idProduct=0489, bcdDevice= 2.77

I wonder if it has something to do with the UDEV rules, which includes the lines:
Code:
ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04*", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1"
ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789a]*", ENV{MTP_NO_PROBE}="1"

Although I think that actually tells linux to not check this device for MTP...
The current ones that MTP supports are: 0x4D1 and 0x4D5, which this rule ("04[789a]*") does not match

You might want to check your version of udev rules?
 
Actually, you might want to check for other UDEV rules?
2024-09-22T13:16:59.803676+02:00 gvfsd[115116]: Device 0 (VID=16c0 and PID=0489) is a Niteto ADF-Drive.
Looking up at the net I see:
And it does have have MTP support as, the last commit shows:
1727618959288.png

You should check for other rules files that contain 16c0 and if you are not using the Amiga DD and SD support, try removing that rule file.

Edit: Or maybe it is installed as a driver?
 
Last edited:
I have the latest UDEV rules for teensy, the same which you listed, and there are no other UDEV rules in /etc/udev/rules.d/. I think that these rules are correctly set.

My guess:
  1. Someone took T3.6, made a product (?) out of it named Niteto which supports MTP.
  2. They did not change T3.6 usb id.
  3. A user of that product found out that libmtp does not support the device, informed libmtp ("Please report this VID/PID and the device model to the libmtp development team").
  4. Libmtp development team does not have checks in place for prototype board ids, so they effectively hardcoded T3.6 as a certain music player - https://github.com/libmtp/libmtp/blob/master/src/music-players.h line 4362.
From now on, T3.6s are "recognized" by the ubiquitous libmtp as music players. Since my T3.6 is not a music player, libmtp "panics" and opens an error dialog. It does not happen, though, if Teensy USB is configured only as Serial. It does happen if Teensy is configured as Serial + MIDI. I haven't tested other USB configurations.
 
Libmtp development team does not have checks in place for prototype board ids, so they effectively hardcoded T3.6 as a certain music player - https://github.com/libmtp/libmtp/blob/master/src/music-players.h line 4362.
Actually, they hard coded: any Teensy with MTP+SERIAL USB Type...

Code:
#elif defined(USB_MIDI_SERIAL)
  #define VENDOR_ID        0x16C0
  #define PRODUCT_ID        0x0489
  #define MANUFACTURER_NAME    {'T','e','e','n','s','y','d','u','i','n','o'}
  #define MANUFACTURER_NAME_LEN    11
  #define PRODUCT_NAME        {'T','e','e','n','s','y',' ','M','I','D','I'}

Sounds like something for @Paul ... I only use Ubuntu when I need to, so no idea of how to work around this, and/or
someone being able to have libmtp remove that from their list...
 
Back
Top