ALSA: snd-usb: try harder to find USB_DT_CS_ENDPOINT
authorDaniel Mack <zonque@gmail.com>
Wed, 24 Apr 2013 17:38:42 +0000 (19:38 +0200)
committerBen Hutchings <ben@decadent.org.uk>
Mon, 13 May 2013 14:02:25 +0000 (15:02 +0100)
commit7b475d0e41f0979b8f8f475ae5fd3e026216e318
treeed6d787dd2ccc3777d63f9dab18d329bcedf4635
parentae04c6d22a958d4879c4139ea57dee8a92243e42
ALSA: snd-usb: try harder to find USB_DT_CS_ENDPOINT

commit ebfc594c02148b6a85c2f178cf167a44a3c3ce10 upstream.

The USB_DT_CS_ENDPOINT class-specific endpoint descriptor is usually
stuffed directly after the standard USB endpoint descriptor, and this is
where the driver currently expects it to be.

There are, however, devices in the wild that have it the other way
around in their descriptor sets, so the USB_DT_CS_ENDPOINT comes
*before* the standard enpoint. Devices known to implement it that way
are "Sennheiser BTD-500" and Plantronics USB headsets.

When the driver can't find the USB_DT_CS_ENDPOINT, it won't be able to
change sample rates, as the bitmask for the validity of this command is
storen in bmAttributes of that descriptor.

Fix this by searching the entire interface instead of just the extra
bytes of the first endpoint, in case the latter fails.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Reported-and-tested-by: Torstein Hegge <hegge@resisty.net>
Reported-and-tested-by: Yves G <alsa-user@vivigatt.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
sound/usb/stream.c