You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/12/09 01:40:09 UTC

[GitHub] [nuttx] pstys commented on a diff in pull request #7828: Adjust ioctl function of cellular

pstys commented on code in PR #7828:
URL: https://github.com/apache/nuttx/pull/7828#discussion_r1043981779


##########
net/netdev/netdev_ioctl.c:
##########
@@ -544,6 +548,51 @@ static int netdev_pktradio_ioctl(FAR struct socket *psock, int cmd,
 }
 #endif /* HAVE_PKTRADIO_IOCTL */
 
+/****************************************************************************
+ * Name: netdev_cell_ioctl
+ *
+ * Description:
+ *   Perform cell ioctl operations.
+ *
+ * Parameters:
+ *   psock    Socket structure
+ *   cmd      The ioctl command
+ *   arg      The argument of the ioctl cmd
+ *
+ * Return:
+ *   >=0 on success (positive non-zero values are cmd-specific)
+ *   Negated errno returned on failure.
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_NETDEV_IOCTL) && defined(CONFIG_NET_CELLULAR)
+static int netdev_cell_ioctl(FAR struct socket *psock, int cmd,
+                             FAR struct icellreq *req)
+{
+  FAR struct net_driver_s *dev = NULL;
+  int ret = -ENOTTY;
+
+  net_lock();
+
+  if (_CELLIOCVALID(cmd))
+    {
+      ninfo("cmd: %d\n", cmd);

Review Comment:
   Done



##########
net/netdev/netdev_ioctl.c:
##########
@@ -544,6 +548,51 @@ static int netdev_pktradio_ioctl(FAR struct socket *psock, int cmd,
 }
 #endif /* HAVE_PKTRADIO_IOCTL */
 
+/****************************************************************************
+ * Name: netdev_cell_ioctl
+ *
+ * Description:
+ *   Perform cell ioctl operations.
+ *
+ * Parameters:
+ *   psock    Socket structure
+ *   cmd      The ioctl command
+ *   arg      The argument of the ioctl cmd
+ *
+ * Return:
+ *   >=0 on success (positive non-zero values are cmd-specific)
+ *   Negated errno returned on failure.
+ *
+ ****************************************************************************/
+
+#if defined(CONFIG_NETDEV_IOCTL) && defined(CONFIG_NET_CELLULAR)
+static int netdev_cell_ioctl(FAR struct socket *psock, int cmd,
+                             FAR struct icellreq *req)
+{
+  FAR struct net_driver_s *dev = NULL;
+  int ret = -ENOTTY;
+
+  net_lock();
+
+  if (_CELLIOCVALID(cmd))
+    {
+      ninfo("cmd: %d\n", cmd);
+      dev = netdev_findbyname(req->ifr_name);
+      if (dev && dev->d_ioctl)
+        {
+          ret = dev->d_ioctl(dev, cmd, (unsigned long)(uintptr_t)req);
+        }
+      else
+        {
+          ret = -ENOTTY;

Review Comment:
   Done



-- 
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