NSH now supports a shutdown command if CONFIG_BOARDCTL_POWEROFF-y
This commit is contained in:
parent
19f40c4f0f
commit
a18ed33d99
@ -1327,3 +1327,6 @@
|
|||||||
* The apps/ directory has been removed from the NuttX GIT repository
|
* The apps/ directory has been removed from the NuttX GIT repository
|
||||||
and now stands alone in its own repository (2015-06-27).
|
and now stands alone in its own repository (2015-06-27).
|
||||||
* apps/examples/poll: Fix a few bit-rot compilation errors (2015-07-01).
|
* apps/examples/poll: Fix a few bit-rot compilation errors (2015-07-01).
|
||||||
|
* apps/nshlib: NSH will now support an (optional) shutdown command if
|
||||||
|
the board provides the option CONFIG_BOARD_POWEROFF (2015-07-04).
|
||||||
|
|
||||||
|
@ -332,6 +332,11 @@ config NSH_DISABLE_SH
|
|||||||
bool "Disable sh"
|
bool "Disable sh"
|
||||||
default n
|
default n
|
||||||
|
|
||||||
|
config CONFIG_NSH_DISABLE_SHUTDOWN
|
||||||
|
bool "Disable sh"
|
||||||
|
default n
|
||||||
|
depends on BOARDCTL_POWEROFF
|
||||||
|
|
||||||
config NSH_DISABLE_SLEEP
|
config NSH_DISABLE_SLEEP
|
||||||
bool "Disable sleep"
|
bool "Disable sleep"
|
||||||
default n
|
default n
|
||||||
|
@ -42,7 +42,7 @@ include $(APPDIR)/Make.defs
|
|||||||
ASRCS =
|
ASRCS =
|
||||||
CSRCS = nsh_init.c nsh_parse.c nsh_console.c nsh_script.c
|
CSRCS = nsh_init.c nsh_parse.c nsh_console.c nsh_script.c
|
||||||
CSRCS += nsh_command.c nsh_fscmds.c nsh_ddcmd.c nsh_proccmds.c nsh_mmcmds.c
|
CSRCS += nsh_command.c nsh_fscmds.c nsh_ddcmd.c nsh_proccmds.c nsh_mmcmds.c
|
||||||
CSRCS += nsh_timcmds.c nsh_envcmds.c nsh_dbgcmds.c
|
CSRCS += nsh_timcmds.c nsh_envcmds.c nsh_syscmds.c nsh_dbgcmds.c
|
||||||
|
|
||||||
ifeq ($(CONFIG_NFILE_STREAMS),0)
|
ifeq ($(CONFIG_NFILE_STREAMS),0)
|
||||||
CSRCS += nsh_stdsession.c
|
CSRCS += nsh_stdsession.c
|
||||||
|
@ -884,6 +884,11 @@ 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
|
||||||
|
|
||||||
|
Shutdown and power off the system immediately. This command depends on
|
||||||
|
hardware support to power down the system.
|
||||||
|
|
||||||
o sleep <sec>
|
o sleep <sec>
|
||||||
|
|
||||||
Pause execution (sleep) of <sec> seconds.
|
Pause execution (sleep) of <sec> seconds.
|
||||||
@ -990,6 +995,7 @@ Command Dependencies on Configuration Settings
|
|||||||
rmdir (((!CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_WRITABLE) || !CONFIG_DISABLE_PSEUDOFS_OPERATIONS) && CONFIG_NFILE_DESCRIPTORS > 0)
|
rmdir (((!CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_WRITABLE) || !CONFIG_DISABLE_PSEUDOFS_OPERATIONS) && CONFIG_NFILE_DESCRIPTORS > 0)
|
||||||
set !CONFIG_DISABLE_ENVIRON
|
set !CONFIG_DISABLE_ENVIRON
|
||||||
sh CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && !CONFIG_NSH_DISABLESCRIPT
|
sh CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && !CONFIG_NSH_DISABLESCRIPT
|
||||||
|
shutdown CONFIG_BOARDCTL_POWEROFF
|
||||||
sleep !CONFIG_DISABLE_SIGNALS
|
sleep !CONFIG_DISABLE_SIGNALS
|
||||||
test !CONFIG_NSH_DISABLESCRIPT
|
test !CONFIG_NSH_DISABLESCRIPT
|
||||||
umount !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_READABLE
|
umount !CONFIG_DISABLE_MOUNTPOINT && CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_READABLE
|
||||||
@ -1028,10 +1034,10 @@ also allow it to squeeze into very small memory footprints.
|
|||||||
CONFIG_NSH_DISABLE_MV, CONFIG_NSH_DISABLE_NFSMOUNT, CONFIG_NSH_DISABLE_PS,
|
CONFIG_NSH_DISABLE_MV, CONFIG_NSH_DISABLE_NFSMOUNT, CONFIG_NSH_DISABLE_PS,
|
||||||
CONFIG_NSH_DISABLE_PING, CONFIG_NSH_DISABLE_PING6, CONFIG_NSH_DISABLE_PUT,
|
CONFIG_NSH_DISABLE_PING, CONFIG_NSH_DISABLE_PING6, CONFIG_NSH_DISABLE_PUT,
|
||||||
CONFIG_NSH_DISABLE_PWD, CONFIG_NSH_DISABLE_RM, CONFIG_NSH_DISABLE_RMDIR,
|
CONFIG_NSH_DISABLE_PWD, CONFIG_NSH_DISABLE_RM, CONFIG_NSH_DISABLE_RMDIR,
|
||||||
CONFIG_NSH_DISABLE_SET, CONFIG_NSH_DISABLE_SH, CONFIG_NSH_DISABLE_SLEEP,
|
CONFIG_NSH_DISABLE_SET, CONFIG_NSH_DISABLE_SH, CONFIG_NSH_DISABLE_SHUTDOWN,
|
||||||
CONFIG_NSH_DISABLE_TEST, CONFIG_NSH_DISABLE_UMOUNT, CONFIG_NSH_DISABLE_UNSET,
|
CONFIG_NSH_DISABLE_SLEEP, CONFIG_NSH_DISABLE_TEST, CONFIG_NSH_DISABLE_UMOUNT,
|
||||||
CONFIG_NSH_DISABLE_URLDECODE, CONFIG_NSH_DISABLE_URLENCODE, CONFIG_NSH_DISABLE_USLEEP,
|
CONFIG_NSH_DISABLE_UNSET, CONFIG_NSH_DISABLE_URLDECODE, CONFIG_NSH_DISABLE_URLENCODE,
|
||||||
CONFIG_NSH_DISABLE_WGET, CONFIG_NSH_DISABLE_XD
|
CONFIG_NSH_DISABLE_USLEEP, CONFIG_NSH_DISABLE_WGET, CONFIG_NSH_DISABLE_XD
|
||||||
|
|
||||||
Verbose help output can be suppressed by defining CONFIG_NSH_HELP_TERSE. In that
|
Verbose help output can be suppressed by defining CONFIG_NSH_HELP_TERSE. In that
|
||||||
case, the help command is still available but will be slightly smaller.
|
case, the help command is still available but will be slightly smaller.
|
||||||
|
@ -988,6 +988,10 @@ void nsh_usbtrace(void);
|
|||||||
# endif
|
# endif
|
||||||
#endif /* CONFIG_NET */
|
#endif /* CONFIG_NET */
|
||||||
|
|
||||||
|
#if defined(CONFIG_BOARDCTL_POWEROFF) && !defined(CONFIG_NSH_DISABLE_SHUTDOWN)
|
||||||
|
int cmd_shutdown(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef CONFIG_DISABLE_ENVIRON
|
#ifndef CONFIG_DISABLE_ENVIRON
|
||||||
# ifndef CONFIG_NSH_DISABLE_SET
|
# ifndef CONFIG_NSH_DISABLE_SET
|
||||||
int cmd_set(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
int cmd_set(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv);
|
||||||
|
@ -369,6 +369,10 @@ static const struct cmdmap_s g_cmdmap[] =
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_BOARDCTL_POWEROFF) && !defined(CONFIG_NSH_DISABLE_SHUTDOWN)
|
||||||
|
{ "shutdown", cmd_shutdown, 1, 1, NULL },
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef CONFIG_DISABLE_SIGNALS
|
#ifndef CONFIG_DISABLE_SIGNALS
|
||||||
# ifndef CONFIG_NSH_DISABLE_SLEEP
|
# ifndef CONFIG_NSH_DISABLE_SLEEP
|
||||||
{ "sleep", cmd_sleep, 2, 2, "<sec>" },
|
{ "sleep", cmd_sleep, 2, 2, "<sec>" },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user