Skip to contentSkip to conversation

usb: gadget: f_uac2: fix bFirstInterface in composite gadget

PATCH New John Keeping 1 participant 2 messages Jan 12, 2018 – Feb 14, 2018 USB

lore
Share & tools
lore
#0 lore raw

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.

---
 drivers/usb/gadget/function/f_uac2.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/usb/gadget/function/f_uac2.c +2 -0
index 11fe788b4308..d2dc1f00180b 100644
@@ -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;
#1 lore raw

PATCH v2 1/1 usb: gadget: f_uac2: fix bFirstInterface in composite gadget

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.

---
v2:
- Add Krzysztof's reviewed-by

 drivers/usb/gadget/function/f_uac2.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/usb/gadget/function/f_uac2.c +2 -0
index 11fe788b4308..d2dc1f00180b 100644
@@ -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;