usb_midi fix to handle more "Class-Compliant" devices
|Reported by:||Pete||Owned by:||phoudoin|
|Has a Patch:||yes||Platform:||All|
This is an update to the usb_midi driver that seems to fix an incompatibility with some devices that are claimed to be "Class-Compliant" (in particular the iCON unit tested by Giovanni Mugnai. Thanks!) The driver was extensively developed in ticket #4463, but that was long ago closed, so I think a new ticket is preferable.
The problem seems to be the understanding of buffer/packet sizes. For receiving MIDI, the driver provides a 2048 byte buffer, and originally it passed this size to the queue request. This works fine with my M-Audio/MidiMan units, which just send each event as it's received.
The iCON device, though, seems to take that 2048 bytes as what it should buffer before it sends anything, and obligingly does so! Each USB packet sent to the device callback is 2048 bytes of 4-byte events (when that many are finally accumulated...).
The endpoint descriptor however specifies a maximum packet size of 4 bytes (one MIDI event) so the driver now passes this value from the descriptor to the queue request, rather than the buffer size. As a result the iCON now sends each event as it arrives. (The M-AUdio units have a max packet size of 64, and apparently are sensible about what to send when.)
The necessary patch is attached. [Yes, I know, it is as guideline deficient as the rest of the driver. (:-/)]
Change History (16)
by , 7 years ago