adafruit / circuitpython

CircuitPython - a Python implementation for teaching coding with microcontrollers
https://circuitpython.org
Other
4.04k stars 1.2k forks source link

Maybe fix size of USB MIDI Endpoint descriptors #4328

Open dhalbert opened 3 years ago

dhalbert commented 3 years ago

A user of TinyUSB noticed the MIDI Endpoint descriptors were 7 bytes instead of the 9 bytes specified by the USB MIDI 1.0 spec. The size reverts to 7 bytes in the USB MIDI 2.0 spec, adopted in May 2020.

This was fixed by @hathach in https://github.com/hathach/tinyusb/pull/688. He noted that CircuitPython is using 7-byte descriptors.

The odd thing is that our current code works. I think the descriptors may even have been vetted against some MIDI hardware. Perhaps all the major platforms don't care. @tannewt perhaps you have some recollection; it was a while ago.

hathach commented 3 years ago

@dhalbert both the host and device stack is able to skip the endpoint descriptor correctly using the bLength (1st byte of the descriptor). And both the additional synch and refresh bytes aren't used by MIDI v1. It is pure luck that it works so far :smile: