Skip to content

[TODO]: Default CircuitPython install (and Arduino usbmidi setup) advertises non-functional MIDI endpoints which lock the service until unplugged #1084

Description

Discussion here:
https://ptb.discord.com/channels/980245825202552942/1530573182355116215

Ordered Adafruit RP2350 Metro
Installed Circuit Python 10.2.1

Upon device reboot, the device advertises MIDI endpoints

Image

Those endpoints are also in the USB descriptors (although the descriptors are malformed)

RP2350 Descriptor Dump
Information for device Metro RP2350 (VID=0x239A PID=0x814E):

*** ERROR: Descriptor has errors! ***

------------------------------
Connection Information:
------------------------------
Device current bus speed: FullSpeed
Device supports USB 1.1 specification
Device supports USB 2.0 specification
Device address: 0x0028
Current configuration value: 0x01
Number of open pipes: 9


------------------------------
Device Descriptor:
------------------------------
0x12	bLength
0x01	bDescriptorType
0x0200	bcdUSB
0x00	bDeviceClass      
0x00	bDeviceSubClass   
0x00	bDeviceProtocol   
0x40	bMaxPacketSize0   (64 bytes)
0x239A	idVendor
0x814E	idProduct
0x0100	bcdDevice
0x01	iManufacturer   "Adafruit"
0x02	iProduct        "Metro RP2350"
0x03	iSerialNumber   "08F3BB49F57C4292"
0x01	bNumConfigurations


-------------------------
Configuration Descriptor:
-------------------------
0x09	bLength
0x02	bDescriptorType
0x00DA	wTotalLength   (218 bytes)
0x06	bNumInterfaces
0x01	bConfigurationValue
0x00	iConfiguration
0xA0	bmAttributes   (Bus-powered Device, Remote-Wakeup)
0x32	bMaxPower      (100 mA)

Interface Association Descriptor:
------------------------------
0x08	bLength
0x0B	bDescriptorType
0x00	bFirstInterface
0x02	bInterfaceCount
0x02	bFunctionClass      (Communication Device Class)
0x02	bFunctionSubClass   (Abstract Control Model - ACM)
0x00	bFunctionProtocol   
0x00	iFunction

Interface Descriptor:
------------------------------
0x09	bLength
0x04	bDescriptorType
0x00	bInterfaceNumber
0x00	bAlternateSetting
0x01	bNumEndPoints
0x02	bInterfaceClass      (Communication Device Class)
0x02	bInterfaceSubClass   (Abstract Control Model - ACM)
0x00	bInterfaceProtocol   
0x04	iInterface   "CircuitPython CDC control"

CDC Header Functional Descriptor:
------------------------------
0x05	bFunctionalLength
0x24	bDescriptorType
0x00	bDescriptorSubtype
0x0110	bcdCDC

CDC Call Management Functional Descriptor:
------------------------------
0x05	bFunctionalLength
0x24	bDescriptorType
0x01	bDescriptorSubtype
0x01	bmCapabilities
0x01	bDataInterface

CDC Abstract Control Management Functional Descriptor:
------------------------------
0x04	bFunctionalLength
0x24	bDescriptorType
0x02	bDescriptorSubtype
0x02	bmCapabilities

CDC Union Functional Descriptor:
------------------------------
0x05	bFunctionalLength
0x24	bDescriptorType
0x06	bDescriptorSubtype
0x00	bControlInterface
0x01	bSubordinateInterface(0)

Endpoint Descriptor:
------------------------------
0x07	bLength
0x05	bDescriptorType
0x81	bEndpointAddress  (IN endpoint 1)
0x03	bmAttributes      (Transfer: Interrupt / Synch: None / Usage: Data)
0x0040	wMaxPacketSize    (1 x 64 bytes)
0x10	bInterval         (16 frames)

Interface Descriptor:
------------------------------
0x09	bLength
0x04	bDescriptorType
0x01	bInterfaceNumber
0x00	bAlternateSetting
0x02	bNumEndPoints
0x0A	bInterfaceClass      (CDC Data)
0x00	bInterfaceSubClass   
0x00	bInterfaceProtocol   
0x05	iInterface   "CircuitPython CDC data"

Endpoint Descriptor:
------------------------------
0x07	bLength
0x05	bDescriptorType
0x02	bEndpointAddress  (OUT endpoint 2)
0x02	bmAttributes      (Transfer: Bulk / Synch: None / Usage: Data)
0x0040	wMaxPacketSize    (64 bytes)
0x00	bInterval         

