[PATCH] USB: Gadget, fsl_qe: Fixed send of zero byte packets

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

 



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.

See also commit 2e25134122c25ebb0679b4bbd536fb46c669f9d7

Signed-off-by: Stefan Bigler <stefan.bigler@xxxxxxxxxxx>
Signed-off-by: Holger Brunck <holger.brunck@xxxxxxxxxxx>
---
 drivers/usb/gadget/fsl_qe_udc.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/fsl_qe_udc.c b/drivers/usb/gadget/fsl_qe_udc.c
index 7881f12..94daecc 100644
--- a/drivers/usb/gadget/fsl_qe_udc.c
+++ b/drivers/usb/gadget/fsl_qe_udc.c
@@ -1224,9 +1224,10 @@ static int frame_create_tx(struct qe_ep *ep, struct qe_frame *frame)
        if (req == NULL)
                return -ENODEV;

-       if ((req->req.length - ep->sent) > 0)
+       if (req->req.length > 0)
                reval = qe_usb_senddata(ep, frame);
-       else
+
+       if (req->req.zero)
                reval = sendnulldata(ep, frame, 0);

        return reval;
-- 
1.7.0.5
--
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