From 5285473bbeabb03683a433d95c4551ebb52bbec4 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Sat, 15 Jun 2013 11:21:09 +0200 Subject: [PATCH] --- yaml --- r: 377207 b: refs/heads/master c: 342cda29343a6272c630f94ed56810a76740251b h: refs/heads/master i: 377205: a22e4ce46e96bc8edb5a2eeb5565e130710f314c 377203: e18034c2da4a5f56d6d95f6fa1bfcf20e969b216 377199: 5c5ac7ca4c6619ec97add8f9fb78a75f1380117b v: v3 --- [refs] | 2 +- trunk/sound/usb/card.c | 22 ++++++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index ec79646fda1a..80b0feee68c9 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: d81bf8cf549f7a6656a64924672a42c101d17026 +refs/heads/master: 342cda29343a6272c630f94ed56810a76740251b diff --git a/trunk/sound/usb/card.c b/trunk/sound/usb/card.c index 1a033177b83f..64952e2d3ed1 100644 --- a/trunk/sound/usb/card.c +++ b/trunk/sound/usb/card.c @@ -147,14 +147,32 @@ static int snd_usb_create_stream(struct snd_usb_audio *chip, int ctrlif, int int return -EINVAL; } + alts = &iface->altsetting[0]; + altsd = get_iface_desc(alts); + + /* + * Android with both accessory and audio interfaces enabled gets the + * interface numbers wrong. + */ + if ((chip->usb_id == USB_ID(0x18d1, 0x2d04) || + chip->usb_id == USB_ID(0x18d1, 0x2d05)) && + interface == 0 && + altsd->bInterfaceClass == USB_CLASS_VENDOR_SPEC && + altsd->bInterfaceSubClass == USB_SUBCLASS_VENDOR_SPEC) { + interface = 2; + iface = usb_ifnum_to_if(dev, interface); + if (!iface) + return -EINVAL; + alts = &iface->altsetting[0]; + altsd = get_iface_desc(alts); + } + if (usb_interface_claimed(iface)) { snd_printdd(KERN_INFO "%d:%d:%d: skipping, already claimed\n", dev->devnum, ctrlif, interface); return -EINVAL; } - alts = &iface->altsetting[0]; - altsd = get_iface_desc(alts); if ((altsd->bInterfaceClass == USB_CLASS_AUDIO || altsd->bInterfaceClass == USB_CLASS_VENDOR_SPEC) && altsd->bInterfaceSubClass == USB_SUBCLASS_MIDISTREAMING) {