Re: [PATCH v2 05/11] usb:hsotg:samsung: Sending ZLP packet for IN EP0 transfers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Sergei,

On Mon, 05 Mar 2012 15:40:44 +0400
Sergei Shtylyov <sshtylyov@xxxxxxxxxx> wrote:

> Hello.
> 
> On 05-03-2012 15:11, Lukasz Majewski wrote:
> 
> > When sent data length is equal to maximum packet size (MPS
> > = 64B for EP0), then a ZLP packet shall be sent to indicate
> > end of the transfer to a USB host.
> 
> > 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 |   26 ++++++++++++++++++++++++--
> >   1 files changed, 24 insertions(+), 2 deletions(-)
> 
> > diff --git a/drivers/usb/gadget/s3c-hsotg.c
> > b/drivers/usb/gadget/s3c-hsotg.c index 0492c20..89e49ce 100644
> > --- a/drivers/usb/gadget/s3c-hsotg.c
> > +++ b/drivers/usb/gadget/s3c-hsotg.c
> [...]
> > @@ -1829,9 +1839,21 @@ 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\n",
> > +		hs_req->req.length, hs_req->req.actual);
> >
> > -	/* if we did all of the transfer, and there is more data
> > left
> > -	 * around, then try restarting the rest of the request */
> > +	/* Check if dealing with Maximum Packet Size(MPS) IN
> > transfer (EP0)
> > +	 * When req.lenght == ep.maxpacket then send IN ZLP packet
> > to
> > +	 * inform host that no more data is available.
> > +	 */
> > +	if (hs_req->req.length == hs_req->req.actual&&
> > hs_ep->index == 0
> > +	&&  hs_req->req.length == hs_ep->ep.maxpacket) {
> 
>     Not 'hs_req->req.length % hs_ep->ep.maxpacket == 0'?

For the above if statement:

hs_req->req.length == hs_ep->ep.maxpacket 
is equivalent to 
hs_req->req.length % hs_ep->ep.maxpacket == 0

I guess, that the condition:

hs_req->req.length % hs_ep->ep.maxpacket == 0 

You plan to use in a situation when data for sending would be 128 B,
192 B, 256 B... etc (like in the DFU USB gadget).

But for this values data is sent in packets, which length equals
to MPS (the s3c_hsotg_start_req in the if below) and only when last
packet with size of MPS is completed (i.e. hs_req->req.length ==
hs_req->req.actual), the ZLP will be send.



> 
> WBR, Sergei

Thank you for feedback.

-- 
Best regards,

Lukasz Majewski

Samsung Poland R&D Center
Platform Group
--
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


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux