Commit 3985f3ab authored by Felipe Balbi's avatar Felipe Balbi

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: default avatarFelipe Balbi <balbi@ti.com>
parent de1e6e79
...@@ -35,6 +35,7 @@ struct f_obex { ...@@ -35,6 +35,7 @@ struct f_obex {
struct gserial port; struct gserial port;
u8 ctrl_id; u8 ctrl_id;
u8 data_id; u8 data_id;
u8 cur_alt;
u8 port_num; u8 port_num;
u8 can_activate; u8 can_activate;
}; };
...@@ -235,6 +236,8 @@ static int obex_set_alt(struct usb_function *f, unsigned intf, unsigned alt) ...@@ -235,6 +236,8 @@ static int obex_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
} else } else
goto fail; goto fail;
obex->cur_alt = alt;
return 0; return 0;
fail: fail:
...@@ -245,10 +248,7 @@ static int obex_get_alt(struct usb_function *f, unsigned intf) ...@@ -245,10 +248,7 @@ static int obex_get_alt(struct usb_function *f, unsigned intf)
{ {
struct f_obex *obex = func_to_obex(f); struct f_obex *obex = func_to_obex(f);
if (intf == obex->ctrl_id) return obex->cur_alt;
return 0;
return obex->port.in->driver_data ? 1 : 0;
} }
static void obex_disable(struct usb_function *f) static void obex_disable(struct usb_function *f)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment