Re: Zero-Byte Packet Questions

David Brownell <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
On Wednesday 07 March 2007 8:45 am, Pandita, Vikram wrote:
> 
> Alan
>  If the peripheral driver is to decide to send a ZLP or not based on the
> length of data transfer, then the API given to Gadget driver of req.zero
> is redundant.
> 
> My understanding is that the Gadget driver should respect the API and
> set the req.zero responsibly and hence the following fix suggested in
> Gadget Zero. Else the zero flag can be removed?

For *control transfers only* the zero flag should not be needed.
Some gadget drivers set it, primarily for paranoia.

For bulk transfers, see responses from both Alan and myself.


> Signed-off-by: Vikram Pandita <[email protected]>

NAK.


> ---
> diff -purN a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c
> --- 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);
> 
> 
> 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
[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.