Hello. On 23-03-2012 15:48, Lukasz Majewski wrote:
When sent data lenght is a multiple size of maximum packet size (MPS = 64B for EP0), then sent a ZLP pbacket to indicate end of the transfer to a USB host.
The above condition only applies, when requested data from host is NOT equal to multiplied value of MPS (e.g. host requested 4096B from device).
I couldn't parse that. Of course 4096 is dividisble by 64. Adn you seem to be contradiction the first paragraph.
In this case no ZLP shall be sent.
Tested with: - DFU gadget (various size of the sent data - also packet = MPS) - Ethernet gadget (CDC and RNDIS) - Multi Function Gadget (g_multi)
HW: - Samsung's C210 Universal rev.0
Signed-off-by: Lukasz Majewski<l.majewski@xxxxxxxxxxx> Signed-off-by: Kyungmin Park<kyungmin.park@xxxxxxxxxxx> --- drivers/usb/gadget/s3c-hsotg.c | 34 ++++++++++++++++++++++++++++++++-- 1 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index 6ed259e..d67cb94 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c
[...]
@@ -1831,9 +1842,28 @@ static void s3c_hsotg_complete_in(struct s3c_hsotg *hsotg, __func__, hs_req->req.actual, size_done); hs_req->req.actual = size_done; + dev_dbg(hsotg->dev, "req->length:%d req->actual:%d req->zero:%d\n", + hs_req->req.length, hs_req->req.actual, hs_req->req.zero); + + /* + * Check if dealing with Maximum Packet Size(MPS) IN transfer at EP0 + * When sent data is a multiple MPS size (e.g. 64B ,128B ,192B + * ,256B ... ), after last MPS sized packet send IN ZLP packet to + * inform the host that no more data is available. + * The state of req.zero member is checked to be sure that the value to + * send is smaller than wValue expected from host. + * Check req.length to NOT send another ZLP when the current one is + * under completion (the one for which this completion has been called). + */ + if (hs_req->req.length && hs_ep->index == 0 && hs_req->req.zero + && hs_req->req.length == hs_req->req.actual + && !(hs_req->req.length % hs_ep->ep.maxpacket)) {
Ususally the operator is left on the prevsious line... WBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html