Endpoint Descriptor:
------------------------------
0x07	bLength
0x05	bDescriptorType
0x82	bEndpointAddress  (IN endpoint 2)
0x02	bmAttributes      (Transfer: Bulk / Synch: None / Usage: Data)
0x0040	wMaxPacketSize    (64 bytes)
0x00	bInterval         

Interface Descriptor:
------------------------------
0x09	bLength
0x04	bDescriptorType
0x02	bInterfaceNumber
0x00	bAlternateSetting
0x02	bNumEndPoints
0x08	bInterfaceClass      (Mass Storage Device Class)
0x06	bInterfaceSubClass   (Transparent SCSI subclass)
0x50	bInterfaceProtocol   (Bulk only transport)
0x06	iInterface   "CircuitPython Mass Storage"

Endpoint Descriptor:
------------------------------
0x07	bLength
0x05	bDescriptorType
0x83	bEndpointAddress  (IN endpoint 3)
0x02	bmAttributes      (Transfer: Bulk / Synch: None / Usage: Data)
0x0040	wMaxPacketSize    (64 bytes)
0x00	bInterval         

Endpoint Descriptor:
------------------------------
0x07	bLength
0x05	bDescriptorType
0x03	bEndpointAddress  (OUT endpoint 3)
0x02	bmAttributes      (Transfer: Bulk / Synch: None / Usage: Data)
0x0040	wMaxPacketSize    (64 bytes)
0x00	bInterval         

Interface Descriptor:
------------------------------
0x09	bLength
0x04	bDescriptorType
0x03	bInterfaceNumber
0x00	bAlternateSetting
0x02	bNumEndPoints
0x03	bInterfaceClass      (Human Interface Device Class)
0x00	bInterfaceSubClass   
0x00	bInterfaceProtocol   
0x07	iInterface   "CircuitPython HID"

HID Descriptor:
------------------------------
0x09	bLength
0x21	bDescriptorType
0x0111	bcdHID
0x00	bCountryCode
0x01	bNumDescriptors
0x22	bDescriptorType   (Report descriptor)
0x009C	bDescriptorLength

Endpoint Descriptor:
------------------------------
0x07	bLength
0x05	bDescriptorType
0x84	bEndpointAddress  (IN endpoint 4)
0x03	bmAttributes      (Transfer: Interrupt / Synch: None / Usage: Data)
0x0040	wMaxPacketSize    (1 x 64 bytes)
0x08	bInterval         (8 frames)

Endpoint Descriptor:
------------------------------
0x07	bLength
0x05	bDescriptorType
0x04	bEndpointAddress  (OUT endpoint 4)
0x03	bmAttributes      (Transfer: Interrupt / Synch: None / Usage: Data)
0x0040	wMaxPacketSize    (1 x 64 bytes)
0x08	bInterval         (8 frames)

Interface Descriptor:
------------------------------
0x09	bLength
0x04	bDescriptorType
0x04	bInterfaceNumber
0x00	bAlternateSetting
0x00	bNumEndPoints
0x01	bInterfaceClass      (Audio Device Class)
0x01	bInterfaceSubClass   (Audio Control Interface)
0x00	bInterfaceProtocol   (Audio Protocol undefined)
0x09	iInterface   "CircuitPython Audio"

AC Interface Header Descriptor:
------------------------------
0x09	bLength
0x24	bDescriptorType
0x01	bDescriptorSubtype
0x0100	bcdADC
0x0009	wTotalLength   (9 bytes)
0x01	bInCollection
0x05	baInterfaceNr(1)

Interface Descriptor:
------------------------------
0x09	bLength
0x04	bDescriptorType
0x05	bInterfaceNumber
0x00	bAlternateSetting
0x02	bNumEndPoints
0x01	bInterfaceClass      (Audio Device Class)
0x03	bInterfaceSubClass   (MIDI Streaming Interface)
0x00	bInterfaceProtocol   (Audio Protocol undefined)
0x08	iInterface   "CircuitPython MIDI"

MS Interface Header Descriptor:
------------------------------
0x07	bLength
0x24	bDescriptorType
0x01	bDescriptorSubtype
0x0100	bcdMSC
0x0025	wTotalLength   (37 bytes)

