From: Paul Kocialkowski <contact@paulk.fr>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] usb: gadget: fastboot: Request status and length check in rx handler
Date: Mon, 06 Jul 2015 15:03:19 +0200 [thread overview]
Message-ID: <1436187799.2584.3.camel@collins> (raw)
In-Reply-To: <20150706122840.20ac66e2@amdc2363>
Le lundi 06 juillet 2015 ? 12:28 +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@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);
> > }
>
> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
>
> Let's wait for some more time before pulling this patch to u-boot-dfu
> tree. I hope that other fastboot users will also review this patch.
Oh and by the way, in the fastboot protocol description
(doc/README.android-fastboot-protocol), it clearly says:
"zero-length packets are ignored".
--
Paul Kocialkowski, Replicant developer
Replicant is a fully free Android distribution running on several
devices, a free software mobile operating system putting the emphasis on
freedom and privacy/security.
Website: http://www.replicant.us/
Blog: http://blog.replicant.us/
Wiki/tracker/forums: http://redmine.replicant.us/
-------------- 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/20150706/2f9b296d/attachment.sig>
next prev parent reply other threads:[~2015-07-06 13:03 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-04 14:46 [U-Boot] [PATCH 1/2] usb: gadget: fastboot: Request status and length check in rx handler Paul Kocialkowski
2015-07-04 14:46 ` [U-Boot] [PATCH 2/2] usb: gadget: fastboot: Dequeue the previous IN request for the current request Paul Kocialkowski
2015-07-06 10:35 ` Lukasz Majewski
2019-03-18 9:56 ` [U-Boot] Subject Eugeniu Rosca
2019-03-18 10:12 ` Paul Kocialkowski
2019-03-18 17:15 ` Eugeniu Rosca
2019-03-18 17:20 ` [U-Boot] [U-Boot, 2/2] usb: gadget: fastboot: Dequeue the previous IN request for the current request Eugeniu Rosca
2019-03-18 12:32 ` [U-Boot] Subject Marek Vasut
2015-07-06 10:28 ` [U-Boot] [PATCH 1/2] usb: gadget: fastboot: Request status and length check in rx handler Lukasz Majewski
2015-07-06 12:08 ` Paul Kocialkowski
2015-07-06 13:03 ` Paul Kocialkowski [this message]
2015-07-14 10:22 ` Lukasz Majewski
2015-07-14 10:27 ` Paul Kocialkowski
2015-07-14 11:32 ` Lukasz Majewski
2015-07-15 13:53 ` Paul Kocialkowski
2015-07-20 9:57 ` Lukasz Majewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1436187799.2584.3.camel@collins \
--to=contact@paulk.fr \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.