usb: gadget: f_uac1: fix ep address for get sample rate

The f_uac1 use ep address 0x81 and 0x01 to get sample rate,
so it can only support uac1 ep1-in and ep1-out to get playback
and capture sample rate, it has limitation for USB composite
device (e.g. RNDIS & UAC1). This patch use in_ep->address and
out_ep->address instead of the fixed addresses.

Signed-off-by: William Wu <william.wu@rock-chips.com>
Change-Id: Ia1a454d9738324605c00c4889b3fe187fdfcdb7d
This commit is contained in:
William Wu
2021-05-14 14:37:55 +08:00
parent adc4b01322
commit 3b9546b824

View File

@@ -556,9 +556,9 @@ static int audio_get_endpoint_req(struct usb_function *f,
switch (ctrl->bRequest) {
case UAC_GET_CUR: {
if (cs == UAC_EP_CS_ATTR_SAMPLE_RATE) {
if (ep == (USB_DIR_IN | 1))
if (ep == agdev->in_ep->address)
val = opts->p_srate_active;
else if (ep == (USB_DIR_OUT | 1))
else if (ep == agdev->out_ep->address)
val = opts->c_srate_active;
buf[2] = (val >> 16) & 0xff;
buf[1] = (val >> 8) & 0xff;