From: sangsu <sangsu@gmail.com>
To: dbrownell@users.sourceforge.net, gregkh@suse.de,
stern@rowland.harvard.edu, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] USB: g_file_storage: fix handling zero-length packet
Date: Sat, 06 Sep 2008 00:51:10 -0400 [thread overview]
Message-ID: <48C20C3E.20306@gmail.com> (raw)
According to "CH 5.5.3. Control Transfer Packet Size Constraints",
Zero-length packet should be sent when the last data payload size
is equal to the endpoint's MaxPacketSize. This patch helps
g_file_storage send zero-length packet properly.
This is tested in s3c2440/s5c7329 architectures and works well.
Signed-off-by: SangSu Park<sangsu@gmail.com>
---
driver/usb/gadget/file_storage.c | 3++-
1 files changed, 2 insertion(+), 1 deletions(-)
--- a/drivers/usb/gadget/file_storage.c 2008-09-01 11:13:03.000000000 -0400
+++ b/drivers/usb/gadget/file_storage.c 2008-09-01 11:16:41.000000000 -0400
@@ -1463,7 +1463,8 @@
if (rc >= 0 && rc != DELAYED_STATUS) {
rc = min(rc, w_length);
fsg->ep0req->length = rc;
- fsg->ep0req->zero = rc < w_length;
+ fsg->ep0req->zero = rc < w_length
+ && (rc % gadget->ep0->maxpacket) == 0;
fsg->ep0req_name = (ctrl->bRequestType & USB_DIR_IN ?
"ep0-in" : "ep0-out");
rc = ep0_queue(fsg);
next reply other threads:[~2008-09-06 4:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-06 4:51 sangsu [this message]
2008-09-06 20:27 ` [PATCH] USB: g_file_storage: fix handling zero-length packet Alan Stern
2008-09-07 4:32 ` David Brownell
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=48C20C3E.20306@gmail.com \
--to=sangsu@gmail.com \
--cc=dbrownell@users.sourceforge.net \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox