You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ar...@apache.org on 2023/08/07 03:23:45 UTC

[nuttx] 02/04: composite: return ok when host send a duplicate setconfig message

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

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

commit f52f04e131e7463704a2e008b8304b4ee9b3fd7e
Author: zhangyuan21 <zh...@xiaomi.com>
AuthorDate: Fri Aug 4 14:19:57 2023 +0800

    composite: return ok when host send a duplicate setconfig message
    
    Signed-off-by: zhangyuan21 <zh...@xiaomi.com>
---
 drivers/usbdev/composite.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/usbdev/composite.c b/drivers/usbdev/composite.c
index 2cc1ba3955..11a9c09795 100644
--- a/drivers/usbdev/composite.c
+++ b/drivers/usbdev/composite.c
@@ -579,10 +579,18 @@ static int composite_setup(FAR struct usbdevclass_driver_s *driver,
 
         case USB_REQ_SETCONFIGURATION:
           {
-            if (ctrl->type == 0 && value != priv->config)
+            if (ctrl->type == 0)
               {
                 int i;
 
+                if (priv->config == value)
+                  {
+                    /* Already configured -- Do nothing */
+
+                    ret = OK;
+                    break;
+                  }
+
                 /* Save the configuration and inform the constituent
                  * classes
                  */