The NSH shutdown option should be called --reboot, not --reset, for compatibility with the statndard shutdown command

This commit is contained in:
Gregory Nutt 2015-07-04 11:39:44 -06:00
parent a2a1530694
commit 165637ce27
3 changed files with 12 additions and 11 deletions

View File

@ -884,11 +884,12 @@ o sh <script-path>
Execute the sequence of NSH commands in the file referred Execute the sequence of NSH commands in the file referred
to by <script-path>. to by <script-path>.
o shutdown [--reset] o shutdown [--reboot]
Shutdown and power off the system or, optionally, reset the system Shutdown and power off the system or, optionally, reset and reboot the
immediately. This command depends on hardware support to power down or system immediately. This command depends on hardware support to power
reset the system; one, both, or neither behavior may be supported. down or reset the system; one, both, or neither behavior may be
supported.
o sleep <sec> o sleep <sec>

View File

@ -371,11 +371,11 @@ static const struct cmdmap_s g_cmdmap[] =
#ifndef CONFIG_NSH_DISABLE_SHUTDOWN #ifndef CONFIG_NSH_DISABLE_SHUTDOWN
#if defined(CONFIG_BOARDCTL_POWEROFF) && defined(CONFIG_BOARDCTL_RESET) #if defined(CONFIG_BOARDCTL_POWEROFF) && defined(CONFIG_BOARDCTL_RESET)
{ "shutdown", cmd_shutdown, 1, 2, "[--reset]" }, { "shutdown", cmd_shutdown, 1, 2, "[--reboot]" },
#elif defined(CONFIG_BOARDCTL_POWEROFF) #elif defined(CONFIG_BOARDCTL_POWEROFF)
{ "shutdown", cmd_shutdown, 1, 1, NULL }, { "shutdown", cmd_shutdown, 1, 1, NULL },
#elif defined(CONFIG_BOARDCTL_RESET) #elif defined(CONFIG_BOARDCTL_RESET)
{ "shutdown", cmd_shutdown, 2, 2, "--reset" }, { "shutdown", cmd_shutdown, 2, 2, "--reboot" },
#endif #endif
#endif #endif

View File

@ -85,15 +85,15 @@ int cmd_shutdown(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{ {
#if defined(CONFIG_BOARDCTL_POWEROFF) && defined(CONFIG_BOARDCTL_RESET) #if defined(CONFIG_BOARDCTL_POWEROFF) && defined(CONFIG_BOARDCTL_RESET)
/* If both shutdown and reset are supported, then a single option may /* If both shutdown and reset are supported, then a single option may
* be provided to select the reset behavior (--reset). We know here * be provided to select the reset behavior (--reboot). We know here
* that argc is either 1 or 2. * that argc is either 1 or 2.
*/ */
if (argc == 2) if (argc == 2)
{ {
/* Verify that the single argument is --reset */ /* Verify that the single argument is --reboot */
if (strcmp(argv[1], "--reset") != 0) if (strcmp(argv[1], "--reboot") != 0)
{ {
nsh_output(vtbl, g_fmtarginvalid, argv[0]); nsh_output(vtbl, g_fmtarginvalid, argv[0]);
return ERROR return ERROR
@ -121,9 +121,9 @@ int cmd_shutdown(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
* argument has been provided. * argument has been provided.
*/ */
/* Verify that the single argument is --reset */ /* Verify that the single argument is --reboot */
if (strcmp(argv[1], "--reset") != 0) if (strcmp(argv[1], "--reboot") != 0)
{ {
nsh_output(vtbl, g_fmtarginvalid, argv[0]); nsh_output(vtbl, g_fmtarginvalid, argv[0]);
return ERROR return ERROR