Re: Gadget Zero patch for ZLP

Alan Stern <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
On Thu, 8 Feb 2007, Pandita, Vikram wrote:

> While sending the string descriptor, Gadget Zero does not send a ZLP in
> case the packet size is maxpacket size, resulting in a USBCV failure. 

Not correct.  Gadget Zero _does_ send a ZLP if the packet size is equal to
the maxpacket size, provided the host requested a longer response.  
Conversely, if the host asked for exactly maxpacket bytes and the gadget
sends back a response of that length, then there should not be a ZLP
added.

> The Ethernet Gadget has the following code which is missing from Gadget
> Zero. Should this be added to the Gadget Zero also?

It isn't needed in either driver, although it doesn't hurt.  The device
controller driver will always check for (value % gadget->ep0->maxpacket)
== 0 before sending the ZLP, so the gadget driver doesn't need to check.

> --- a/drivers/usb/gadget/zero.c	2007-02-02 18:33:34.000000000 +0530
> +++ b/drivers/usb/gadget/zero.c	2007-02-07 17:28:47.000000000 +0530
> @@ -1072,7 +1072,8 @@ unknown:
>  	/* respond with data transfer before status phase? */
>  	if (value >= 0) {
>  		req->length = value;
> -		req->zero = value < w_length;
> +		req->zero = value < w_length &&
> +				(value % gadget->ep0->maxpacket) == 0;
>  		value = usb_ep_queue (gadget->ep0, req, GFP_ATOMIC);
>  		if (value < 0) {
>  			DBG (dev, "ep_queue --> %d\n", value);

Alan Stern


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.