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/04/01 09:36:57 UTC
[incubator-nuttx-apps] branch master updated (de61706 -> 4701742)
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 de61706 nsh/memdump: support dynamic turn on/off backtrace in heap
new c57677c apps: add rptun /dev/rptun/xx panic cmd
new d5aae96 apps: add rptun reset /dev/rptun/xx cmd
new e0e5652 rptun: add rptun dump support
new 622784b rptun cmd: add broadcast rptun cmd
new f5d2c64 rptun: add rptun ping support
new 4701742 rptun: update rptun cmd usage
The 6 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 | 4 ++-
nshlib/nsh_syscmds.c | 89 +++++++++++++++++++++++++++++++++++++++++++++-------
2 files changed, 80 insertions(+), 13 deletions(-)
[incubator-nuttx-apps] 05/06: rptun: add rptun ping support
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 f5d2c645561aeb2523e069de5df56243f9bc6236
Author: ligd <li...@xiaomi.com>
AuthorDate: Thu Mar 3 18:05:48 2022 +0800
rptun: add rptun ping support
Signed-off-by: ligd <li...@xiaomi.com>
---
nshlib/nsh_command.c | 4 ++--
nshlib/nsh_syscmds.c | 18 +++++++++++++++++-
2 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/nshlib/nsh_command.c b/nshlib/nsh_command.c
index e0c25ee..19740c8 100644
--- a/nshlib/nsh_command.c
+++ b/nshlib/nsh_command.c
@@ -470,8 +470,8 @@ static const struct cmdmap_s g_cmdmap[] =
#endif
#if defined(CONFIG_RPTUN) && !defined(CONFIG_NSH_DISABLE_RPTUN)
- { "rptun", cmd_rptun, 2, 4,
- "start|stop|reset|panic|dump [dev-path] [value]" },
+ { "rptun", cmd_rptun, 2, 6,
+ "start|stop|reset|panic|dump|ping [dev-path] [value|times length ack]" },
#endif
#ifndef CONFIG_NSH_DISABLE_SET
diff --git a/nshlib/nsh_syscmds.c b/nshlib/nsh_syscmds.c
index c348c60..cba1ad0 100644
--- a/nshlib/nsh_syscmds.c
+++ b/nshlib/nsh_syscmds.c
@@ -348,6 +348,7 @@ int cmd_reset_cause(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
static int cmd_rptun_once(FAR struct nsh_vtbl_s *vtbl, char *path,
int argc, char **argv)
{
+ struct rptun_ping_s ping;
unsigned long val = 0;
int cmd;
int fd;
@@ -377,6 +378,21 @@ static int cmd_rptun_once(FAR struct nsh_vtbl_s *vtbl, char *path,
{
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]);
@@ -386,7 +402,7 @@ static int cmd_rptun_once(FAR struct nsh_vtbl_s *vtbl, char *path,
fd = open(path, 0);
if (fd < 0)
{
- nsh_output(vtbl, g_fmtarginvalid, argv[2]);
+ nsh_output(vtbl, g_fmtarginvalid, path);
return ERROR;
}
[incubator-nuttx-apps] 04/06: rptun cmd: add broadcast rptun cmd
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 622784be89e658e7a3b3b326d3e876d38bd4685f
Author: ligd <li...@xiaomi.com>
AuthorDate: Fri Feb 11 21:05:08 2022 +0800
rptun cmd: add broadcast rptun cmd
Signed-off-by: ligd <li...@xiaomi.com>
---
nshlib/nsh_command.c | 4 ++--
nshlib/nsh_syscmds.c | 58 ++++++++++++++++++++++++++++++++++++++++++----------
2 files changed, 49 insertions(+), 13 deletions(-)
diff --git a/nshlib/nsh_command.c b/nshlib/nsh_command.c
index 2e41997..e0c25ee 100644
--- a/nshlib/nsh_command.c
+++ b/nshlib/nsh_command.c
@@ -470,8 +470,8 @@ static const struct cmdmap_s g_cmdmap[] =
#endif
#if defined(CONFIG_RPTUN) && !defined(CONFIG_NSH_DISABLE_RPTUN)
- { "rptun", cmd_rptun, 3, 4,
- "start|stop|reset|panic|dump <dev-path> [value]" },
+ { "rptun", cmd_rptun, 2, 4,
+ "start|stop|reset|panic|dump [dev-path] [value]" },
#endif
#ifndef CONFIG_NSH_DISABLE_SET
diff --git a/nshlib/nsh_syscmds.c b/nshlib/nsh_syscmds.c
index b903f49..c348c60 100644
--- a/nshlib/nsh_syscmds.c
+++ b/nshlib/nsh_syscmds.c
@@ -28,6 +28,7 @@
#include <sys/boardctl.h>
#include <sys/ioctl.h>
#include <sys/utsname.h>
+#include <dirent.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
@@ -344,17 +345,12 @@ int cmd_reset_cause(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
****************************************************************************/
#if defined(CONFIG_RPTUN) && !defined(CONFIG_NSH_DISABLE_RPTUN)
-int cmd_rptun(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
+static int cmd_rptun_once(FAR struct nsh_vtbl_s *vtbl, char *path,
+ int argc, char **argv)
{
unsigned long val = 0;
- int fd;
int cmd;
-
- if (argc < 3)
- {
- nsh_output(vtbl, g_fmtargrequired, argv[0]);
- return ERROR;
- }
+ int fd;
if (strcmp(argv[1], "start") == 0)
{
@@ -387,17 +383,57 @@ int cmd_rptun(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
return ERROR;
}
- fd = open(argv[2], 0);
+ fd = open(path, 0);
if (fd < 0)
{
nsh_output(vtbl, g_fmtarginvalid, argv[2]);
return ERROR;
}
- ioctl(fd, cmd, val);
+ 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 = 0;
+
+ if (DIRENT_ISDIRECTORY(entryp->d_type))
+ {
+ return 0;
+ }
+
+ path = nsh_getdirpath(vtbl, dirpath, entryp->d_name);
+ if (path)
+ {
+ ret = cmd_rptun_once(vtbl, path, 2, pvarg);
+ free(path);
+ }
+
+ return ret;
+}
+
+int cmd_rptun(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
+{
+ if (argc < 2)
+ {
+ nsh_output(vtbl, g_fmtargrequired, argv[0]);
+ return ERROR;
+ }
+
+ if (argc == 2)
+ {
+ return nsh_foreach_direntry(vtbl, "rptun", "/dev/rptun",
+ cmd_rptun_recursive, argv);
+ }
+
+ return cmd_rptun_once(vtbl, argv[2], argc, argv);
}
#endif
[incubator-nuttx-apps] 02/06: apps: add rptun reset /dev/rptun/xx cmd
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 d5aae96523de34812934f467ef8e02cc5f3da868
Author: ligd <li...@xiaomi.com>
AuthorDate: Fri Dec 24 17:18:56 2021 +0800
apps: add rptun reset /dev/rptun/xx cmd
Signed-off-by: ligd <li...@xiaomi.com>
---
nshlib/nsh_command.c | 2 +-
nshlib/nsh_syscmds.c | 12 +++++++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/nshlib/nsh_command.c b/nshlib/nsh_command.c
index 318ac2a..5bc7ab0 100644
--- a/nshlib/nsh_command.c
+++ b/nshlib/nsh_command.c
@@ -470,7 +470,7 @@ static const struct cmdmap_s g_cmdmap[] =
#endif
#if defined(CONFIG_RPTUN) && !defined(CONFIG_NSH_DISABLE_RPTUN)
- { "rptun", cmd_rptun, 3, 3, "start|stop|panic <dev-path>" },
+ { "rptun", cmd_rptun, 3, 4, "start|stop|reset|panic <dev-path> [value]" },
#endif
#ifndef CONFIG_NSH_DISABLE_SET
diff --git a/nshlib/nsh_syscmds.c b/nshlib/nsh_syscmds.c
index 9470b2c..ce63a2a 100644
--- a/nshlib/nsh_syscmds.c
+++ b/nshlib/nsh_syscmds.c
@@ -346,6 +346,7 @@ int cmd_reset_cause(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
#if defined(CONFIG_RPTUN) && !defined(CONFIG_NSH_DISABLE_RPTUN)
int cmd_rptun(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
+ unsigned long val = 0;
int fd;
int cmd;
@@ -363,6 +364,15 @@ 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;
@@ -380,7 +390,7 @@ int cmd_rptun(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
return ERROR;
}
- ioctl(fd, cmd, 0);
+ ioctl(fd, cmd, val);
close(fd);
return 0;
[incubator-nuttx-apps] 03/06: rptun: add rptun dump support
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 e0e5652de42f39d0122d03f0ddf3ecee3e8a7469
Author: ligd <li...@xiaomi.com>
AuthorDate: Wed Jan 19 21:07:59 2022 +0800
rptun: add rptun dump support
Signed-off-by: ligd <li...@xiaomi.com>
---
nshlib/nsh_command.c | 3 ++-
nshlib/nsh_syscmds.c | 4 ++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/nshlib/nsh_command.c b/nshlib/nsh_command.c
index 5bc7ab0..2e41997 100644
--- a/nshlib/nsh_command.c
+++ b/nshlib/nsh_command.c
@@ -470,7 +470,8 @@ static const struct cmdmap_s g_cmdmap[] =
#endif
#if defined(CONFIG_RPTUN) && !defined(CONFIG_NSH_DISABLE_RPTUN)
- { "rptun", cmd_rptun, 3, 4, "start|stop|reset|panic <dev-path> [value]" },
+ { "rptun", cmd_rptun, 3, 4,
+ "start|stop|reset|panic|dump <dev-path> [value]" },
#endif
#ifndef CONFIG_NSH_DISABLE_SET
diff --git a/nshlib/nsh_syscmds.c b/nshlib/nsh_syscmds.c
index ce63a2a..b903f49 100644
--- a/nshlib/nsh_syscmds.c
+++ b/nshlib/nsh_syscmds.c
@@ -377,6 +377,10 @@ int cmd_rptun(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
cmd = RPTUNIOC_PANIC;
}
+ else if (strcmp(argv[1], "dump") == 0)
+ {
+ cmd = RPTUNIOC_DUMP;
+ }
else
{
nsh_output(vtbl, g_fmtarginvalid, argv[1]);
[incubator-nuttx-apps] 06/06: rptun: update rptun cmd usage
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 470174260c363ea636640a85e2a2c412de5ea1dc
Author: ligd <li...@xiaomi.com>
AuthorDate: Thu Mar 31 20:11:09 2022 +0800
rptun: update rptun cmd usage
Signed-off-by: ligd <li...@xiaomi.com>
---
nshlib/nsh_command.c | 5 +++--
nshlib/nsh_syscmds.c | 23 +++++++++--------------
2 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/nshlib/nsh_command.c b/nshlib/nsh_command.c
index 19740c8..46a59a5 100644
--- a/nshlib/nsh_command.c
+++ b/nshlib/nsh_command.c
@@ -470,8 +470,9 @@ static const struct cmdmap_s g_cmdmap[] =
#endif
#if defined(CONFIG_RPTUN) && !defined(CONFIG_NSH_DISABLE_RPTUN)
- { "rptun", cmd_rptun, 2, 6,
- "start|stop|reset|panic|dump|ping [dev-path] [value|times length ack]" },
+ { "rptun", cmd_rptun, 3, 6,
+ "<start|stop|reset|panic|dump|ping> <path|all> "
+ "[value|times length ack]" },
#endif
#ifndef CONFIG_NSH_DISABLE_SET
diff --git a/nshlib/nsh_syscmds.c b/nshlib/nsh_syscmds.c
index cba1ad0..3e987cf 100644
--- a/nshlib/nsh_syscmds.c
+++ b/nshlib/nsh_syscmds.c
@@ -345,8 +345,8 @@ int cmd_reset_cause(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
****************************************************************************/
#if defined(CONFIG_RPTUN) && !defined(CONFIG_NSH_DISABLE_RPTUN)
-static int cmd_rptun_once(FAR struct nsh_vtbl_s *vtbl, char *path,
- int argc, char **argv)
+static int cmd_rptun_once(FAR struct nsh_vtbl_s *vtbl,
+ FAR const char *path, char **argv)
{
struct rptun_ping_s ping;
unsigned long val = 0;
@@ -363,11 +363,7 @@ static int cmd_rptun_once(FAR struct nsh_vtbl_s *vtbl, char *path,
}
else if (strcmp(argv[1], "reset") == 0)
{
- if (argc > 3)
- {
- val = atoi(argv[3]);
- }
-
+ val = atoi(argv[3]);
cmd = RPTUNIOC_RESET;
}
else if (strcmp(argv[1], "panic") == 0)
@@ -380,9 +376,8 @@ static int cmd_rptun_once(FAR struct nsh_vtbl_s *vtbl, char *path,
}
else if (strcmp(argv[1], "ping") == 0)
{
- if (argc != 6)
+ if (argv[3] == 0 || argv[4] == 0 || argv[5] == 0)
{
- nsh_output(vtbl, g_fmtarginvalid, path);
return ERROR;
}
@@ -418,7 +413,7 @@ static int cmd_rptun_recursive(FAR struct nsh_vtbl_s *vtbl,
struct dirent *entryp, void *pvarg)
{
char *path;
- int ret = 0;
+ int ret = ERROR;
if (DIRENT_ISDIRECTORY(entryp->d_type))
{
@@ -428,7 +423,7 @@ static int cmd_rptun_recursive(FAR struct nsh_vtbl_s *vtbl,
path = nsh_getdirpath(vtbl, dirpath, entryp->d_name);
if (path)
{
- ret = cmd_rptun_once(vtbl, path, 2, pvarg);
+ ret = cmd_rptun_once(vtbl, path, pvarg);
free(path);
}
@@ -437,19 +432,19 @@ static int cmd_rptun_recursive(FAR struct nsh_vtbl_s *vtbl,
int cmd_rptun(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
- if (argc < 2)
+ if (argc < 3)
{
nsh_output(vtbl, g_fmtargrequired, argv[0]);
return ERROR;
}
- if (argc == 2)
+ if (strcmp(argv[2], "all") == 0)
{
return nsh_foreach_direntry(vtbl, "rptun", "/dev/rptun",
cmd_rptun_recursive, argv);
}
- return cmd_rptun_once(vtbl, argv[2], argc, argv);
+ return cmd_rptun_once(vtbl, argv[2], argv);
}
#endif
[incubator-nuttx-apps] 01/06: apps: add rptun /dev/rptun/xx panic cmd
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 c57677c3ced5e0e0c5c299c0830aa9cabb4a383b
Author: ligd <li...@xiaomi.com>
AuthorDate: Wed Dec 22 19:50:48 2021 +0800
apps: add rptun /dev/rptun/xx panic cmd
Signed-off-by: ligd <li...@xiaomi.com>
---
nshlib/nsh_command.c | 2 +-
nshlib/nsh_syscmds.c | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/nshlib/nsh_command.c b/nshlib/nsh_command.c
index a251c1a..318ac2a 100644
--- a/nshlib/nsh_command.c
+++ b/nshlib/nsh_command.c
@@ -470,7 +470,7 @@ 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, 3, 3, "start|stop|panic <dev-path>" },
#endif
#ifndef CONFIG_NSH_DISABLE_SET
diff --git a/nshlib/nsh_syscmds.c b/nshlib/nsh_syscmds.c
index 471131c..9470b2c 100644
--- a/nshlib/nsh_syscmds.c
+++ b/nshlib/nsh_syscmds.c
@@ -363,6 +363,10 @@ int cmd_rptun(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
cmd = RPTUNIOC_STOP;
}
+ else if (strcmp(argv[1], "panic") == 0)
+ {
+ cmd = RPTUNIOC_PANIC;
+ }
else
{
nsh_output(vtbl, g_fmtarginvalid, argv[1]);