MS MIDI IN Jack Descriptor:
------------------------------
0x06	bLength
0x24	bDescriptorType
0x02	bDescriptorSubtype
0x01	bJackType
0x01	bJackID
0x0A	iJack   "CircuitPython usb_midi.ports[0]"

MS MIDI IN Jack Descriptor:
------------------------------
0x06	bLength
0x24	bDescriptorType
0x02	bDescriptorSubtype
0x02	bJackType
0x02	bJackID
0x00	iJack

MS MIDI OUT Jack Descriptor:
------------------------------
0x09	bLength
0x24	bDescriptorType
0x03	bDescriptorSubtype
0x01	bJackType
0x03	bJackID
0x01	bNrInputPins
0x02	baSourceID(1)
0x01	baSourcePin(1)
0x0B	iJack   "CircuitPython usb_midi.ports[0]"

MS MIDI OUT Jack Descriptor:
------------------------------
0x09	bLength
0x24	bDescriptorType
0x03	bDescriptorSubtype
0x02	bJackType
0x04	bJackID
0x01	bNrInputPins
0x01	baSourceID(1)
0x01	baSourcePin(1)
0x00	iJack

Endpoint Descriptor (Audio/MIDI 1.0):
------------------------------
0x07	bLength
0x05	bDescriptorType
*** ERROR: Invalid descriptor length 0x07 for Audio/MIDI 1.0 endpoint (9 bytes expected)
Hex dump: 
0x07 0x05 0x05 0x02 0x40 0x00 0x00 

MS Bulk Data Endpoint Descriptor:
------------------------------
0x05	bLength
0x25	bDescriptorType
0x01	bDescriptorSubtype
0x01	bNumEmbMIDIJack
0x01	baAssocJackID(1)

Endpoint Descriptor (Audio/MIDI 1.0):
------------------------------
0x07	bLength
0x05	bDescriptorType
*** ERROR: Invalid descriptor length 0x07 for Audio/MIDI 1.0 endpoint (9 bytes expected)
Hex dump: 
0x07 0x05 0x85 0x02 0x40 0x00 0x00 

MS Bulk Data Endpoint Descriptor:
------------------------------
0x05	bLength
0x25	bDescriptorType
0x01	bDescriptorSubtype
0x01	bNumEmbMIDIJack
0x03	baAssocJackID(1)

Microsoft OS Descriptor is not available. Error code: 0x0000001F


--------------------------------
String Descriptor Table
--------------------------------
Index  LANGID  String
0x00   0x0000  0x0409 
0x01   0x0409  "Adafruit"
0x02   0x0409  "Metro RP2350"
0x03   0x0409  "08F3BB49F57C4292"
0x04   0x0409  "CircuitPython CDC control"
0x05   0x0409  "CircuitPython CDC data"
0x06   0x0409  "CircuitPython Mass Storage"
0x07   0x0409  "CircuitPython HID"
0x08   0x0409  "CircuitPython MIDI"
0x09   0x0409  "CircuitPython Audio"
0x0A   0x0409  "CircuitPython usb_midi.ports[0]"
0x0B   0x0409  "CircuitPython usb_midi.ports[0]"

------------------------------

Connection path for device: 
USB xHCI Compliant Host Controller
Root Hub
Generic USB Hub
Generic USB Hub
Metro RP2350 (VID=0x239A PID=0x814E) Port: 1

Running on: Windows 10 or greater (Build Version 29617)

Brought to you by TDD v2.19.0, Dec  5 2023, 12:08:38

Windows MIDI Services properly enumerates the MIDI interface and creates the appropriate endpoint and ports

Image

(Note: if "new style names" are selected, the name displayed will be the cleaned up version of what's in iJack. However, because we clean off the indexes that are in brackets, the name looks a little different from the USB decsriptor

Image

Problem

The problem is, these ports are not wired up. And devices are shipping with only one of them enabled (the three fader box type devices, for example). We're seeing the same thing with the Leonardo MIDI where those fader boxes, which are sold to customers, just come with a note saying not to enable the MIDI Out in your DAW.

Image

Prior to Windows MIDI Services, this non-functional port would lock up only a single application. However, now it locks up the Windows Service.

Need to find a way to work around these broken devices.

If you are the author of these devices, please go in and customize the USB MIDI library (Leonardo) or the Circuit Python MIDI setup (Circuit Python) to only expose the ports you actually implement.

Pete
Microsoft

Metadata

Metadata

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions