diff options
author | Hans Petter Selasky <hselasky@FreeBSD.org> | 2021-11-09 21:07:36 +0000 |
---|---|---|
committer | Hans Petter Selasky <hselasky@FreeBSD.org> | 2021-11-16 08:10:42 +0000 |
commit | 43a03be0bb5070b445b1c16d17b1791d345ec5d0 (patch) | |
tree | d8e8a43bbc5434f74711e430ae7a911c66064ad8 | |
parent | c8a4404da737ea7e859287094de38953a84bdd68 (diff) | |
download | src-43a03be0bb5070b445b1c16d17b1791d345ec5d0.tar.gz src-43a03be0bb5070b445b1c16d17b1791d345ec5d0.zip |
snd_uaudio(4): Fix string index computations for iFeature.
This allows the iFeature strings to be properly read by the snd_uaudio(4) driver,
when parsing the audio feature unit descriptors.
Submitted by: Zhichao1.Li@dell.com
Sponsored by: NVIDIA Networking
(cherry picked from commit 11f09b17fe2cf0b5489601aee548a06486f0b749)
-rw-r--r-- | sys/dev/sound/usb/uaudio.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c index 221f4d3d1bd7..d620d5fd1cce 100644 --- a/sys/dev/sound/usb/uaudio.c +++ b/sys/dev/sound/usb/uaudio.c @@ -3666,18 +3666,18 @@ uaudio_mixer_add_feature(struct uaudio_softc *sc, cmask |= uaudio_mixer_feature_get_bmaControls(d, chan); } - if (nchan > MIX_MAX_CHAN) - nchan = MIX_MAX_CHAN; - MIX(sc).wIndex = MAKE_WORD(d->bUnitId, sc->sc_mixer_iface_no); - i = d->bmaControls[d->bControlSize]; + i = d->bmaControls[nchan * d->bControlSize]; if (i == 0 || usbd_req_get_string_any(sc->sc_udev, NULL, MIX(sc).desc, sizeof(MIX(sc).desc), i) != 0) { MIX(sc).desc[0] = 0; } + if (nchan > MIX_MAX_CHAN) + nchan = MIX_MAX_CHAN; + for (ctl = 1; ctl <= LOUDNESS_CONTROL; ctl++) { fumask = FU_MASK(ctl); @@ -3801,9 +3801,6 @@ uaudio20_mixer_add_feature(struct uaudio_softc *sc, for (chan = 1; chan < nchan; chan++) cmask |= UGETDW(d->bmaControls[chan]); - if (nchan > MIX_MAX_CHAN) - nchan = MIX_MAX_CHAN; - MIX(sc).wIndex = MAKE_WORD(d->bUnitId, sc->sc_mixer_iface_no); i = d->bmaControls[nchan][0]; @@ -3813,6 +3810,9 @@ uaudio20_mixer_add_feature(struct uaudio_softc *sc, MIX(sc).desc[0] = 0; } + if (nchan > MIX_MAX_CHAN) + nchan = MIX_MAX_CHAN; + for (ctl = 3; ctl != 0; ctl <<= 2) { mixernumber = uaudio20_mixer_determine_class(&iot[id]); |