Closed jtotto closed 7 years ago
Thanks for this great contribution! I need some time to check it.
I have merged your code with only two small additions. Please have a look at the diff from the latest commit for info. Thanks again!
Cheers, thanks for the CR!
This patch adds support for the USB-MIDI device class (for musical instruments) as specified by http://www.usb.org/developers/docs/devclass_docs/midi10.pdf. The class driver is based on the mouse and gamepad drivers - all it does is find the right bulk-in endpoint at configuration time and read MIDI packets from it.
I did have to make some slight modifications to the core library to get it working - endpoint descriptors for devices in the audio class annoyingly extend the standard USB endpoint descriptors with two extra members (see page 25 of the linked USB-MIDI spec), so various assertions about the size of endpoint descriptors needed to be relaxed. The audio class (and MIDI within it) also add a number of other class-specific descriptors.
I've tried to be consistent with the rest of the codebase with respect to style, but if I've gotten any of it wrong please let me know. Thanks for the fantastic library!