You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ra...@apache.org on 2023/08/04 08:58:59 UTC

[nuttx] 03/05: usbdev-composite: fix enumeration error for 192 bytes desc

This is an automated email from the ASF dual-hosted git repository.

raiden00 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 324402ed3029a7b8b2a6d944699a9eaad58c6b1d
Author: sunkun3 <su...@xiaomi.com>
AuthorDate: Tue May 30 20:00:10 2023 +0800

    usbdev-composite: fix enumeration error for 192 bytes desc
    
    when the size of the usb configuration descriptor
    is a multiple of 64 integers, only for this size less than wlength,
    host do need send ZLP
    
    Signed-off-by: sunkun3 <su...@xiaomi.com>
---
 drivers/usbdev/composite.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/usbdev/composite.c b/drivers/usbdev/composite.c
index b3795b5c2b..463282b419 100644
--- a/drivers/usbdev/composite.c
+++ b/drivers/usbdev/composite.c
@@ -680,7 +680,12 @@ static int composite_setup(FAR struct usbdevclass_driver_s *driver,
       /* Setup the request */
 
       ctrlreq->len   = MIN(len, ret);
-      ctrlreq->flags = USBDEV_REQFLAGS_NULLPKT;
+
+      /* Only when ret is less than len do zero length packet
+       * need to be sent
+       */
+
+      ctrlreq->flags = ret < len ? USBDEV_REQFLAGS_NULLPKT : 0;
 
       /* And submit the request to the USB controller driver */