diff --git a/nshlib/nsh_command.c b/nshlib/nsh_command.c index 318ac2a51..5bc7ab01a 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 " }, + { "rptun", cmd_rptun, 3, 4, "start|stop|reset|panic [value]" }, #endif #ifndef CONFIG_NSH_DISABLE_SET diff --git a/nshlib/nsh_syscmds.c b/nshlib/nsh_syscmds.c index 9470b2c7b..ce63a2ac2 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;