diff options
author | hselasky <hselasky@FreeBSD.org> | 2012-10-24 08:00:01 +0000 |
---|---|---|
committer | hselasky <hselasky@FreeBSD.org> | 2012-10-24 08:00:01 +0000 |
commit | 4148eda911072de3dfcf59cb053a4b803f89c743 (patch) | |
tree | 57696af4b69746ab4cd2625b92e302b689287427 /sys/dev/sound/usb | |
parent | ddc1ceecb37fd6540ef54cf3194f65a36fd330e0 (diff) | |
download | FreeBSD-src-4148eda911072de3dfcf59cb053a4b803f89c743.zip FreeBSD-src-4148eda911072de3dfcf59cb053a4b803f89c743.tar.gz |
Fix USB audio specification compliance by filtering which descriptors can
appear on which interface. This fixes detection of some USB audio adapters.
Also increase the channel limit for FULL speed devices to 4 channels.
Tested by: gavin
MFC after: 1 week
Diffstat (limited to 'sys/dev/sound/usb')
-rw-r--r-- | sys/dev/sound/usb/uaudio.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c index a5b2b3c..986be43 100644 --- a/sys/dev/sound/usb/uaudio.c +++ b/sys/dev/sound/usb/uaudio.c @@ -1054,13 +1054,20 @@ uaudio_chan_fill_info_sub(struct uaudio_softc *sc, struct usb_device *udev, sed.v1 = NULL; } - if ((acdp == NULL) && - (desc->bDescriptorType == UDESC_CS_INTERFACE) && - (desc->bDescriptorSubtype == AS_GENERAL) && - (desc->bDescriptorSubtype == UDESCSUB_AC_HEADER) && - (desc->bLength >= sizeof(*acdp))) { - acdp = (void *)desc; - audio_rev = UGETW(acdp->bcdADC); + if (audio_if == 0) { + if ((acdp == NULL) && + (desc->bDescriptorType == UDESC_CS_INTERFACE) && + (desc->bDescriptorSubtype == UDESCSUB_AC_HEADER) && + (desc->bLength >= sizeof(*acdp))) { + acdp = (void *)desc; + audio_rev = UGETW(acdp->bcdADC); + } + + /* + * Don't collect any USB audio descriptors if + * this is not an USB audio stream interface. + */ + continue; } if ((acdp != NULL) && @@ -1132,9 +1139,8 @@ uaudio_chan_fill_info_sub(struct uaudio_softc *sc, struct usb_device *udev, sed.v1 = (void *)desc; } } - if (audio_if == 0 || asid.v1 == NULL || - asf1d.v1 == NULL || ed1 == NULL || - sed.v1 == NULL) { + if (asid.v1 == NULL || asf1d.v1 == NULL || + ed1 == NULL || sed.v1 == NULL) { /* need more descriptors */ continue; } @@ -1349,7 +1355,7 @@ uaudio_chan_fill_info(struct uaudio_softc *sc, struct usb_device *udev) * disable surround setups on FULL-speed USB * by default */ - channels = 2; + channels = 4; break; default: channels = 16; |