From cd0d40eb14bf6f7edd043fb2381a905f495c1cea Mon Sep 17 00:00:00 2001 From: hselasky Date: Thu, 21 May 2015 07:07:28 +0000 Subject: [PATCH] MFC r282652: Ensure the USB audio driver doesn't attach twice on the same USB device by grabbing all the USB audio device interfaces. git-svn-id: svn://svn.freebsd.org/base/stable/9@283182 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/dev/sound/usb/uaudio.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c index a6e8e6e32..f3a6de5c7 100644 --- a/sys/dev/sound/usb/uaudio.c +++ b/sys/dev/sound/usb/uaudio.c @@ -1574,6 +1574,19 @@ uaudio_chan_fill_info_sub(struct uaudio_softc *sc, struct usb_device *udev, asf1d.v1 = NULL; ed1 = NULL; sed.v1 = NULL; + + /* + * There can only be one USB audio instance + * per USB device. Grab all USB audio + * interfaces on this USB device so that we + * don't attach USB audio twice: + */ + if (alt_index == 0 && curidx != sc->sc_mixer_iface_index && + (id->bInterfaceClass == UICLASS_AUDIO || audio_if != 0 || + midi_if != 0)) { + usbd_set_parent_iface(sc->sc_udev, curidx, + sc->sc_mixer_iface_index); + } } if (audio_if == 0) { @@ -1809,9 +1822,6 @@ uaudio_chan_fill_info_sub(struct uaudio_softc *sc, struct usb_device *udev, chan_alt->iface_index = curidx; chan_alt->iface_alt_index = alt_index; - usbd_set_parent_iface(sc->sc_udev, curidx, - sc->sc_mixer_iface_index); - if (ep_dir == UE_DIR_IN) chan_alt->usb_cfg = uaudio_cfg_record; else -- 2.45.0