Hi Alan, Alan Stern wrote: > On Fri, 19 Nov 2010, Holger brunck wrote: > >> From: Stefan Bigler <stefan.bigler@xxxxxxxxxxx> >> >> Some usb serial host drivers expect a short packet before they forward >> the data to the application. This is caused by them trying to read more >> than one packet at a time. So when the gadget sends an exact multiple >> of the maximum packet size, it should append a zero-length packet. >> The gadget driver for fsl_qe was not handling this case correctly. >> This patch adds sending of a null packet if it is the last packet of >> a frame and the request length is USB_EP0_MAX_SIZE (64 Byte). >> >> See also commit 2e25134122c25ebb0679b4bbd536fb46c669f9d7 >> >> Signed-off-by: Stefan Bigler <stefan.bigler@xxxxxxxxxxx> >> Signed-off-by: Holger Brunck <holger.brunck@xxxxxxxxxxx> >> Cc: Li Yang <leoli@xxxxxxxxxxxxx> >> Cc: David Brownell <dbrownell@xxxxxxxxxxxxxxxxxxxxx> >> >> --- >> drivers/usb/gadget/fsl_qe_udc.c | 3 +++ >> 1 files changed, 3 insertions(+), 0 deletions(-) >> >> diff --git a/drivers/usb/gadget/fsl_qe_udc.c b/drivers/usb/gadget/fsl_qe_udc.c >> index 7881f12..279454a 100644 >> --- a/drivers/usb/gadget/fsl_qe_udc.c >> +++ b/drivers/usb/gadget/fsl_qe_udc.c >> @@ -1229,6 +1229,9 @@ static int frame_create_tx(struct qe_ep *ep, struct qe_frame *frame) >> else >> reval = sendnulldata(ep, frame, 0); >> >> + if (req->req.zero && (req->req.length == USB_EP0_MAX_SIZE)) >> + reval = sendnulldata(ep, frame, 0); >> + >> return reval; >> } > > The patch description doesn't seem to match what the new code does. > The new code doesn't check whether this is the last transfer in a > frame, and it only checks whether the request length is _equal_ to the > maxpacket size -- not whether it is a _multiple_ of the maxpacket size. > No. I double checked it. If I send 64, 128 or 192 bytes the added if branch is hit exactly one time. So it checks if it is the last transfer in a frame. Maybe the naming of the attribute req.zero is confusing, because it does indicate the last frame. Regards Holger -- 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