acassis commented on code in PR #8921:
URL: https://github.com/apache/nuttx/pull/8921#discussion_r1151181433


##########
drivers/usbhost/usbhost_hidkbd.c:
##########
@@ -977,6 +1023,332 @@ static inline void usbhost_encodescancode(FAR struct 
usbhost_state_s *priv,
 }
 #endif
 
+/****************************************************************************
+ * Name: usbhost_get_capslock
+ *
+ * Description:
+ *  Get the global value of caps lock.
+ *
+ * Input Parameters:
+ *   None
+ *
+ * Returned Value:
+ *   The value of g_caps_lock
+ *
+ ****************************************************************************/
+
+static inline bool usbhost_get_capslock()

Review Comment:
   ```suggestion
   static inline bool usbhost_get_capslock(void)



##########
drivers/usbhost/usbhost_hidkbd.c:
##########
@@ -1801,6 +2117,131 @@ static int usbhost_tdfree(FAR struct usbhost_state_s 
*priv)
   return result;
 }
 
+/****************************************************************************
+ * Name: usbhost_cralloc
+ *
+ * Description:
+ *   Allocate control request buffer memory.
+ *
+ * Input Parameters:
+ *   priv - A reference to the class instance.
+ *
+ * Returned Value:
+ *   On success, zero (OK) is returned.  On failure, an negated errno value
+ *   is returned to indicate the nature of the failure.
+ *
+ ****************************************************************************/
+
+static int usbhost_cralloc(FAR struct usbhost_state_s *priv)
+{
+  FAR struct usbhost_hubport_s *hport;
+
+  DEBUGASSERT(priv != NULL && priv->usbclass.hport != NULL &&
+              priv->tbuffer == NULL);
+  hport = priv->usbclass.hport;
+
+  return DRVR_ALLOC(hport->drvr, &priv->ctrlreq, &priv->ctrllen);
+}
+
+/****************************************************************************
+ * Name: usbhost_crfree
+ *
+ * Description:
+ *   Free control request buffer memory.
+ *
+ * Input Parameters:
+ *   priv - A reference to the class instance.
+ *
+ * Returned Value:
+ *   On success, zero (OK) is returned.  On failure, an negated errno value
+ *   is returned to indicate the nature of the failure.
+ *
+ ****************************************************************************/
+
+static int usbhost_crfree(FAR struct usbhost_state_s *priv)
+{
+  FAR struct usbhost_hubport_s *hport;
+  int result = OK;
+
+  DEBUGASSERT(priv);
+
+  if (priv->ctrlreq)
+    {
+      DEBUGASSERT(priv->usbclass.hport);
+      hport         = priv->usbclass.hport;
+      result        = DRVR_FREE(hport->drvr, priv->ctrlreq);
+      priv->ctrlreq = NULL;
+      priv->ctrllen = 0;
+    }
+
+  return result;
+}
+
+/****************************************************************************
+ * Name: usbhost_send_request
+ *
+ * Description:
+ *   Send a request.
+ *
+ * Input Parameters:
+ *   priv  - A reference to the class instance.
+ *   dir   - USB_REQ_DIR_IN or USB_REQ_DIR_OUT
+ *   req   - request identifier
+ *   value - request value
+ *   index - request index
+ *   len   - request length
+ *
+ * Returned Value:
+ *   On success, zero (OK) is returned.  On failure, an negated errno value
+ *   is returned to indicate the nature of the failure.
+ *
+ ****************************************************************************/
+
+static int usbhost_send_request(FAR struct usbhost_state_s *priv,
+                            uint8_t dir,
+                            uint8_t req,
+                            uint16_t value,
+                            uint16_t index,
+                            uint16_t len, uint8_t *data)

Review Comment:
   Please align "uint*" lines to start just at start of "FAR"



##########
drivers/usbhost/usbhost_hidkbd.c:
##########
@@ -977,6 +1023,332 @@ static inline void usbhost_encodescancode(FAR struct 
usbhost_state_s *priv,
 }
 #endif
 
+/****************************************************************************
+ * Name: usbhost_get_capslock
+ *
+ * Description:
+ *  Get the global value of caps lock.
+ *
+ * Input Parameters:
+ *   None
+ *
+ * Returned Value:
+ *   The value of g_caps_lock
+ *
+ ****************************************************************************/
+
+static inline bool usbhost_get_capslock()
+{
+  irqstate_t flags;
+  bool retval;
+
+  flags = enter_critical_section();
+  retval = g_caps_lock;
+  leave_critical_section(flags);
+
+  return retval;
+}
+
+/****************************************************************************
+ * Name: usbhost_toggle_capslock
+ *
+ * Description:
+ *  Toggle g_caps_lock.
+ *
+ * Input Parameters:
+ *   None
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+static inline void usbhost_toggle_capslock()

Review Comment:
   ```suggestion
   static inline void usbhost_toggle_capslock(void)



-- 
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-unsubscr...@nuttx.apache.org

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

Reply via email to