You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/07/29 19:15:05 UTC

[incubator-nuttx-apps] branch master updated (79a137495 -> 75155532b)

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

xiaoxiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git


    from 79a137495 cu: fix cu hang when meet ctrl + C
     new a109a6e58 rptun_ping: add sleep param to rptun_ping
     new 75155532b pmconfig: update pmconfig dump

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 nshlib/nsh_command.c |  6 +++---
 nshlib/nsh_syscmds.c | 61 +++++++++++++++++++++++++++++++---------------------
 2 files changed, 39 insertions(+), 28 deletions(-)


[incubator-nuttx-apps] 02/02: pmconfig: update pmconfig dump

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git

commit 75155532b699f2c140ab965c800ef47afbff843e
Author: ligd <li...@xiaomi.com>
AuthorDate: Mon Jun 20 14:31:27 2022 +0800

    pmconfig: update pmconfig dump
    
    Signed-off-by: ligd <li...@xiaomi.com>
---
 nshlib/nsh_syscmds.c | 57 ++++++++++++++++++++++++++++++----------------------
 1 file changed, 33 insertions(+), 24 deletions(-)

diff --git a/nshlib/nsh_syscmds.c b/nshlib/nsh_syscmds.c
index 277ecd46d..e9702206b 100644
--- a/nshlib/nsh_syscmds.c
+++ b/nshlib/nsh_syscmds.c
@@ -71,6 +71,10 @@
                         UNAME_MACHINE | UNAME_PLATFORM)
 #endif
 
+#ifndef CONFIG_NSH_PROC_MOUNTPOINT
+#  define CONFIG_NSH_PROC_MOUNTPOINT "/proc"
+#endif
+
 /****************************************************************************
  * Private Data
  ****************************************************************************/
@@ -172,6 +176,30 @@ int cmd_shutdown(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
  ****************************************************************************/
 
 #if defined(CONFIG_PM) && !defined(CONFIG_NSH_DISABLE_PMCONFIG)
+static int cmd_pmconfig_recursive(FAR struct nsh_vtbl_s *vtbl,
+                                  FAR const char *dirpath,
+                                  FAR struct dirent *entryp,
+                                  FAR void *pvarg)
+{
+  char *path;
+  int ret = ERROR;
+
+  if (DIRENT_ISDIRECTORY(entryp->d_type))
+    {
+      return 0;
+    }
+
+  path = nsh_getdirpath(vtbl, dirpath, entryp->d_name);
+  if (path)
+    {
+      nsh_output(vtbl, "\n%s:\n", path);
+      ret = nsh_catfile(vtbl, pvarg, path);
+      free(path);
+    }
+
+  return ret;
+}
+
 int cmd_pmconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
 {
   struct boardioc_pm_ctrl_s ctrl =
@@ -182,10 +210,6 @@ int cmd_pmconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
     {
       int next_state;
       int last_state;
-      int normal_count;
-      int idle_count;
-      int standby_count;
-      int sleep_count;
 
       if (argc == 2)
         {
@@ -200,27 +224,12 @@ int cmd_pmconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
       boardctl(BOARDIOC_PM_CONTROL, (uintptr_t)&ctrl);
       next_state = ctrl.state;
 
-      ctrl.action = BOARDIOC_PM_STAYCOUNT;
-      ctrl.state = PM_NORMAL;
-      boardctl(BOARDIOC_PM_CONTROL, (uintptr_t)&ctrl);
-      normal_count = ctrl.count;
-
-      ctrl.state = PM_IDLE;
-      boardctl(BOARDIOC_PM_CONTROL, (uintptr_t)&ctrl);
-      idle_count = ctrl.count;
-
-      ctrl.state = PM_STANDBY;
-      boardctl(BOARDIOC_PM_CONTROL, (uintptr_t)&ctrl);
-      standby_count = ctrl.count;
-
-      ctrl.state = PM_SLEEP;
-      boardctl(BOARDIOC_PM_CONTROL, (uintptr_t)&ctrl);
-      sleep_count = ctrl.count;
+      nsh_output(vtbl, "Last state %d, Next state %d\n",
+                 last_state, next_state);
 
-      nsh_output(vtbl, "Last state %d, Next state %d"
-                 "PM stay [%d, %d, %d, %d]\n",
-                 last_state, next_state, normal_count, idle_count,
-                 standby_count, sleep_count);
+      return nsh_foreach_direntry(vtbl, argv[0],
+                                  CONFIG_NSH_PROC_MOUNTPOINT "/pm",
+                                  cmd_pmconfig_recursive, argv[0]);
     }
   else if (argc <= 4)
     {


[incubator-nuttx-apps] 01/02: rptun_ping: add sleep param to rptun_ping

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git

commit a109a6e58bdcb5998897ca3fc52c72e90326a9fc
Author: ligd <li...@xiaomi.com>
AuthorDate: Wed May 11 12:31:25 2022 +0800

    rptun_ping: add sleep param to rptun_ping
    
    Signed-off-by: ligd <li...@xiaomi.com>
---
 nshlib/nsh_command.c | 6 +++---
 nshlib/nsh_syscmds.c | 4 +++-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/nshlib/nsh_command.c b/nshlib/nsh_command.c
index 80d1b4a0b..8880df437 100644
--- a/nshlib/nsh_command.c
+++ b/nshlib/nsh_command.c
@@ -476,9 +476,9 @@ static const struct cmdmap_s g_cmdmap[] =
 #endif
 
 #if defined(CONFIG_RPTUN) && !defined(CONFIG_NSH_DISABLE_RPTUN)
-  { "rptun",    cmd_rptun,    3, 6,
-    "<start|stop|reset|panic|dump|ping> <path|all> "
-    "[value|times length ack]" },
+  { "rptun",    cmd_rptun,    3, 7,
+    "<start|stop|reset|panic|dump|ping> <path|all>"
+    " [value|times length ack sleep]" },
 #endif
 
 #ifndef CONFIG_NSH_DISABLE_SET
diff --git a/nshlib/nsh_syscmds.c b/nshlib/nsh_syscmds.c
index 9bdc9dad3..277ecd46d 100644
--- a/nshlib/nsh_syscmds.c
+++ b/nshlib/nsh_syscmds.c
@@ -393,7 +393,8 @@ static int cmd_rptun_once(FAR struct nsh_vtbl_s *vtbl,
     }
   else if (strcmp(argv[1], "ping") == 0)
     {
-      if (argv[3] == 0 || argv[4] == 0 || argv[5] == 0)
+      if (argv[3] == 0 || argv[4] == 0 ||
+          argv[5] == 0 || argv[6] == 0)
         {
           return ERROR;
         }
@@ -401,6 +402,7 @@ static int cmd_rptun_once(FAR struct nsh_vtbl_s *vtbl,
       ping.times = atoi(argv[3]);
       ping.len   = atoi(argv[4]);
       ping.ack   = atoi(argv[5]);
+      ping.sleep = atoi(argv[6]);
 
       cmd = RPTUNIOC_PING;
       val = (unsigned long)&ping;