[U-Boot] [PATCH 1/2] usb: gadget: fastboot: Request status and length check in rx handler
Paul Kocialkowski
contact at paulk.fr
Wed Jul 15 15:53:43 CEST 2015
Le mardi 14 juillet 2015 à 13:32 +0200, Lukasz Majewski a écrit :
> Hi Paul,
>
> > Le mardi 14 juillet 2015 à 12:22 +0200, Lukasz Majewski a écrit :
> > > Hi Paul,
> > >
> > > > This avoids handling requests that have an error status or no
> > > > data. In particular, this avoids showing unnecessary error
> > > > messages when the USB gadget gets disconnected (e.g. with
> > > > fastboot continue) and the fastboot USB gadget driver sends an
> > > > error back to the host (that has disconnected already).
> > > >
> > > > Signed-off-by: Paul Kocialkowski <contact at paulk.fr>
> > > > ---
> > > > drivers/usb/gadget/f_fastboot.c | 11 ++++++-----
> > > > 1 file changed, 6 insertions(+), 5 deletions(-)
> > > >
> > > > diff --git a/drivers/usb/gadget/f_fastboot.c
> > > > b/drivers/usb/gadget/f_fastboot.c index 206b6d1..b9a9099 100644
> > > > --- a/drivers/usb/gadget/f_fastboot.c
> > > > +++ b/drivers/usb/gadget/f_fastboot.c
> > > > @@ -635,6 +635,9 @@ static void rx_handler_command(struct usb_ep
> > > > *ep, struct usb_request *req) void (*func_cb)(struct usb_ep *ep,
> > > > struct usb_request *req) = NULL; int i;
> > > >
> > > > + if (req->status != 0 || req->length == 0)
> > > > + return;
> > > > +
> > > > for (i = 0; i < ARRAY_SIZE(cmd_dispatch_info); i++) {
> > > > if (!strcmp_l1(cmd_dispatch_info[i].cmd,
> > > > cmdbuf)) { func_cb = cmd_dispatch_info[i].cb;
> > > > @@ -656,9 +659,7 @@ static void rx_handler_command(struct usb_ep
> > > > *ep, struct usb_request *req) }
> > > > }
> > > >
> > > > - if (req->status == 0) {
> > > > - *cmdbuf = '\0';
> > > > - req->actual = 0;
> > > > - usb_ep_queue(ep, req, 0);
> > > > - }
> > > > + *cmdbuf = '\0';
> > > > + req->actual = 0;
> > > > + usb_ep_queue(ep, req, 0);
> > > > }
> > >
> > > Any more comments to those patches? I mean 1/2 and 2/2.
> >
> > I could test them on OMAP3 and OMAP5 if you'd like. Together with
> > sunxi (that I developped this on), I think a fair share of platforms
> > using musb-new would be covered. Testing on am33xx and omap4 would be
> > nice, too.
> >
>
> More testing is always welcome. Please write proper Tested-by with
> target SoC/board name as a reply to this e-mail.
In the end, the OMAP5 uses another OTG controller, so it doesn't apply.
However, I could test on the LG Optimus Black (P970), which is not yet
upstream (I'll submit patches soon).
Tested-By: Paul Kocialkowski <contact at paulk.fr> on the Cubieboard2
(sunxi) and the LG Optimus Black (P970) (omap3)
> Then I will pick those patches to -dfu tree.
Thanks, I'm looking forward to it, and to see it land it the main tree
as well, now that the merge window is open!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150715/8f437a22/attachment.sig>
More information about the U-Boot
mailing list