Skip to content

Commit 0d06238

Browse files
committed
usb: gadget: f_uac1: set baInterfaceNr of ac_header_desc dynamically
As per UAC1.0 spec Table 4-2: Class-Specific AC Interface Header Descriptor, the baInterfaceNr(n) are indicated the interface number of each AudioStreaming. So it needs to set the baInterfaceNr dynamically according to the interface IDs allocated by the usb gadget core. Change-Id: I57cc7b0070fb166aac4360262b2a7e6f2f5df6e1 Signed-off-by: William Wu <william.wu@rock-chips.com>
1 parent 99644c1 commit 0d06238

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

drivers/usb/gadget/function/f_uac1.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,8 @@ static struct uac1_ac_header_descriptor_2 ac_header_desc = {
7272
.bDescriptorType = USB_DT_CS_INTERFACE,
7373
.bDescriptorSubtype = UAC_HEADER,
7474
.bcdADC = cpu_to_le16(0x0100),
75-
.baInterfaceNr = {
76-
/*
77-
* Assume the maximum interfaces number of the UAC AudioStream
78-
* interfaces
79-
*/
80-
[0] = 1,
81-
[1] = 2,
82-
}
75+
/* .baInterfaceNr[0] = DYNAMIC */
76+
/* .baInterfaceNr[1] = DYNAMIC */
8377
};
8478

8579
static struct uac_input_terminal_descriptor usb_out_it_desc = {
@@ -892,6 +886,8 @@ static int f_audio_bind(struct usb_configuration *c, struct usb_function *f)
892886
ac_interface_desc.bInterfaceNumber = status;
893887
uac1->ac_intf = status;
894888
uac1->ac_alt = 0;
889+
ac_header_desc.baInterfaceNr[0] = ++status;
890+
ac_header_desc.baInterfaceNr[1] = ++status;
895891

896892
if (EPOUT_EN(audio_opts)) {
897893
status = usb_interface_id(c, f);

0 commit comments

Comments
 (0)