usb: gadget: f_uac2: fix bFirstInterface in composite gadget
authorJohn Keeping <john@metanate.com>
Fri, 12 Jan 2018 18:43:32 +0000 (18:43 +0000)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Mon, 12 Feb 2018 08:48:59 +0000 (10:48 +0200)
If there are multiple functions associated with a configuration, then
the UAC2 interfaces may not start at zero.  Set the correct first
interface number in the association descriptor so that the audio
interfaces are enumerated correctly in this case.

Reviewed-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Signed-off-by: John Keeping <john@metanate.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/gadget/function/f_uac2.c

index 11fe788..d2dc1f0 100644 (file)
@@ -524,6 +524,8 @@ afunc_bind(struct usb_configuration *cfg, struct usb_function *fn)
                dev_err(dev, "%s:%d Error!\n", __func__, __LINE__);
                return ret;
        }
+       iad_desc.bFirstInterface = ret;
+
        std_ac_if_desc.bInterfaceNumber = ret;
        uac2->ac_intf = ret;
        uac2->ac_alt = 0;