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

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

commit e1ac2528509bc2abd035970d0d2a7a31676e7359
Author: Marco Casaroli <[email protected]>
AuthorDate: Mon Oct 19 00:19:20 2026 +0200

    drivers/usb: Fix the nxstyle errors in 7 files.
    
    Fix the older nxstyle errors in these files: indentation, alignment of
    braces and comments, and the blank line after declarations. This is a
    layout change only. The C tokens do not change. tools/nxstyle.c
    reports no error for them now.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 drivers/usbdev/usbdev_fs.c               |  41 ++-
 drivers/usbdev/uvc.c                     |  10 +-
 drivers/usbhost/usbhost_cdcmbim.c        | 362 +++++++++----------
 drivers/usbhost/usbhost_hidmouse.c       | 164 ++++-----
 drivers/usbhost/usbhost_xboxcontroller.c | 582 ++++++++++++++++---------------
 drivers/usbmisc/fusb301.c                |  83 ++---
 drivers/usbmisc/fusb303.c                |  83 ++---
 7 files changed, 671 insertions(+), 654 deletions(-)

diff --git a/drivers/usbdev/usbdev_fs.c b/drivers/usbdev/usbdev_fs.c
index 1bc886fd257..3a4a7d380ea 100644
--- a/drivers/usbdev/usbdev_fs.c
+++ b/drivers/usbdev/usbdev_fs.c
@@ -193,6 +193,7 @@ static void usbdev_fs_notify(FAR struct usbdev_fs_ep_s 
*fs_ep,
   /* Notify all of the waiting readers */
 
   FAR usbdev_fs_waiter_sem_t *cur_sem = fs_ep->sems;
+
   while (cur_sem != NULL)
     {
       nxsem_post(&cur_sem->sem);
@@ -279,37 +280,37 @@ static void usbdev_fs_rdcomplete(FAR struct usbdev_ep_s 
*ep,
     {
       case 0: /* Normal completion */
 
-      usbtrace(TRACE_CLASSRDCOMPLETE, sq_count(&fs_ep->reqq));
+        usbtrace(TRACE_CLASSRDCOMPLETE, sq_count(&fs_ep->reqq));
 
-      /* Restart request due to empty frame received */
+        /* Restart request due to empty frame received */
 
-      if (req->xfrd <= 0)
-        {
-          goto restart_req;
-        }
+        if (req->xfrd <= 0)
+          {
+            goto restart_req;
+          }
 
-      /* Queue request and notify readers */
+        /* Queue request and notify readers */
 
-      flags = spin_lock_irqsave_nopreempt(&fs_ep->spinlock);
+        flags = spin_lock_irqsave_nopreempt(&fs_ep->spinlock);
 
-      /* Put request on RX pending queue */
+        /* Put request on RX pending queue */
 
-      container->offset = 0;
-      sq_addlast(&container->node, &fs_ep->reqq);
+        container->offset = 0;
+        sq_addlast(&container->node, &fs_ep->reqq);
 
-      usbdev_fs_notify(fs_ep, POLLIN);
+        usbdev_fs_notify(fs_ep, POLLIN);
 
-      spin_unlock_irqrestore_nopreempt(&fs_ep->spinlock, flags);
-      return;
+        spin_unlock_irqrestore_nopreempt(&fs_ep->spinlock, flags);
+        return;
 
       case -ESHUTDOWN: /* Disconnection */
-      usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_RDSHUTDOWN), 0);
-      return;
+        usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_RDSHUTDOWN), 0);
+        return;
 
       default: /* Some other error occurred */
-      usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_RDUNEXPECTED),
-               (uint16_t)-req->result);
-      break;
+        usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_RDUNEXPECTED),
+                 (uint16_t)-req->result);
+        break;
     };
 
 restart_req:
