[alsa-devel] [PATCH] USB: fix gathering of interface associations
Daniel Mack
zonque at gmail.com
Thu Jun 14 13:15:30 CEST 2012
On 12.06.2012 20:23, Daniel Mack wrote:
> TEAC's UD-H01 (and probably other devices) have a gap in the interface
> number allocation of their descriptors:
I now got a report from Sergio Tabanelli who tried this patch on real
hardware, and he confirmed the fix. I added some more people to the
patch description and copied stable@ as well.
Greg, can can this go through your tree?
Daniel
>
> Configuration Descriptor:
> bLength 9
> bDescriptorType 2
> wTotalLength 220
> bNumInterfaces 3
> [...]
> Interface Descriptor:
> bLength 9
> bDescriptorType 4
> bInterfaceNumber 0
> bAlternateSetting 0
> [...]
> Interface Association:
> bLength 8
> bDescriptorType 11
> bFirstInterface 2
> bInterfaceCount 2
> bFunctionClass 1 Audio
> bFunctionSubClass 0
> bFunctionProtocol 32
> iFunction 4
> Interface Descriptor:
> bLength 9
> bDescriptorType 4
> bInterfaceNumber 2
> bAlternateSetting 0
> [...]
>
> Once a configuration is selected, usb_set_configuration() walks the
> known interfaces of a given configuration and calls find_iad() on
> each of them to set the interface association pointer the interface
> is included in.
>
> The problem here is that the loop variable is taken for the interface
> number in the comparison logic that gathers the association. Which is
> fine as long as the descriptors are sane.
>
> In the case above, however, the logic gets out of sync and the
> interface association fields of all interfaces beyond the interface
> number gap are wrong.
>
> Fix this by passing the interface's bInterfaceNumber to find_iad()
> instead.
>
> Signed-off-by: Daniel Mack <zonque at gmail.com>
> Reported-by: bEN <ml_all at circa.be>
> Reported-by: Ivan Perrone <ivanperrone at hotmail.com>
> ---
>
> This patch has been tested on a virtual USB device emulated in QEMU.
> I'm still waiting for test results based on real hardware, but the bug
> is rather obvious is and the fix really simple.
>
> Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-USB-fix-gathering-of-interface-associations.patch
Type: text/x-patch
Size: 0 bytes
Desc: not available
Url : http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20120614/938b58ec/attachment.patch
More information about the Alsa-devel
mailing list