endpoint.c (50d1e9302bab7d35dae7146f8c468e0943015616) | endpoint.c (74754f974b36c5a1156be46d0da05ab2c0a0960b) |
---|---|
1/* 2 * This program is free software; you can redistribute it and/or modify 3 * it under the terms of the GNU General Public License as published by 4 * the Free Software Foundation; either version 2 of the License, or 5 * (at your option) any later version. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of --- 144 unchanged lines hidden (view full) --- 153{ 154 struct usb_device *dev; 155 struct usb_interface *iface; 156 struct usb_host_interface *alts; 157 struct usb_interface_descriptor *altsd; 158 int i, altno, err, stream; 159 int format = 0, num_channels = 0; 160 struct audioformat *fp = NULL; | 1/* 2 * This program is free software; you can redistribute it and/or modify 3 * it under the terms of the GNU General Public License as published by 4 * the Free Software Foundation; either version 2 of the License, or 5 * (at your option) any later version. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of --- 144 unchanged lines hidden (view full) --- 153{ 154 struct usb_device *dev; 155 struct usb_interface *iface; 156 struct usb_host_interface *alts; 157 struct usb_interface_descriptor *altsd; 158 int i, altno, err, stream; 159 int format = 0, num_channels = 0; 160 struct audioformat *fp = NULL; |
161 unsigned char *fmt, *csep; | 161 unsigned char *csep; |
162 int num, protocol; | 162 int num, protocol; |
163 struct uac_format_type_i_continuous_descriptor *fmt; |
|
163 164 dev = chip->dev; 165 166 /* parse the interface's altsettings */ 167 iface = usb_ifnum_to_if(dev, iface_no); 168 169 num = iface->num_altsetting; 170 --- 80 unchanged lines hidden (view full) --- 251 252 /* get format type */ 253 fmt = snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL, UAC_FORMAT_TYPE); 254 if (!fmt) { 255 snd_printk(KERN_ERR "%d:%u:%d : no UAC_FORMAT_TYPE desc\n", 256 dev->devnum, iface_no, altno); 257 continue; 258 } | 164 165 dev = chip->dev; 166 167 /* parse the interface's altsettings */ 168 iface = usb_ifnum_to_if(dev, iface_no); 169 170 num = iface->num_altsetting; 171 --- 80 unchanged lines hidden (view full) --- 252 253 /* get format type */ 254 fmt = snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL, UAC_FORMAT_TYPE); 255 if (!fmt) { 256 snd_printk(KERN_ERR "%d:%u:%d : no UAC_FORMAT_TYPE desc\n", 257 dev->devnum, iface_no, altno); 258 continue; 259 } |
259 if (((protocol == UAC_VERSION_1) && (fmt[0] < 8)) || 260 ((protocol == UAC_VERSION_2) && (fmt[0] != 6))) { | 260 if (((protocol == UAC_VERSION_1) && (fmt->bLength < 8)) || 261 ((protocol == UAC_VERSION_2) && (fmt->bLength != 6))) { |
261 snd_printk(KERN_ERR "%d:%u:%d : invalid UAC_FORMAT_TYPE desc\n", 262 dev->devnum, iface_no, altno); 263 continue; 264 } 265 266 /* 267 * Blue Microphones workaround: The last altsetting is identical 268 * with the previous one, except for a larger packet size, but 269 * is actually a mislabeled two-channel setting; ignore it. 270 */ | 262 snd_printk(KERN_ERR "%d:%u:%d : invalid UAC_FORMAT_TYPE desc\n", 263 dev->devnum, iface_no, altno); 264 continue; 265 } 266 267 /* 268 * Blue Microphones workaround: The last altsetting is identical 269 * with the previous one, except for a larger packet size, but 270 * is actually a mislabeled two-channel setting; ignore it. 271 */ |
271 if (fmt[4] == 1 && fmt[5] == 2 && altno == 2 && num == 3 && | 272 if (fmt->bNrChannels == 1 && 273 fmt->bSubframeSize == 2 && 274 altno == 2 && num == 3 && |
272 fp && fp->altsetting == 1 && fp->channels == 1 && 273 fp->formats == SNDRV_PCM_FMTBIT_S16_LE && 274 protocol == UAC_VERSION_1 && 275 le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize) == 276 fp->maxpacksize * 2) 277 continue; 278 279 csep = snd_usb_find_desc(alts->endpoint[0].extra, alts->endpoint[0].extralen, NULL, USB_DT_CS_ENDPOINT); --- 83 unchanged lines hidden --- | 275 fp && fp->altsetting == 1 && fp->channels == 1 && 276 fp->formats == SNDRV_PCM_FMTBIT_S16_LE && 277 protocol == UAC_VERSION_1 && 278 le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize) == 279 fp->maxpacksize * 2) 280 continue; 281 282 csep = snd_usb_find_desc(alts->endpoint[0].extra, alts->endpoint[0].extralen, NULL, USB_DT_CS_ENDPOINT); --- 83 unchanged lines hidden --- |