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/03/28 15:03:44 UTC

[GitHub] [incubator-nuttx-apps] GUIDINGLI opened a new pull request #1099: rptun cmd update

GUIDINGLI opened a new pull request #1099:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1099


   ## Summary
   
   rptun cmd update
   
   add rptun reset/panic/ping/dump support
   
   This depends on:
   https://github.com/apache/incubator-nuttx/pull/5847
   
   ## Impact
   
   rptun cmds
   
   ## Testing
   
   VELA
   


-- 
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] [incubator-nuttx-apps] pkarashchenko commented on a change in pull request #1099: rptun cmd update

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #1099:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1099#discussion_r838910598



##########
File path: nshlib/nsh_syscmds.c
##########
@@ -343,23 +341,94 @@ int cmd_rptun(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
     {
       cmd = RPTUNIOC_STOP;
     }
+  else if (strcmp(argv[1], "reset") == 0)
+    {
+      if (argc > 3)
+        {
+          val = atoi(argv[3]);
+        }
+
+      cmd = RPTUNIOC_RESET;
+    }
+  else if (strcmp(argv[1], "panic") == 0)
+    {
+      cmd = RPTUNIOC_PANIC;
+    }
+  else if (strcmp(argv[1], "dump") == 0)
+    {
+      cmd = RPTUNIOC_DUMP;
+    }
+  else if (strcmp(argv[1], "ping") == 0)
+    {
+      if (argc != 6)
+        {
+          nsh_output(vtbl, g_fmtarginvalid, path);
+          return ERROR;
+        }
+
+      ping.times = atoi(argv[3]);
+      ping.len   = atoi(argv[4]);
+      ping.ack   = atoi(argv[5]);
+
+      cmd = RPTUNIOC_PING;
+      val = (unsigned long)&ping;
+    }
   else
     {
       nsh_output(vtbl, g_fmtarginvalid, argv[1]);
       return ERROR;
     }
 
-  fd = open(argv[2], 0);
+  fd = open(path, 0);
   if (fd < 0)
     {
-      nsh_output(vtbl, g_fmtarginvalid, argv[2]);
+      nsh_output(vtbl, g_fmtarginvalid, path);
       return ERROR;
     }
 
-  ioctl(fd, cmd, 0);
+  cmd = ioctl(fd, cmd, val);
 
   close(fd);
-  return 0;
+
+  return cmd;
+}
+
+static int cmd_rptun_recursive(FAR struct nsh_vtbl_s *vtbl,
+                               const char *dirpath,
+                               struct dirent *entryp, void *pvarg)
+{
+  char *path;
+  int ret;
+
+  if (DIRENT_ISDIRECTORY(entryp->d_type))
+    {
+      return 0;
+    }
+
+  path = nsh_getdirpath(vtbl, dirpath, entryp->d_name);

Review comment:
       Does getdirpath always return non-NULL value?




-- 
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] [incubator-nuttx-apps] xiaoxiang781216 merged pull request #1099: rptun cmd update

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged pull request #1099:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1099


   


-- 
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] [incubator-nuttx-apps] xiaoxiang781216 commented on a change in pull request #1099: rptun cmd update

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #1099:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1099#discussion_r839522414



##########
File path: nshlib/nsh_command.c
##########
@@ -466,7 +466,8 @@ static const struct cmdmap_s g_cmdmap[] =
 #endif
 
 #if defined(CONFIG_RPTUN) && !defined(CONFIG_NSH_DISABLE_RPTUN)
-  { "rptun",    cmd_rptun,    3, 3, "start|stop <dev-path>" },
+  { "rptun",    cmd_rptun,    2, 6,
+    "start|stop|reset|panic|dump|ping [dev-path] [value|times length ack]" },

Review comment:
       let's handle optional [dev-path] correctly




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