@@ -1145,6 +1146,7 @@ static void usbdev_fs_ep_unbind(FAR const char *devname,
         {
           FAR struct usbdev_fs_req_s *container =
             &fs_ep->reqbuffer[i];
+
           if (container->req)
             {
               usbdev_freereq(fs_ep->ep, container->req);
@@ -1311,6 +1313,7 @@ static int usbdev_fs_classsetconfig(FAR struct 
usbdev_fs_dev_s *fs,
           for (j = 0; j < devinfo->epinfos[i]->reqnum; j++)
             {
               FAR struct usbdev_fs_req_s *container;
+
               container = &fs_ep->reqbuffer[j];
               container->req->callback = usbdev_fs_rdcomplete;
               usbdev_fs_submit_rdreq(fs_ep->ep, container);
diff --git a/drivers/usbdev/uvc.c b/drivers/usbdev/uvc.c
index 4f5154a545f..d34bbcba582 100644
--- a/drivers/usbdev/uvc.c
+++ b/drivers/usbdev/uvc.c
@@ -836,12 +836,12 @@ static int uvc_class_setup(FAR struct uvc_dev_s *priv,
 
       switch (req)
         {
-          case UVC_SET_CUR:
-            /* Host sends probe/commit data — we accept it.
-             * The data arrives in dataout phase, handled below.
-             * For now just return 0 to ACK the setup.
-             */
+          /* Host sends probe/commit data — we accept it.
+           * The data arrives in dataout phase, handled below.
+           * For now just return 0 to ACK the setup.
+           */
 
+          case UVC_SET_CUR:
             if (len >= UVC_PROBE_COMMIT_SIZE)
               {
                 len = UVC_PROBE_COMMIT_SIZE;
diff --git a/drivers/usbhost/usbhost_cdcmbim.c 
b/drivers/usbhost/usbhost_cdcmbim.c
index a8a54b88a33..499915905d3 100644
--- a/drivers/usbhost/usbhost_cdcmbim.c
+++ b/drivers/usbhost/usbhost_cdcmbim.c
@@ -599,6 +599,7 @@ static int cdcwdm_poll(FAR struct file *filep, FAR struct 
pollfd *fds,
       /* This is a request to tear down the poll. */
 
       FAR struct pollfd **slot = (FAR struct pollfd **)fds->priv;
+
       DEBUGASSERT(slot);
 
       /* Remove all memory of the poll setup */
@@ -684,6 +685,7 @@ static int usbhost_allocdevno(FAR struct usbhost_cdcmbim_s 
*priv)
   for (devno = 0; devno < 32; devno++)
     {
       uint32_t bitno = 1 << devno;
+
       if ((g_devinuse & bitno) == 0)
         {
           g_devinuse |= bitno;
@@ -704,6 +706,7 @@ static void usbhost_freedevno(FAR struct usbhost_cdcmbim_s 
*priv)
   if (devno >= 0 && devno < 26)
     {
       irqstate_t flags = spin_lock_irqsave(&g_lock);
+
       g_devinuse &= ~(1 << devno);
       spin_unlock_irqrestore(&g_lock, flags);
     }
@@ -826,10 +829,10 @@ static void usbhost_bulkin_work(FAR void *arg)
   while (ndpoffset);
 
 out:
-    DRVR_ASYNCH(hport->drvr, priv->bulkin,
-                (FAR uint8_t *)priv->rxnetbuf, CDCMBIM_NETBUF_SIZE,
-                usbhost_bulkin_callback, priv);
-    nxmutex_unlock(&priv->lock);
+  DRVR_ASYNCH(hport->drvr, priv->bulkin,
+              (FAR uint8_t *)priv->rxnetbuf, CDCMBIM_NETBUF_SIZE,
+              usbhost_bulkin_callback, priv);
+  nxmutex_unlock(&priv->lock);
 }
 
 /****************************************************************************
@@ -1214,172 +1217,173 @@ static int usbhost_cfgdesc(FAR struct 
usbhost_cdcmbim_s *priv,
       desc = (FAR struct usb_desc_s *)configdesc;
       switch (desc->type)
         {
-        case USB_DESC_TYPE_CSINTERFACE:
-          {
-            FAR struct usb_csifdesc_s *csdesc =
-                (FAR struct usb_csifdesc_s *)desc;
+          case USB_DESC_TYPE_CSINTERFACE:
+            {
+              FAR struct usb_csifdesc_s *csdesc =
+                  (FAR struct usb_csifdesc_s *)desc;
 
-            /* MBIM functional descriptor */
+              /* MBIM functional descriptor */
 
-            if (csdesc->subtype == CDC_DSUBTYPE_MBIM)
-              {
-                FAR struct usb_mbim_desc_s *mbim =
-                    (FAR struct usb_mbim_desc_s *)desc;
+              if (csdesc->subtype == CDC_DSUBTYPE_MBIM)
+                {
+                  FAR struct usb_mbim_desc_s *mbim =
+                      (FAR struct usb_mbim_desc_s *)desc;
+
+                  priv->maxctrlsize =
+                    usbhost_getle16(mbim->max_ctrl_message);
+                  uinfo("MBIM max control size: %u\n", priv->maxctrlsize);
+                  uinfo("MBIM max segment size: %u\n",
+                        usbhost_getle16(mbim->max_segment_size));
+                }
+            }
+            break;
 
-                priv->maxctrlsize = usbhost_getle16(mbim->max_ctrl_message);
-                uinfo("MBIM max control size: %u\n", priv->maxctrlsize);
-                uinfo("MBIM max segment size: %u\n",
-                      usbhost_getle16(mbim->max_segment_size));
-              }
-          }
-          break;
+          /* Interface descriptor. We really should get the number of
+           * endpoints from this descriptor too.
+           */
 
-        /* Interface descriptor. We really should get the number of endpoints
-         * from this descriptor too.
-         */
+          case USB_DESC_TYPE_INTERFACE:
+            {
+              FAR struct usb_ifdesc_s *ifdesc =
+                  (FAR struct usb_ifdesc_s *)configdesc;
 
-        case USB_DESC_TYPE_INTERFACE:
-          {
-            FAR struct usb_ifdesc_s *ifdesc =
-                (FAR struct usb_ifdesc_s *)configdesc;
-
-            uinfo("Interface descriptor\n");
-            DEBUGASSERT(remaining >= USB_SIZEOF_IFDESC);
-
-            /* Is this the control interface? */
-
-            if (ifdesc->classid  == CDC_CLASS_COMM &&
-                ifdesc->subclass == CDC_SUBCLASS_MBIM &&
-                ifdesc->protocol == CDC_PROTO_NONE)
-              {
-                priv->ctrlif  = ifdesc->ifno;
-                found        |= USBHOST_CTRLIFFOUND;
-              }
-
-            /* Is this the data interface? */
-
-            else if (ifdesc->classid  == USB_CLASS_CDC_DATA &&
-                     ifdesc->subclass == CDC_SUBCLASS_NONE &&
-                     ifdesc->protocol == CDC_DATA_PROTO_MBIMNTB)
-              {
-                priv->dataif  = ifdesc->ifno;
-                found        |= USBHOST_DATAIFFOUND;
-              }
-          }
-          break;
+              uinfo("Interface descriptor\n");
+              DEBUGASSERT(remaining >= USB_SIZEOF_IFDESC);
 
-        /* Endpoint descriptor.  Here, we expect two bulk endpoints, an IN
-         * and an OUT.
-         */
+              /* Is this the control interface? */
 
-        case USB_DESC_TYPE_ENDPOINT:
-          {
-            FAR struct usb_epdesc_s *epdesc =
-                (FAR struct usb_epdesc_s *)configdesc;
-
-            uinfo("Endpoint descriptor\n");
-            DEBUGASSERT(remaining >= USB_SIZEOF_EPDESC);
-
-            /* Check for interrupt endpoint */
-
-            if ((epdesc->attr & USB_EP_ATTR_XFERTYPE_MASK) ==
-                USB_EP_ATTR_XFER_INT)
-              {
-                if (USB_ISEPIN(epdesc->addr))
-                  {
-                    found |= USBHOST_INTRIFFOUND;
-                    iindesc.hport        = hport;
-                    iindesc.addr         = epdesc->addr &
-                                           USB_EP_ADDR_NUMBER_MASK;
-                    iindesc.in           = true;
-                    iindesc.xfrtype      = USB_EP_ATTR_XFER_INT;
-                    iindesc.interval     = epdesc->interval;
-                    iindesc.mxpacketsize =
-                                usbhost_getle16(epdesc->mxpacketsize);
-                    uinfo("Interrupt IN EP addr:%d mxpacketsize:%d\n",
-                          iindesc.addr, iindesc.mxpacketsize);
-
-                    priv->maxintsize = iindesc.mxpacketsize;
-                  }
-              }
-
-            /* Check for a bulk endpoint. */
-
-            else if ((epdesc->attr & USB_EP_ATTR_XFERTYPE_MASK) ==
-                     USB_EP_ATTR_XFER_BULK)
-              {
-                /* Yes.. it is a bulk endpoint.  IN or OUT? */
-
-                if (USB_ISEPOUT(epdesc->addr))
-                  {
-                    /* It is an OUT bulk endpoint.  There should be only one
-                     * bulk OUT endpoint.
-                     */
-
-                    if ((found & USBHOST_BOUTFOUND) != 0)
-                      {
-                        /* Oops.. more than one endpoint.  We don't know
-                         * what to do with this.
-                         */
-
-                        return -EINVAL;
-                      }
-
-                    found |= USBHOST_BOUTFOUND;
-
-                    /* Save the bulk OUT endpoint information */
-
-                    boutdesc.hport        = hport;
-                    boutdesc.addr         = epdesc->addr &
-                                            USB_EP_ADDR_NUMBER_MASK;
-                    boutdesc.in           = false;
-                    boutdesc.xfrtype      = USB_EP_ATTR_XFER_BULK;
-                    boutdesc.interval     = epdesc->interval;
-                    boutdesc.mxpacketsize =
-                                usbhost_getle16(epdesc->mxpacketsize);
-                    uinfo("Bulk OUT EP addr:%d mxpacketsize:%d\n",
-                          boutdesc.addr, boutdesc.mxpacketsize);
-
-                    priv->bulkmxpacket = boutdesc.mxpacketsize;
-                  }
-                else
-                  {
-                    /* It is an IN bulk endpoint.  There should be only one
-                     * bulk IN endpoint.
-                     */
-
-                    if ((found & USBHOST_BINFOUND) != 0)
-                      {
-                        /* Oops.. more than one endpoint.  We don't know
-                         * what to do with this.
-                         */
-
-                        return -EINVAL;
-                      }
-
-                    found |= USBHOST_BINFOUND;
-
-                    /* Save the bulk IN endpoint information */
-
-                    bindesc.hport        = hport;
-                    bindesc.addr         = epdesc->addr &
-                                           USB_EP_ADDR_NUMBER_MASK;
-                    bindesc.in           = 1;
-                    bindesc.xfrtype      = USB_EP_ATTR_XFER_BULK;
-                    bindesc.interval     = epdesc->interval;
-                    bindesc.mxpacketsize =
-                                usbhost_getle16(epdesc->mxpacketsize);
-                    uinfo("Bulk IN EP addr:%d mxpacketsize:%d\n",
-                          bindesc.addr, bindesc.mxpacketsize);
-                  }
-              }
-          }
-          break;
+              if (ifdesc->classid  == CDC_CLASS_COMM &&
+                  ifdesc->subclass == CDC_SUBCLASS_MBIM &&
+                  ifdesc->protocol == CDC_PROTO_NONE)
+                {
+                  priv->ctrlif  = ifdesc->ifno;
+                  found        |= USBHOST_CTRLIFFOUND;
+                }
 
-        /* Other descriptors are just ignored for now */
+              /* Is this the data interface? */
 
-        default:
-          break;
+              else if (ifdesc->classid  == USB_CLASS_CDC_DATA &&
+                       ifdesc->subclass == CDC_SUBCLASS_NONE &&
+                       ifdesc->protocol == CDC_DATA_PROTO_MBIMNTB)
+                {
+                  priv->dataif  = ifdesc->ifno;
+                  found        |= USBHOST_DATAIFFOUND;
+                }
+            }
+            break;
+
+          /* Endpoint descriptor.  Here, we expect two bulk endpoints, an IN
+           * and an OUT.
+           */
+
+          case USB_DESC_TYPE_ENDPOINT:
+            {
+              FAR struct usb_epdesc_s *epdesc =
+                  (FAR struct usb_epdesc_s *)configdesc;
+
+              uinfo("Endpoint descriptor\n");
+              DEBUGASSERT(remaining >= USB_SIZEOF_EPDESC);
+
+              /* Check for interrupt endpoint */
+
+              if ((epdesc->attr & USB_EP_ATTR_XFERTYPE_MASK) ==
+                  USB_EP_ATTR_XFER_INT)
+                {
+                  if (USB_ISEPIN(epdesc->addr))
+                    {
+                      found |= USBHOST_INTRIFFOUND;
+                      iindesc.hport        = hport;
+                      iindesc.addr         = epdesc->addr &
+                                             USB_EP_ADDR_NUMBER_MASK;
+                      iindesc.in           = true;
+                      iindesc.xfrtype      = USB_EP_ATTR_XFER_INT;
+                      iindesc.interval     = epdesc->interval;
+                      iindesc.mxpacketsize =
+                                  usbhost_getle16(epdesc->mxpacketsize);
+                      uinfo("Interrupt IN EP addr:%d mxpacketsize:%d\n",
+                            iindesc.addr, iindesc.mxpacketsize);
+
+                      priv->maxintsize = iindesc.mxpacketsize;
+                    }
+                }
+
+              /* Check for a bulk endpoint. */
+
+              else if ((epdesc->attr & USB_EP_ATTR_XFERTYPE_MASK) ==
+                       USB_EP_ATTR_XFER_BULK)
+                {
+                  /* Yes.. it is a bulk endpoint.  IN or OUT? */
+
+                  if (USB_ISEPOUT(epdesc->addr))
+                    {
+                      /* It is an OUT bulk endpoint.  There should be only
+                       * one bulk OUT endpoint.
+                       */
+
+                      if ((found & USBHOST_BOUTFOUND) != 0)
+                        {
+                          /* Oops.. more than one endpoint.  We don't know
+                           * what to do with this.
+                           */
+
+                          return -EINVAL;
+                        }
+
+                      found |= USBHOST_BOUTFOUND;
+
+                      /* Save the bulk OUT endpoint information */
+
+                      boutdesc.hport        = hport;
+                      boutdesc.addr         = epdesc->addr &
+                                              USB_EP_ADDR_NUMBER_MASK;
+                      boutdesc.in           = false;
+                      boutdesc.xfrtype      = USB_EP_ATTR_XFER_BULK;
+                      boutdesc.interval     = epdesc->interval;
+                      boutdesc.mxpacketsize =
+                                  usbhost_getle16(epdesc->mxpacketsize);
+                      uinfo("Bulk OUT EP addr:%d mxpacketsize:%d\n",
+                            boutdesc.addr, boutdesc.mxpacketsize);
+
+                      priv->bulkmxpacket = boutdesc.mxpacketsize;
+                    }
+                  else
+                    {
+                      /* It is an IN bulk endpoint.  There should be only one
+                       * bulk IN endpoint.
+                       */
+
+                      if ((found & USBHOST_BINFOUND) != 0)
+                        {
+                          /* Oops.. more than one endpoint.  We don't know
+                           * what to do with this.
+                           */
+
+                          return -EINVAL;
+                        }
+
+                      found |= USBHOST_BINFOUND;
+
+                      /* Save the bulk IN endpoint information */
+
+                      bindesc.hport        = hport;
+                      bindesc.addr         = epdesc->addr &
+                                             USB_EP_ADDR_NUMBER_MASK;
+                      bindesc.in           = 1;
+                      bindesc.xfrtype      = USB_EP_ATTR_XFER_BULK;
+                      bindesc.interval     = epdesc->interval;
+                      bindesc.mxpacketsize =
+                                  usbhost_getle16(epdesc->mxpacketsize);
+                      uinfo("Bulk IN EP addr:%d mxpacketsize:%d\n",
+                            bindesc.addr, bindesc.mxpacketsize);
+                    }
+                }
+            }
+            break;
+
+          /* Other descriptors are just ignored for now */
+
+          default:
+            break;
         }
 
       /* If we found everything we need with this interface, then break out
@@ -2224,29 +2228,29 @@ static void cdcmbim_receive(FAR struct 
usbhost_cdcmbim_s *priv,
   switch (((FAR struct ipv4_hdr_s *)buf)->vhl & IP_VERSION_MASK)
     {
 #ifdef CONFIG_NET_IPv4
-    case IPv4_VERSION:
-      NETDEV_RXIPV4(&priv->netdev);
-      ipv4_input(&priv->netdev);
+      case IPv4_VERSION:
+        NETDEV_RXIPV4(&priv->netdev);
+        ipv4_input(&priv->netdev);
 
-      if (priv->netdev.d_len > 0)
-        {
-          cdcmbim_transmit(priv);
-        }
-      break;
+        if (priv->netdev.d_len > 0)
+          {
+            cdcmbim_transmit(priv);
+          }
+        break;
 #endif
 #ifdef CONFIG_NET_IPv6
-    case IPv6_VERSION:
-      NETDEV_RXIPV6(&priv->netdev);
-      ipv6_input(&priv->netdev);
+      case IPv6_VERSION:
+        NETDEV_RXIPV6(&priv->netdev);
+        ipv6_input(&priv->netdev);
 
-      if (priv->dev.d_len > 0)
-        {
-          cdcmbim_transmit(priv);
-        }
-      break;
+        if (priv->dev.d_len > 0)
+          {
+            cdcmbim_transmit(priv);
+          }
+        break;
 #endif
-    default:
-      NETDEV_RXERRORS(dev);
+      default:
+        NETDEV_RXERRORS(dev);
     }
 
   netdev_unlock(&priv->netdev);
diff --git a/drivers/usbhost/usbhost_hidmouse.c 
b/drivers/usbhost/usbhost_hidmouse.c
index 6849efdef7b..623cf23989a 100644
--- a/drivers/usbhost/usbhost_hidmouse.c
+++ b/drivers/usbhost/usbhost_hidmouse.c
@@ -486,6 +486,7 @@ static int usbhost_allocdevno(FAR struct usbhost_state_s 
*priv)
   for (devno = 0; devno < 26; devno++)
     {
       uint32_t bitno = 1 << devno;
+
       if ((g_devinuse & bitno) == 0)
         {
           g_devinuse |= bitno;
@@ -506,6 +507,7 @@ static void usbhost_freedevno(FAR struct usbhost_state_s 
*priv)
   if (devno >= 0 && devno < 26)
     {
       irqstate_t flags = enter_critical_section();
+
       g_devinuse &= ~(1 << devno);
       leave_critical_section(flags);
     }
@@ -1396,103 +1398,103 @@ static inline int usbhost_cfgdesc(FAR struct 
usbhost_state_s *priv,
       desc = (FAR struct usb_desc_s *)configdesc;
       switch (desc->type)
         {
-        /* Interface descriptor. We really should get the number of endpoints
-         * from this descriptor too.
-         */
-
-        case USB_DESC_TYPE_INTERFACE:
-          {
-            uinfo("Interface descriptor\n");
-            DEBUGASSERT(remaining >= USB_SIZEOF_IFDESC);
-
-            /* Did we already find what we needed from
-             * a preceding interface?
-             */
-
-            if ((found & USBHOST_ALLFOUND) == USBHOST_ALLFOUND)
-              {
-                /* Yes.. then break out of the loop and use the preceding
-                 * interface.
-                 */
-
-                done = true;
-              }
-            else
-              {
-                /* Otherwise, discard any endpoints previously found */
-
-                found = USBHOST_IFFOUND;
-              }
-          }
-          break;
-
-        /* HID descriptor */
-
-        case USBHID_DESCTYPE_HID:
+          /* Interface descriptor. We really should get the number of
+           * endpoints from this descriptor too.
+           */
+
+          case USB_DESC_TYPE_INTERFACE:
+            {
+              uinfo("Interface descriptor\n");
+              DEBUGASSERT(remaining >= USB_SIZEOF_IFDESC);
+
+              /* Did we already find what we needed from
+               * a preceding interface?
+               */
+
+              if ((found & USBHOST_ALLFOUND) == USBHOST_ALLFOUND)
+                {
+                  /* Yes.. then break out of the loop and use the preceding
+                   * interface.
+                   */
+
+                  done = true;
+                }
+              else
+                {
+                  /* Otherwise, discard any endpoints previously found */
+
+                  found = USBHOST_IFFOUND;
+                }
+            }
+            break;
+
+          /* HID descriptor */
+
+          case USBHID_DESCTYPE_HID:
             uinfo("HID descriptor\n");
             break;
 
-        /* Endpoint descriptor.  We expect one or two interrupt endpoints,
-         * a required IN endpoint and an optional OUT endpoint.
-         */
+          /* Endpoint descriptor.  We expect one or two interrupt endpoints,
+           * a required IN endpoint and an optional OUT endpoint.
+           */
 
-        case USB_DESC_TYPE_ENDPOINT:
-          {
-            FAR struct usb_epdesc_s *epdesc =
-              (FAR struct usb_epdesc_s *)configdesc;
+          case USB_DESC_TYPE_ENDPOINT:
+            {
+              FAR struct usb_epdesc_s *epdesc =
+                (FAR struct usb_epdesc_s *)configdesc;
 
-            uinfo("Endpoint descriptor\n");
-            DEBUGASSERT(remaining >= USB_SIZEOF_EPDESC);
+              uinfo("Endpoint descriptor\n");
+              DEBUGASSERT(remaining >= USB_SIZEOF_EPDESC);
 
-            /* Check for an interrupt endpoint. */
+              /* Check for an interrupt endpoint. */
 
-            if ((epdesc->attr & USB_EP_ATTR_XFERTYPE_MASK) ==
-                USB_EP_ATTR_XFER_INT)
-              {
-                /* Yes.. it is a interrupt endpoint.  IN or OUT? */
+              if ((epdesc->attr & USB_EP_ATTR_XFERTYPE_MASK) ==
+                  USB_EP_ATTR_XFER_INT)
+                {
+                  /* Yes.. it is a interrupt endpoint.  IN or OUT? */
 
-                if (USB_ISEPIN(epdesc->addr))
-                  {
-                    /* It is an interrupt IN endpoint.  There should be only
-                     * one interrupt IN endpoint.
-                     */
+                  if (USB_ISEPIN(epdesc->addr))
+                    {
+                      /* It is an interrupt IN endpoint.  There should be
+                       * only one interrupt IN endpoint.
+                       */
 
-                    if ((found & USBHOST_EPINFOUND) != 0)
-                      {
-                        /* Oops.. more than one endpoint.  We don't know what
-                         * to do with this.
-                         */
+                      if ((found & USBHOST_EPINFOUND) != 0)
+                        {
+                          /* Oops.. more than one endpoint.  We don't know
+                           * what to do with this.
+                           */
 
-                        return -EINVAL;
-                      }
+                          return -EINVAL;
+                        }
 
-                    found |= USBHOST_EPINFOUND;
+                      found |= USBHOST_EPINFOUND;
 
-                    /* Save the interrupt IN endpoint information */
+                      /* Save the interrupt IN endpoint information */
 
-                    epindesc.hport        = hport;
-                    epindesc.addr         = epdesc->addr &
-                                            USB_EP_ADDR_NUMBER_MASK;
-                    epindesc.in           = true;
-                    epindesc.xfrtype      = USB_EP_ATTR_XFER_INT;
-                    epindesc.interval     = epdesc->interval;
-                    epindesc.mxpacketsize =
-                      usbhost_getle16(epdesc->mxpacketsize);
+                      epindesc.hport        = hport;
+                      epindesc.addr         = epdesc->addr &
+                                              USB_EP_ADDR_NUMBER_MASK;
+                      epindesc.in           = true;
+                      epindesc.xfrtype      = USB_EP_ATTR_XFER_INT;
+                      epindesc.interval     = epdesc->interval;
+                      epindesc.mxpacketsize =
+                        usbhost_getle16(epdesc->mxpacketsize);
 
-                    priv->packet_len = (size_t)epindesc.mxpacketsize;
+                      priv->packet_len = (size_t)epindesc.mxpacketsize;
 
-                    uinfo("Interrupt IN EP addr:%d mxpacketsize:%d\n",
-                          epindesc.addr, epindesc.mxpacketsize);
-                  }
-              }
-          }
-          break;
+                      uinfo("Interrupt IN EP addr:%d mxpacketsize:%d\n",
+                            epindesc.addr, epindesc.mxpacketsize);
+                    }
+                }
+            }
+            break;
 
-        /* Other descriptors are just ignored for now */
+          /* Other descriptors are just ignored for now */
 
-        default:
-          uinfo("Other descriptor: %d\n", desc->type);
-          break;
+          default:
+            uinfo("Other descriptor: %d\n", desc->type);
+            break;
         }
 
       /* What we found everything that we are going to find? */
@@ -1711,6 +1713,7 @@ static inline int usbhost_tdfree(FAR struct 
usbhost_state_s *priv)
 {
   FAR struct usbhost_hubport_s *hport;
   int result = OK;
+
   DEBUGASSERT(priv);
 
   if (priv->tbuffer)
@@ -2390,6 +2393,7 @@ static int usbhost_poll(FAR struct file *filep, FAR 
struct pollfd *fds,
       /* This is a request to tear down the poll. */
 
       FAR struct pollfd **slot = (FAR struct pollfd **)fds->priv;
+
       DEBUGASSERT(slot);
 
       /* Remove all memory of the poll setup */
diff --git a/drivers/usbhost/usbhost_xboxcontroller.c 
b/drivers/usbhost/usbhost_xboxcontroller.c
index 81f3dc7f9ce..e142ad2181b 100644
--- a/drivers/usbhost/usbhost_xboxcontroller.c
+++ b/drivers/usbhost/usbhost_xboxcontroller.c
@@ -392,6 +392,7 @@ static int usbhost_allocdevno(FAR struct usbhost_state_s 
*priv)
   for (devno = 0; devno < 26; devno++)
     {
       uint32_t bitno = 1 << devno;
+
       if ((g_devinuse & bitno) == 0)
         {
           g_devinuse |= bitno;
@@ -412,6 +413,7 @@ static void usbhost_freedevno(FAR struct usbhost_state_s 
*priv)
   if (devno >= 0 && devno < 26)
     {
       irqstate_t flags = enter_critical_section();
+
       g_devinuse &= ~(1 << devno);
       leave_critical_section(flags);
     }
@@ -623,206 +625,207 @@ static int usbhost_xboxcontroller_poll(int argc, FAR 
char *argv[])
 
           switch (priv->tbuffer[0])
             {
-            case USBHOST_WAITING_CONNECTION:
-              /* Send the initialization message when we received the
-               * the first waiting connection message.
-               */
+              case USBHOST_WAITING_CONNECTION:
+                /* Send the initialization message when we received the
+                 * the first waiting connection message.
+                 */
 
-              if (!priv->initialized)
-                {
-                  /* Get exclusive access to the controller state data */
+                if (!priv->initialized)
+                  {
+                    /* Get exclusive access to the controller state data */
 
-                  ret = nxmutex_lock(&priv->lock);
-                  if (ret < 0)
-                    {
-                      goto exitloop;
-                    }
+                    ret = nxmutex_lock(&priv->lock);
+                    if (ret < 0)
+                      {
+                        goto exitloop;
+                      }
 
-                  priv->tbuffer[0] = 0x05;
-                  priv->tbuffer[1] = 0x20;
-                  priv->tbuffer[2] = priv->out_seq_num++;
-                  priv->tbuffer[3] = 0x01;
-                  priv->tbuffer[4] = 0x00;
-                  nbytes = DRVR_TRANSFER(hport->drvr, priv->epout,
-                                         priv->tbuffer, 5);
-                  priv->initialized = true;
+                    priv->tbuffer[0] = 0x05;
+                    priv->tbuffer[1] = 0x20;
+                    priv->tbuffer[2] = priv->out_seq_num++;
+                    priv->tbuffer[3] = 0x01;
+                    priv->tbuffer[4] = 0x00;
+                    nbytes = DRVR_TRANSFER(hport->drvr, priv->epout,
+                                           priv->tbuffer, 5);
+                    priv->initialized = true;
 
-                  /* Release our lock on the state structure */
+                    /* Release our lock on the state structure */
 
-                  nxmutex_unlock(&priv->lock);
-                }
+                    nxmutex_unlock(&priv->lock);
+                  }
 
-              break;
+                break;
 
-            case USBHOST_GUIDE_BUTTON_STATUS:
+              case USBHOST_GUIDE_BUTTON_STATUS:
 
-              /* Get exclusive access to the controller state data */
+                /* Get exclusive access to the controller state data */
 
-              ret = nxmutex_lock(&priv->lock);
-              if (ret < 0)
-                {
-                  goto exitloop;
-                }
+                ret = nxmutex_lock(&priv->lock);
+                if (ret < 0)
+                  {
+                    goto exitloop;
+                  }
 
-              /* Read the data out of the controller report. */
+                /* Read the data out of the controller report. */
 
-              priv->rpt.guide =
-                (priv->tbuffer[XBOX_BUTTON_GUIDE_INDEX] != 0) ? true : false;
-              priv->valid = true;
+                priv->rpt.guide =
+                  (priv->tbuffer[XBOX_BUTTON_GUIDE_INDEX] != 0) ?
+                  true : false;
+                priv->valid = true;
 
-              /* The One X controller requires an ACK of the guide button
-               * status message.
-               */
+                /* The One X controller requires an ACK of the guide button
+                 * status message.
+                 */
 
-              if (priv->tbuffer[1] == 0x30)
-                {
-                  static const uint8_t guide_button_report_ack[] =
+                if (priv->tbuffer[1] == 0x30)
                   {
-                    0x01, 0x20, 0x00, 0x09, 0x00, 0x07, 0x20, 0x02,
-                    0x00, 0x00, 0x00, 0x00, 0x00
-                  };
+                    static const uint8_t guide_button_report_ack[] =
+                    {
+                      0x01, 0x20, 0x00, 0x09, 0x00, 0x07, 0x20, 0x02,
+                      0x00, 0x00, 0x00, 0x00, 0x00
+                    };
 
-                  /* Remember the input packet sequence number. */
+                    /* Remember the input packet sequence number. */
 
-                  uint8_t seq_num = priv->tbuffer[2];
+                    uint8_t seq_num = priv->tbuffer[2];
 
-                  /* Copy the ACK packet into the transfer buffer. */
+                    /* Copy the ACK packet into the transfer buffer. */
 
-                  memcpy(priv->tbuffer, guide_button_report_ack,
-                         sizeof(guide_button_report_ack));
+                    memcpy(priv->tbuffer, guide_button_report_ack,
+                           sizeof(guide_button_report_ack));
 
-                  /* Ensure the sequence number is the same as the input
-                   * packet.
-                   */
+                    /* Ensure the sequence number is the same as the input
+                     * packet.
+                     */
 
-                  priv->tbuffer[2] = seq_num;
+                    priv->tbuffer[2] = seq_num;
 
-                  /* Perform the transfer. */
+                    /* Perform the transfer. */
 
-                  nbytes =
-                    DRVR_TRANSFER(hport->drvr, priv->epout, priv->tbuffer,
-                                  sizeof(guide_button_report_ack));
-                }
+                    nbytes =
+                      DRVR_TRANSFER(hport->drvr, priv->epout, priv->tbuffer,
+                                    sizeof(guide_button_report_ack));
+                  }
 
-              /* Notify any waiters that new controller data is available */
+                /* Notify any waiters that new controller data is available */
 
-              usbhost_pollnotify(priv);
+                usbhost_pollnotify(priv);
 
-              /* Release our lock on the state structure */
+                /* Release our lock on the state structure */
 
-              nxmutex_unlock(&priv->lock);
+                nxmutex_unlock(&priv->lock);
 
-              break;
+                break;
 
-            case USBHOST_BUTTON_DATA:
+              case USBHOST_BUTTON_DATA:
 
-              /* Ignore the controller data if no task has opened the
-               * driver.
-               */
+                /* Ignore the controller data if no task has opened the
+                 * driver.
+                 */
 
-              if (priv->open)
-                {
-                  /* Get exclusive access to the controller state data */
+                if (priv->open)
+                  {
+                    /* Get exclusive access to the controller state data */
 
-                  ret = nxmutex_lock(&priv->lock);
-                  if (ret < 0)
-                    {
-                      goto exitloop;
-                    }
+                    ret = nxmutex_lock(&priv->lock);
+                    if (ret < 0)
+                      {
+                        goto exitloop;
+                      }
 
-                  /* Read the data out of the controller report. */
-
-                  priv->rpt.sync =
-                    XBOX_BUTTON_SET(priv->tbuffer,
-                                    XBOX_BUTTON_SYNC_INDEX,
-                                    XBOX_BUTTON_SYNC_MASK);
-                  priv->rpt.start =
-                    XBOX_BUTTON_SET(priv->tbuffer,
-                                    XBOX_BUTTON_START_INDEX,
-                                    XBOX_BUTTON_START_MASK);
-                  priv->rpt.back =
-                    XBOX_BUTTON_SET(priv->tbuffer,
-                                    XBOX_BUTTON_BACK_INDEX,
-                                    XBOX_BUTTON_BACK_MASK);
-                  priv->rpt.a =
-                    XBOX_BUTTON_SET(priv->tbuffer,
-                                    XBOX_BUTTON_A_INDEX,
-                                    XBOX_BUTTON_A_MASK);
-                  priv->rpt.b =
-                    XBOX_BUTTON_SET(priv->tbuffer,
-                                    XBOX_BUTTON_B_INDEX,
-                                    XBOX_BUTTON_B_MASK);
-                  priv->rpt.x =
-                    XBOX_BUTTON_SET(priv->tbuffer,
-                                    XBOX_BUTTON_X_INDEX,
-                                    XBOX_BUTTON_X_MASK);
-                  priv->rpt.y =
-                    XBOX_BUTTON_SET(priv->tbuffer,
-                                    XBOX_BUTTON_Y_INDEX,
-                                    XBOX_BUTTON_Y_MASK);
-                  priv->rpt.dpad_up =
-                    XBOX_BUTTON_SET(priv->tbuffer,
-                                    XBOX_BUTTON_DPAD_UP_INDEX,
-                                    XBOX_BUTTON_DPAD_UP_MASK);
-                  priv->rpt.dpad_down =
-                    XBOX_BUTTON_SET(priv->tbuffer,
-                                    XBOX_BUTTON_DPAD_DOWN_INDEX,
-                                    XBOX_BUTTON_DPAD_DOWN_MASK);
-                  priv->rpt.dpad_left =
-                    XBOX_BUTTON_SET(priv->tbuffer,
-                                    XBOX_BUTTON_DPAD_LEFT_INDEX,
-                                    XBOX_BUTTON_DPAD_LEFT_MASK);
-                  priv->rpt.dpad_right =
-                    XBOX_BUTTON_SET(priv->tbuffer,
-                                    XBOX_BUTTON_DPAD_RIGHT_INDEX,
-                                    XBOX_BUTTON_DPAD_RIGHT_MASK);
-                  priv->rpt.bumper_left =
-                    XBOX_BUTTON_SET(priv->tbuffer,
-                                    XBOX_BUTTON_BUMPER_LEFT_INDEX,
-                                    XBOX_BUTTON_BUMPER_LEFT_MASK);
-                  priv->rpt.bumper_right =
-                    XBOX_BUTTON_SET(priv->tbuffer,
-                                    XBOX_BUTTON_BUMPER_RIGHT_INDEX,
-                                    XBOX_BUTTON_BUMPER_RIGHT_MASK);
-                  priv->rpt.stick_click_left =
-                    XBOX_BUTTON_SET(priv->tbuffer,
-                                    XBOX_BUTTON_STICK_LEFT_INDEX,
-                                    XBOX_BUTTON_STICK_LEFT_MASK);
-                  priv->rpt.stick_click_right =
-                    XBOX_BUTTON_SET(priv->tbuffer,
-                                    XBOX_BUTTON_STICK_RIGHT_INDEX,
-                                    XBOX_BUTTON_STICK_RIGHT_MASK);
-
-                  priv->rpt.trigger_left = ((FAR int16_t *)
-                      (priv->tbuffer))[XBOX_BUTTON_TRIGGER_LEFT];
-                  priv->rpt.trigger_right = ((FAR int16_t *)
-                      (priv->tbuffer))[XBOX_BUTTON_TRIGGER_RIGHT];
-                  priv->rpt.stick_left_x = ((FAR int16_t *)
-                      (priv->tbuffer))[XBOX_BUTTON_STICK_LEFT_X];
-                  priv->rpt.stick_left_y = ((FAR int16_t *)
-                      (priv->tbuffer))[XBOX_BUTTON_STICK_LEFT_Y];
-                  priv->rpt.stick_right_x = ((FAR int16_t *)
-                      (priv->tbuffer))[XBOX_BUTTON_STICK_RIGHT_X];
-                  priv->rpt.stick_right_y = ((FAR int16_t *)
-                      (priv->tbuffer))[XBOX_BUTTON_STICK_RIGHT_Y];
-
-                  priv->valid = true;
-
-                  /* Notify any waiters that new controller data is
-                   * available.
-                   */
+                    /* Read the data out of the controller report. */
+
+                    priv->rpt.sync =
+                      XBOX_BUTTON_SET(priv->tbuffer,
+                                      XBOX_BUTTON_SYNC_INDEX,
+                                      XBOX_BUTTON_SYNC_MASK);
+                    priv->rpt.start =
+                      XBOX_BUTTON_SET(priv->tbuffer,
+                                      XBOX_BUTTON_START_INDEX,
+                                      XBOX_BUTTON_START_MASK);
+                    priv->rpt.back =
+                      XBOX_BUTTON_SET(priv->tbuffer,
+                                      XBOX_BUTTON_BACK_INDEX,
+                                      XBOX_BUTTON_BACK_MASK);
+                    priv->rpt.a =
+                      XBOX_BUTTON_SET(priv->tbuffer,
+                                      XBOX_BUTTON_A_INDEX,
+                                      XBOX_BUTTON_A_MASK);
+                    priv->rpt.b =
+                      XBOX_BUTTON_SET(priv->tbuffer,
+                                      XBOX_BUTTON_B_INDEX,
+                                      XBOX_BUTTON_B_MASK);
+                    priv->rpt.x =
+                      XBOX_BUTTON_SET(priv->tbuffer,
+                                      XBOX_BUTTON_X_INDEX,
+                                      XBOX_BUTTON_X_MASK);
+                    priv->rpt.y =
+                      XBOX_BUTTON_SET(priv->tbuffer,
+                                      XBOX_BUTTON_Y_INDEX,
+                                      XBOX_BUTTON_Y_MASK);
+                    priv->rpt.dpad_up =
+                      XBOX_BUTTON_SET(priv->tbuffer,
+                                      XBOX_BUTTON_DPAD_UP_INDEX,
+                                      XBOX_BUTTON_DPAD_UP_MASK);
+                    priv->rpt.dpad_down =
+                      XBOX_BUTTON_SET(priv->tbuffer,
+                                      XBOX_BUTTON_DPAD_DOWN_INDEX,
+                                      XBOX_BUTTON_DPAD_DOWN_MASK);
+                    priv->rpt.dpad_left =
+                      XBOX_BUTTON_SET(priv->tbuffer,
+                                      XBOX_BUTTON_DPAD_LEFT_INDEX,
+                                      XBOX_BUTTON_DPAD_LEFT_MASK);
+                    priv->rpt.dpad_right =
+                      XBOX_BUTTON_SET(priv->tbuffer,
+                                      XBOX_BUTTON_DPAD_RIGHT_INDEX,
+                                      XBOX_BUTTON_DPAD_RIGHT_MASK);
+                    priv->rpt.bumper_left =
+                      XBOX_BUTTON_SET(priv->tbuffer,
+                                      XBOX_BUTTON_BUMPER_LEFT_INDEX,
+                                      XBOX_BUTTON_BUMPER_LEFT_MASK);
+                    priv->rpt.bumper_right =
+                      XBOX_BUTTON_SET(priv->tbuffer,
+                                      XBOX_BUTTON_BUMPER_RIGHT_INDEX,
+                                      XBOX_BUTTON_BUMPER_RIGHT_MASK);
+                    priv->rpt.stick_click_left =
+                      XBOX_BUTTON_SET(priv->tbuffer,
+                                      XBOX_BUTTON_STICK_LEFT_INDEX,
+                                      XBOX_BUTTON_STICK_LEFT_MASK);
+                    priv->rpt.stick_click_right =
+                      XBOX_BUTTON_SET(priv->tbuffer,
+                                      XBOX_BUTTON_STICK_RIGHT_INDEX,
+                                      XBOX_BUTTON_STICK_RIGHT_MASK);
+
+                    priv->rpt.trigger_left = ((FAR int16_t *)
+                        (priv->tbuffer))[XBOX_BUTTON_TRIGGER_LEFT];
+                    priv->rpt.trigger_right = ((FAR int16_t *)
+                        (priv->tbuffer))[XBOX_BUTTON_TRIGGER_RIGHT];
+                    priv->rpt.stick_left_x = ((FAR int16_t *)
+                        (priv->tbuffer))[XBOX_BUTTON_STICK_LEFT_X];
+                    priv->rpt.stick_left_y = ((FAR int16_t *)
+                        (priv->tbuffer))[XBOX_BUTTON_STICK_LEFT_Y];
+                    priv->rpt.stick_right_x = ((FAR int16_t *)
+                        (priv->tbuffer))[XBOX_BUTTON_STICK_RIGHT_X];
+                    priv->rpt.stick_right_y = ((FAR int16_t *)
+                        (priv->tbuffer))[XBOX_BUTTON_STICK_RIGHT_Y];
+
+                    priv->valid = true;
+
+                    /* Notify any waiters that new controller data is
+                     * available.
+                     */
 
-                  usbhost_pollnotify(priv);
+                    usbhost_pollnotify(priv);
 
-                  /* Release our lock on the state structure */
+                    /* Release our lock on the state structure */
 
-                  nxmutex_unlock(&priv->lock);
-                }
+                    nxmutex_unlock(&priv->lock);
+                  }
 
-              break;
+                break;
 
-            default:
-              uinfo("Received message type: %x\n", priv->tbuffer[0]);
+              default:
+                uinfo("Received message type: %x\n", priv->tbuffer[0]);
             }
         }
 
@@ -1094,125 +1097,125 @@ static inline int usbhost_cfgdesc(FAR struct 
usbhost_state_s *priv,
       desc = (FAR struct usb_desc_s *)configdesc;
       switch (desc->type)
         {
-        /* Interface descriptor. We really should get the number of endpoints
-         * from this descriptor too.
-         */
-
-        case USB_DESC_TYPE_INTERFACE:
-          {
-            uinfo("Interface descriptor\n");
-            DEBUGASSERT(remaining >= USB_SIZEOF_IFDESC);
-
-            /* Did we already find what we needed from a preceding
-             * interface?
-             */
-
-            if ((found & USBHOST_ALLFOUND) == USBHOST_ALLFOUND)
-              {
-                /* Yes.. then break out of the loop and use the preceding
-                 * interface.
-                 */
-
-                done = true;
-              }
-            else
-              {
-                /* Otherwise, discard any endpoints previously found */
-
-                found = USBHOST_IFFOUND;
-              }
-          }
-          break;
-
-        /* Endpoint descriptor.  Here, we expect two bulk endpoints, an IN
-         * and an OUT.
-         */
-
-        case USB_DESC_TYPE_ENDPOINT:
-          {
-            FAR struct usb_epdesc_s *epdesc =
-              (FAR struct usb_epdesc_s *)configdesc;
-
-            uinfo("Endpoint descriptor\n");
-            DEBUGASSERT(remaining >= USB_SIZEOF_EPDESC);
-
-            /* Check for a interrupt endpoint. */
-
-            if ((epdesc->attr & USB_EP_ATTR_XFERTYPE_MASK) ==
-                USB_EP_ATTR_XFER_INT)
-              {
-                /* Yes.. it is a interrupt endpoint.  IN or OUT? */
-
-                if (USB_ISEPOUT(epdesc->addr))
-                  {
-                    /* It is an OUT interrupt endpoint.  There should be only
-                     * one interrupt OUT endpoint.
-                     */
-
-                    if ((found & USBHOST_EPOUTFOUND) != 0)
-                      {
-                        /* Oops.. more than one endpoint.  We don't know
-                         * what to do with this.
-                         */
+          /* Interface descriptor. We really should get the number of
+           * endpoints from this descriptor too.
+           */
 
-                        return -EINVAL;
-                      }
+          case USB_DESC_TYPE_INTERFACE:
+            {
+              uinfo("Interface descriptor\n");
+              DEBUGASSERT(remaining >= USB_SIZEOF_IFDESC);
 
-                    found |= USBHOST_EPOUTFOUND;
+              /* Did we already find what we needed from a preceding
+               * interface?
+               */
 
-                    /* Save the bulk OUT endpoint information */
+              if ((found & USBHOST_ALLFOUND) == USBHOST_ALLFOUND)
+                {
+                  /* Yes.. then break out of the loop and use the preceding
+                   * interface.
+                   */
 
-                    epoutdesc.hport        = hport;
-                    epoutdesc.addr         = epdesc->addr &
-                                             USB_EP_ADDR_NUMBER_MASK;
-                    epoutdesc.in           = false;
-                    epoutdesc.xfrtype      = USB_EP_ATTR_XFER_INT;
-                    epoutdesc.interval     = epdesc->interval;
-                    epoutdesc.mxpacketsize =
-                      usbhost_getle16(epdesc->mxpacketsize);
+                  done = true;
+                }
+              else
+                {
+                  /* Otherwise, discard any endpoints previously found */
 
-                    uerr("Interrupt OUT EP addr:%d mxpacketsize:%d\n",
-                          epoutdesc.addr, epoutdesc.mxpacketsize);
-                  }
-                else
-                  {
-                    /* It is an IN interrupt endpoint.  There should be only
-                     * one interrupt IN endpoint.
-                     */
+                  found = USBHOST_IFFOUND;
+                }
+            }
+            break;
 
-                    if ((found & USBHOST_EPINFOUND) != 0)
-                      {
-                        /* Oops.. more than one endpoint.  We don't know
-                         * what to do with this.
-                         */
+          /* Endpoint descriptor.  Here, we expect two bulk endpoints, an IN
+           * and an OUT.
+           */
 
-                        return -EINVAL;
-                      }
+          case USB_DESC_TYPE_ENDPOINT:
+            {
+              FAR struct usb_epdesc_s *epdesc =
+                (FAR struct usb_epdesc_s *)configdesc;
 
-                    found |= USBHOST_EPINFOUND;
+              uinfo("Endpoint descriptor\n");
+              DEBUGASSERT(remaining >= USB_SIZEOF_EPDESC);
 
-                    /* Save the bulk IN endpoint information */
+              /* Check for a interrupt endpoint. */
 
-                    epindesc.hport        = hport;
-                    epindesc.addr         = epdesc->addr &
-                                            USB_EP_ADDR_NUMBER_MASK;
-                    epindesc.in           = true;
-                    epindesc.xfrtype      = USB_EP_ATTR_XFER_INT;
-                    epindesc.interval     = epdesc->interval;
-                    epindesc.mxpacketsize =
-                      usbhost_getle16(epdesc->mxpacketsize);
+              if ((epdesc->attr & USB_EP_ATTR_XFERTYPE_MASK) ==
+                  USB_EP_ATTR_XFER_INT)
+                {
+                  /* Yes.. it is a interrupt endpoint.  IN or OUT? */
 
-                    uerr("Interrupt IN EP addr:%d mxpacketsize:%d\n",
-                          epindesc.addr, epindesc.mxpacketsize);
-                  }
-              }
-          }
-          break;
+                  if (USB_ISEPOUT(epdesc->addr))
+                    {
+                      /* It is an OUT interrupt endpoint.  There should be
+                       * only one interrupt OUT endpoint.
+                       */
+
+                      if ((found & USBHOST_EPOUTFOUND) != 0)
+                        {
+                          /* Oops.. more than one endpoint.  We don't know
+                           * what to do with this.
+                           */
+
+                          return -EINVAL;
+                        }
+
+                      found |= USBHOST_EPOUTFOUND;
+
+                      /* Save the bulk OUT endpoint information */
+
+                      epoutdesc.hport        = hport;
+                      epoutdesc.addr         = epdesc->addr &
+                                               USB_EP_ADDR_NUMBER_MASK;
+                      epoutdesc.in           = false;
+                      epoutdesc.xfrtype      = USB_EP_ATTR_XFER_INT;
+                      epoutdesc.interval     = epdesc->interval;
+                      epoutdesc.mxpacketsize =
+                        usbhost_getle16(epdesc->mxpacketsize);
+
+                      uerr("Interrupt OUT EP addr:%d mxpacketsize:%d\n",
+                            epoutdesc.addr, epoutdesc.mxpacketsize);
+                    }
+                  else
+                    {
+                      /* It is an IN interrupt endpoint.  There should be
+                       * only one interrupt IN endpoint.
+                       */
+
+                      if ((found & USBHOST_EPINFOUND) != 0)
+                        {
+                          /* Oops.. more than one endpoint.  We don't know
+                           * what to do with this.
+                           */
+
+                          return -EINVAL;
+                        }
+
+                      found |= USBHOST_EPINFOUND;
+
+                      /* Save the bulk IN endpoint information */
+
+                      epindesc.hport        = hport;
+                      epindesc.addr         = epdesc->addr &
+                                              USB_EP_ADDR_NUMBER_MASK;
+                      epindesc.in           = true;
+                      epindesc.xfrtype      = USB_EP_ATTR_XFER_INT;
+                      epindesc.interval     = epdesc->interval;
+                      epindesc.mxpacketsize =
+                        usbhost_getle16(epdesc->mxpacketsize);
+
+                      uerr("Interrupt IN EP addr:%d mxpacketsize:%d\n",
+                            epindesc.addr, epindesc.mxpacketsize);
+                    }
+                }
+            }
+            break;
 
-        /* Other descriptors are just ignored for now */
+          /* Other descriptors are just ignored for now */
 
-        default:
-          break;
+          default:
+            break;
         }
 
       /* If we found everything we need with this interface, then break out
@@ -2028,35 +2031,35 @@ static int usbhost_ioctl(FAR struct file *filep, int 
cmd, unsigned long arg)
 
   switch (cmd)
     {
-    case XBOX_CONTROLLER_IOCTL_RUMBLE:
+      case XBOX_CONTROLLER_IOCTL_RUMBLE:
 
-      /* The least significant byte is the weak actuator strength.
-       * The second byte is the strong actuator strength.
-       */
+        /* The least significant byte is the weak actuator strength.
+         * The second byte is the strong actuator strength.
+         */
 
-      memcpy(priv->obuffer, rumble_cmd, sizeof(rumble_cmd));
-      priv->obuffer[2] = priv->out_seq_num++;
-      priv->obuffer[8] = (arg >> 1) & 0xff; /* Strong (left actuator) */
-      priv->obuffer[9] = arg & 0xff;        /* Weak (right actuator)  */
+        memcpy(priv->obuffer, rumble_cmd, sizeof(rumble_cmd));
+        priv->obuffer[2] = priv->out_seq_num++;
+        priv->obuffer[8] = (arg >> 1) & 0xff; /* Strong (left actuator) */
+        priv->obuffer[9] = arg & 0xff;        /* Weak (right actuator)  */
 
-      /* Perform the transfer. */
+        /* Perform the transfer. */
 
-      nbytes = DRVR_TRANSFER(hport->drvr, priv->epout,
-                 priv->obuffer, sizeof(rumble_cmd));
+        nbytes = DRVR_TRANSFER(hport->drvr, priv->epout,
+                   priv->obuffer, sizeof(rumble_cmd));
 
-      /* Did we encounter an error? */
+        /* Did we encounter an error? */
 
-      if (nbytes < 0)
-        {
-          ret = nbytes;
-        }
+        if (nbytes < 0)
+          {
+            ret = nbytes;
+          }
 
-      break;
+        break;
 
-    default:
+      default:
 
-      ret = -ENOTTY;
-      goto errout;
+        ret = -ENOTTY;
+        goto errout;
     }
 
 errout:
@@ -2148,6 +2151,7 @@ static int usbhost_poll(FAR struct file *filep, FAR 
struct pollfd *fds,
       /* This is a request to tear down the poll. */
 
       struct pollfd **slot = (struct pollfd **)fds->priv;
+
       DEBUGASSERT(slot);
 
       /* Remove all memory of the poll setup */
diff --git a/drivers/usbmisc/fusb301.c b/drivers/usbmisc/fusb301.c
index 1f7d6f45d97..5fc5fa92807 100644
--- a/drivers/usbmisc/fusb301.c
+++ b/drivers/usbmisc/fusb301.c
@@ -586,56 +586,56 @@ static int fusb301_ioctl(FAR struct file *filep, int cmd, 
unsigned long arg)
   fusb301_info("cmd: 0x%02X, arg:%lu\n", cmd, arg);
 
   switch (cmd)
-  {
-  case USBCIOC_READ_DEVID:
     {
-      ret = fusb301_read_device_id(priv, (FAR uint8_t *)arg);
-    }
-    break;
+      case USBCIOC_READ_DEVID:
+        {
+          ret = fusb301_read_device_id(priv, (FAR uint8_t *)arg);
+        }
+        break;
 
-  case USBCIOC_SETUP:
-    {
-      ret = fusb301_setup(priv, (struct fusb301_setup_s *)arg);
-    }
-    break;
+      case USBCIOC_SETUP:
+        {
+          ret = fusb301_setup(priv, (struct fusb301_setup_s *)arg);
+        }
+        break;
 
-  case USBCIOC_SET_MODE:
-    {
-      ret = fusb301_set_mode(priv, (uint8_t)arg);
-    }
-    break;
+      case USBCIOC_SET_MODE:
+        {
+          ret = fusb301_set_mode(priv, (uint8_t)arg);
+        }
+        break;
 
-  case USBCIOC_SET_STATE:
-    {
-      ret = fusb301_set_state(priv, (uint8_t)arg);
-    }
-    break;
+      case USBCIOC_SET_STATE:
+        {
+          ret = fusb301_set_state(priv, (uint8_t)arg);
+        }
+        break;
 
-  case USBCIOC_READ_STATUS:
-    {
-      ret = fusb301_read_status(priv, (FAR uint8_t *)arg);
-    }
-    break;
+      case USBCIOC_READ_STATUS:
+        {
+          ret = fusb301_read_status(priv, (FAR uint8_t *)arg);
+        }
+        break;
 
-  case USBCIOC_READ_DEVTYPE:
-    {
-      ret = fusb301_read_devtype(priv, (FAR uint8_t *)arg);
-    }
-    break;
+      case USBCIOC_READ_DEVTYPE:
+        {
+          ret = fusb301_read_devtype(priv, (FAR uint8_t *)arg);
+        }
+        break;
 
-  case USBCIOC_RESET:
-    {
-      ret = fusb301_reset(priv);
-    }
-    break;
+      case USBCIOC_RESET:
+        {
+          ret = fusb301_reset(priv);
+        }
+        break;
 
-  default:
-    {
-      fusb301_err("ERROR: Unrecognized cmd: %d\n", cmd);
-      ret = -ENOTTY;
+      default:
+        {
+          fusb301_err("ERROR: Unrecognized cmd: %d\n", cmd);
+          ret = -ENOTTY;
+        }
+        break;
     }
-    break;
-  }
 
   nxmutex_unlock(&priv->devlock);
   return ret;
@@ -717,6 +717,7 @@ static int fusb301_poll(FAR struct file *filep,
       /* This is a request to tear down the poll. */
 
       FAR struct pollfd **slot = (FAR struct pollfd **)fds->priv;
+
       DEBUGASSERT(slot != NULL);
 
       /* Remove all memory of the poll setup */
diff --git a/drivers/usbmisc/fusb303.c b/drivers/usbmisc/fusb303.c
index c945f2855a7..9a281774e32 100644
--- a/drivers/usbmisc/fusb303.c
+++ b/drivers/usbmisc/fusb303.c
@@ -773,56 +773,56 @@ static int fusb303_ioctl(FAR struct file *filep, int cmd, 
unsigned long arg)
   fusb303_info("cmd: 0x%02X, arg:%lu\n", cmd, arg);
 
   switch (cmd)
-  {
-  case USBCIOC_READ_DEVID:
     {
-      ret = fusb303_read_device_id(priv, (FAR uint8_t *)arg, NULL);
-    }
-    break;
+      case USBCIOC_READ_DEVID:
+        {
+          ret = fusb303_read_device_id(priv, (FAR uint8_t *)arg, NULL);
+        }
+        break;
 
-  case USBCIOC_SETUP:
-    {
-      ret = fusb303_setup(priv, (struct fusb303_setup_s *)arg);
-    }
-    break;
+      case USBCIOC_SETUP:
+        {
+          ret = fusb303_setup(priv, (struct fusb303_setup_s *)arg);
+        }
+        break;
 
-  case USBCIOC_SET_MODE:
-    {
-      ret = fusb303_set_mode(priv, (uint8_t)arg);
-    }
-    break;
+      case USBCIOC_SET_MODE:
+        {
+          ret = fusb303_set_mode(priv, (uint8_t)arg);
+        }
+        break;
 
-  case USBCIOC_SET_STATE:
-    {
-      ret = fusb303_set_state(priv, (uint8_t)arg);
-    }
-    break;
+      case USBCIOC_SET_STATE:
+        {
+          ret = fusb303_set_state(priv, (uint8_t)arg);
+        }
+        break;
 
-  case USBCIOC_READ_STATUS:
-    {
-      ret = fusb303_read_status(priv, (FAR uint8_t *)arg);
-    }
-    break;
+      case USBCIOC_READ_STATUS:
+        {
+          ret = fusb303_read_status(priv, (FAR uint8_t *)arg);
+        }
+        break;
 
-  case USBCIOC_READ_DEVTYPE:
-    {
-      ret = fusb303_read_devtype(priv, (FAR uint8_t *)arg);
-    }
-    break;
+      case USBCIOC_READ_DEVTYPE:
+        {
+          ret = fusb303_read_devtype(priv, (FAR uint8_t *)arg);
+        }
+        break;
 
-  case USBCIOC_RESET:
-    {
-      ret = fusb303_reset(priv);
-    }
-    break;
+      case USBCIOC_RESET:
+        {
+          ret = fusb303_reset(priv);
+        }
+        break;
 
-  default:
-    {
-      fusb303_err("ERROR: Unrecognized cmd: %d\n", cmd);
-      ret = -ENOTTY;
+      default:
+        {
+          fusb303_err("ERROR: Unrecognized cmd: %d\n", cmd);
+          ret = -ENOTTY;
+        }
+        break;
     }
-    break;
-  }
 
   nxmutex_unlock(&priv->devlock);
   return ret;
@@ -905,6 +905,7 @@ static int fusb303_poll(FAR struct file *filep, FAR struct 
pollfd *fds,
       /* This is a request to tear down the poll. */
 
       FAR struct pollfd **slot = (FAR struct pollfd **)fds->priv;
+
       DEBUGASSERT(slot != NULL);
 
       /* Remove all memory of the poll setup */

Reply via email to