You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2023/03/24 17:54:38 UTC

[nuttx] 01/02: rndis: use composite_ep0submit to send the ep0 when composite

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

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

commit d014b9d38440f0a2a6fae0c941995774f9883899
Author: raiden00pl <ra...@railab.me>
AuthorDate: Thu Mar 23 11:45:44 2023 +0100

    rndis: use composite_ep0submit to send the ep0 when composite
---
 drivers/usbdev/rndis.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/usbdev/rndis.c b/drivers/usbdev/rndis.c
index 6bf11cf07b..58d61d2c7d 100644
--- a/drivers/usbdev/rndis.c
+++ b/drivers/usbdev/rndis.c
@@ -56,6 +56,10 @@
 
 #include "rndis_std.h"
 
+#ifdef CONFIG_USBMSC_COMPOSITE
+#  include <nuttx/usb/composite.h>
+#endif
+
 /****************************************************************************
  * Pre-processor definitions
  ****************************************************************************/
@@ -2569,9 +2573,21 @@ static int usbclass_setup(FAR struct usbdevclass_driver_s *driver,
 
   if (ret >= 0)
     {
+      /* Configure the response */
+
       ctrlreq->len   = MIN(len, ret);
       ctrlreq->flags = USBDEV_REQFLAGS_NULLPKT;
-      ret            = EP_SUBMIT(dev->ep0, ctrlreq);
+
+      /* Send the response -- either directly to the USB controller or
+       * indirectly in the case where this class is a member of a composite
+       * device.
+       */
+
+#ifndef CONFIG_RNDIS_COMPOSITE
+      ret = EP_SUBMIT(dev->ep0, ctrlreq);
+#else
+      ret = composite_ep0submit(driver, dev, ctrlreq);
+#endif
       if (ret < 0)
         {
           usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_EPRESPQ), (uint16_t)-ret);