ALSA: usb-audio: prevent CH345 multiport output SysEx corruption
authorClemens Ladisch <clemens@ladisch.de>
Sun, 15 Nov 2015 21:38:29 +0000 (22:38 +0100)
committerZefan Li <lizefan@huawei.com>
Wed, 26 Oct 2016 15:15:31 +0000 (23:15 +0800)
commit1139b9c3142a5970786acfd7f59ba66c5d212c12
treee9734161aa39aa71940ffc9044bd2704fe58ace8
parent57d3b5d74b60c08d0a85a1d04d87351846e867ed
ALSA: usb-audio: prevent CH345 multiport output SysEx corruption

commit 1ca8b201309d842642f221db7f02f71c0af5be2d upstream.

The CH345 USB MIDI chip has two output ports.  However, they are
multiplexed through one pin, and the number of ports cannot be reduced
even for hardware that implements only one connector, so for those
devices, data sent to either port ends up on the same hardware output.
This becomes a problem when both ports are used at the same time, as
longer MIDI commands (such as SysEx messages) are likely to be
interrupted by messages from the other port, and thus to get lost.

It would not be possible for the driver to detect how many ports the
device actually has, except that in practice, _all_ devices built with
the CH345 have only one port.  So we can just ignore the device's
descriptors, and hardcode one output port.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Zefan Li <lizefan@huawei.com>
sound/usb/midi.c
sound/usb/quirks-table.h
sound/usb/quirks.c
sound/usb/usbaudio.h