You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "zyfeier (via GitHub)" <gi...@apache.org> on 2023/08/04 02:16:48 UTC

[GitHub] [nuttx] zyfeier opened a new pull request, #10070: usb: fixed composite usbdev issue

zyfeier opened a new pull request, #10070:
URL: https://github.com/apache/nuttx/pull/10070

   ## Summary
   
   1. adb: When the adbd task is running, the usb uninstall process will panic in the adbd task, because the memory of the adb driver has been freed.
   2. cdcacm: Logic error handled in USB_REQ_SETINTERFACE.
   3. composite: fix enumeration error for 192 bytes desc.
   4. composite: The maximum number of composite devices supported is changed to 8.
   5. composite: In the device descriptor, 0xEF means use of IAD.
   
   ## Impact
   
   USB
   
   ## Testing
   
   sim:usbdev


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] pkarashchenko commented on a diff in pull request #10070: usb: fixed composite usbdev issue

Posted by "pkarashchenko (via GitHub)" <gi...@apache.org>.
pkarashchenko commented on code in PR #10070:
URL: https://github.com/apache/nuttx/pull/10070#discussion_r1284179936


##########
drivers/usbdev/rndis.c:
##########
@@ -2942,15 +2942,21 @@ static void usbclass_uninitialize(FAR struct usbdevclass_driver_s *classdev)
 {
   FAR struct rndis_driver_s *drvr = (FAR struct rndis_driver_s *)classdev;
   FAR struct rndis_alloc_s *alloc = (FAR struct rndis_alloc_s *)drvr->dev;
-
+  if (!alloc->dev.registered)
+    {
+#ifdef CONFIG_USBADB_COMPOSITE
+      kmm_free(alloc);
+#endif
+      return;
+    }
   if (drvr->dev->registered)
     {
       netdev_unregister(&drvr->dev->netdev);
       drvr->dev->registered = false;
-    }
-  else
-    {
+#ifndef CONFIG_RNDIS_COMPOSITE
       kmm_free(alloc);
+#endif
+      return;

Review Comment:
   `return;` is not needed here



##########
drivers/usbdev/rndis.c:
##########
@@ -2942,15 +2942,21 @@ static void usbclass_uninitialize(FAR struct usbdevclass_driver_s *classdev)
 {
   FAR struct rndis_driver_s *drvr = (FAR struct rndis_driver_s *)classdev;
   FAR struct rndis_alloc_s *alloc = (FAR struct rndis_alloc_s *)drvr->dev;
-
+  if (!alloc->dev.registered)
+    {
+#ifdef CONFIG_USBADB_COMPOSITE
+      kmm_free(alloc);
+#endif
+      return;
+    }
   if (drvr->dev->registered)

Review Comment:
   Can do `else if` and remove `return;`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] raiden00pl commented on a diff in pull request #10070: usb: fixed composite usbdev issue

Posted by "raiden00pl (via GitHub)" <gi...@apache.org>.
raiden00pl commented on code in PR #10070:
URL: https://github.com/apache/nuttx/pull/10070#discussion_r1284034253


##########
drivers/usbdev/composite.h:
##########
@@ -95,7 +95,7 @@
 #  define COMPOSITE_REMOTEWAKEUP      (0)
 #endif
 
-#define NUM_DEVICES_TO_HANDLE         (4)
+#define NUM_DEVICES_TO_HANDLE         (8)

Review Comment:
   shouldn't we make `NUM_DEVICES_TO_HANDLE` configurable with Kconfig ?
   then we can reuse this value in the board initialization logic, like here https://github.com/apache/nuttx/blob/856526adee25cdb9987ff800767a71ec9059d1ea/boards/arm/stm32h7/nucleo-h743zi/src/stm32_composite.c#L178 which is now not possible as `NUM_DEVICES_TO_HANDLE` is not available outside `drivers/usbdev` 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] zyfeier commented on a diff in pull request #10070: usb: fixed composite usbdev issue

Posted by "zyfeier (via GitHub)" <gi...@apache.org>.
zyfeier commented on code in PR #10070:
URL: https://github.com/apache/nuttx/pull/10070#discussion_r1284157887


##########
drivers/usbdev/composite.h:
##########
@@ -95,7 +95,7 @@
 #  define COMPOSITE_REMOTEWAKEUP      (0)
 #endif
 
-#define NUM_DEVICES_TO_HANDLE         (4)
+#define NUM_DEVICES_TO_HANDLE         (8)

Review Comment:
   Hi, raiden00pl, this is a good idea, i will submit a new PR for this change.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] pkarashchenko commented on a diff in pull request #10070: usb: fixed composite usbdev issue

Posted by "pkarashchenko (via GitHub)" <gi...@apache.org>.
pkarashchenko commented on code in PR #10070:
URL: https://github.com/apache/nuttx/pull/10070#discussion_r1284177901


##########
drivers/usbdev/adb.c:
##########
@@ -1625,10 +1628,28 @@ static void usbclass_uninitialize(FAR struct usbdevclass_driver_s *classdev)
     classdev, FAR struct adb_driver_s, drvr);
 
   #warning FIXME Maybe missing logic here
+  if (!alloc->dev.registered)
+    {
+      if (alloc->dev.crefs == 0)
+        {
+#ifdef CONFIG_USBADB_COMPOSITE
+          kmm_free(alloc);
+#endif
+        }
+
+      return;
+    }
 
   unregister_driver(USBADB_CHARDEV_PATH);
 
-  kmm_free(alloc);
+  if (alloc->dev.registered)

Review Comment:
   Could be simplified to use `esle` and remove `return;` statements



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] raiden00pl merged pull request #10070: usb: fixed composite usbdev issue

Posted by "raiden00pl (via GitHub)" <gi...@apache.org>.
raiden00pl merged PR #10070:
URL: https://github.com/apache/nuttx/pull/10070


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org