summaryrefslogtreecommitdiffstats
path: root/sound/usb/card.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/usb/card.c')
-rw-r--r--sound/usb/card.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/sound/usb/card.c b/sound/usb/card.c
index 1a033177b83f..64952e2d3ed1 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -147,14 +147,32 @@ static int snd_usb_create_stream(struct snd_usb_audio *chip, int ctrlif, int int
147 return -EINVAL; 147 return -EINVAL;
148 } 148 }
149 149
150 alts = &iface->altsetting[0];
151 altsd = get_iface_desc(alts);
152
153 /*
154 * Android with both accessory and audio interfaces enabled gets the
155 * interface numbers wrong.
156 */
157 if ((chip->usb_id == USB_ID(0x18d1, 0x2d04) ||
158 chip->usb_id == USB_ID(0x18d1, 0x2d05)) &&
159 interface == 0 &&
160 altsd->bInterfaceClass == USB_CLASS_VENDOR_SPEC &&
161 altsd->bInterfaceSubClass == USB_SUBCLASS_VENDOR_SPEC) {
162 interface = 2;
163 iface = usb_ifnum_to_if(dev, interface);
164 if (!iface)
165 return -EINVAL;
166 alts = &iface->altsetting[0];
167 altsd = get_iface_desc(alts);
168 }
169
150 if (usb_interface_claimed(iface)) { 170 if (usb_interface_claimed(iface)) {
151 snd_printdd(KERN_INFO "%d:%d:%d: skipping, already claimed\n", 171 snd_printdd(KERN_INFO "%d:%d:%d: skipping, already claimed\n",
152 dev->devnum, ctrlif, interface); 172 dev->devnum, ctrlif, interface);
153 return -EINVAL; 173 return -EINVAL;
154 } 174 }
155 175
156 alts = &iface->altsetting[0];
157 altsd = get_iface_desc(alts);
158 if ((altsd->bInterfaceClass == USB_CLASS_AUDIO || 176 if ((altsd->bInterfaceClass == USB_CLASS_AUDIO ||
159 altsd->bInterfaceClass == USB_CLASS_VENDOR_SPEC) && 177 altsd->bInterfaceClass == USB_CLASS_VENDOR_SPEC) &&
160 altsd->bInterfaceSubClass == USB_SUBCLASS_MIDISTREAMING) { 178 altsd->bInterfaceSubClass == USB_SUBCLASS_MIDISTREAMING) {