usb: mbim: Fixed alternate interface request
To pass USBCV chapter 9 tests, alt interface request must
return the last alt interface number set by host.
mbim get_alt now returns the correct alternate interface number.
Change-Id: Ibb9e7b0e118c3425f2c80d86ebacfe670a13a9be
CRs-Fixed: 427504
Signed-off-by: Bar Weiner <bweiner@codeaurora.org>
diff --git a/drivers/usb/gadget/f_mbim.c b/drivers/usb/gadget/f_mbim.c
index 98c6dbc..408fa6d 100644
--- a/drivers/usb/gadget/f_mbim.c
+++ b/drivers/usb/gadget/f_mbim.c
@@ -91,6 +91,7 @@
struct mbim_ep_descs hs;
u8 ctrl_id, data_id;
+ u8 data_alt_int;
struct ndp_parser_opts *parser_opts;
@@ -1319,6 +1320,7 @@
}
}
+ mbim->data_alt_int = alt;
spin_lock(&mbim->lock);
mbim_notify(mbim);
spin_unlock(&mbim->lock);
@@ -1351,7 +1353,10 @@
if (intf == mbim->ctrl_id)
return 0;
- return mbim->bam_port.in->driver_data ? 1 : 0;
+ else if (intf == mbim->data_id)
+ return mbim->data_alt_int;
+
+ return -EINVAL;
}
static void mbim_disable(struct usb_function *f)
@@ -1418,6 +1423,7 @@
if (status < 0)
goto fail;
mbim->data_id = status;
+ mbim->data_alt_int = 0;
mbim_data_nop_intf.bInterfaceNumber = status;
mbim_data_intf.bInterfaceNumber = status;