On Mon, 6 Jul 2015, Peter Chen wrote: > On Fri, Jul 03, 2015 at 10:03:22AM -0400, Alan Stern wrote: > > On Fri, 3 Jul 2015, Peter Chen wrote: > > > > > According to the USB 2.0 Spec CH5.5.3 and CH8.5.3.2, only control > > > read (IN) needs zero length packet. > > > > > > Cc: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> > > > Signed-off-by: Peter Chen <peter.chen@xxxxxxxxxxxxx> > > > --- > > > drivers/usb/gadget/composite.c | 6 ++++-- > > > 1 file changed, 4 insertions(+), 2 deletions(-) > > > > > > diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c > > > index 1c0c3da..c3898b5 100644 > > > --- a/drivers/usb/gadget/composite.c > > > +++ b/drivers/usb/gadget/composite.c > > > @@ -1744,7 +1744,8 @@ unknown: > > > } > > > req->length = value; > > > req->context = cdev; > > > - req->zero = value < w_length; > > > + if (ctrl->bRequestType == USB_DIR_IN) > > > + req->zero = value < w_length; > > > value = composite_ep0_queue(cdev, req, GFP_ATOMIC); > > > if (value < 0) { > > > DBG(cdev, "ep_queue --> %d\n", value); > > > @@ -1820,7 +1821,8 @@ try_fun_setup: > > > if (value >= 0 && value != USB_GADGET_DELAYED_STATUS) { > > > req->length = value; > > > req->context = cdev; > > > - req->zero = value < w_length; > > > + if (ctrl->bRequestType == USB_DIR_IN) > > > + req->zero = value < w_length; > > > value = composite_ep0_queue(cdev, req, GFP_ATOMIC); > > > if (value < 0) { > > > DBG(cdev, "ep_queue --> %d\n", value); > > > > This change is not needed. A UDC driver is always supposed to ignore > > req->zero for OUT transfers. (It also is supposed to ignore req->zero > > if req->length == 0 or req->length % maxpacket != 0.) > > > > This can avoid every UDC driver doing it, the UDC driver can consider > the zero flag is only set at OUT transfer. But this patch affects only control transfers, not bulk transfers. And it doesn't handle the cases where req->length == 0 or req->length % maxpacket != 0. Alan Stern -- 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