diff options
author | Felipe Balbi <balbi@ti.com> | 2014-09-29 15:18:20 -0500 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2014-10-20 15:58:49 -0500 |
commit | 3985f3ab0834edf014ebd19192d9dd77422dea67 (patch) | |
tree | a313a9605f7dd3be7dc73ad382067bbf2486b728 /drivers/usb | |
parent | de1e6e799fc4e6f0452737e454267c0bfdf88c62 (diff) | |
download | linux-3985f3ab0834edf014ebd19192d9dd77422dea67.tar.bz2 |
usb: gadget: function: f_obex: fix Interface Descriptor Test
On USB20CV's Interface Descriptor Test, a series
of SetInterface/GetInterface requests are issued
and gadget driver is required to always return
correct alternate setting.
In one step of the test, g_serial with f_obex
was returning the wrong value (1 instead of 0).
In order to fix this, we will now hold currently
selected alternate setting inside our struct f_obex
and just return that from our ->get_alt()
implementation.
Note that his also simplifies the code a bit.
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/gadget/function/f_obex.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/usb/gadget/function/f_obex.c b/drivers/usb/gadget/function/f_obex.c index 5f40080c92cc..1a1a490415f4 100644 --- a/drivers/usb/gadget/function/f_obex.c +++ b/drivers/usb/gadget/function/f_obex.c @@ -35,6 +35,7 @@ struct f_obex { struct gserial port; u8 ctrl_id; u8 data_id; + u8 cur_alt; u8 port_num; u8 can_activate; }; @@ -235,6 +236,8 @@ static int obex_set_alt(struct usb_function *f, unsigned intf, unsigned alt) } else goto fail; + obex->cur_alt = alt; + return 0; fail: @@ -245,10 +248,7 @@ static int obex_get_alt(struct usb_function *f, unsigned intf) { struct f_obex *obex = func_to_obex(f); - if (intf == obex->ctrl_id) - return 0; - - return obex->port.in->driver_data ? 1 : 0; + return obex->cur_alt; } static void obex_disable(struct usb_function *f) |