diff --git a/system/poweroff/Kconfig b/system/poweroff/Kconfig index 8a8ed80b1..66227548f 100644 --- a/system/poweroff/Kconfig +++ b/system/poweroff/Kconfig @@ -6,6 +6,8 @@ config SYSTEM_POWEROFF bool "Power-Off" default n + depends on LIB_BOARDCTL + select BOARDCTL_POWEROFF ---help--- Enable support for the NSH poweroff command. NOTE: This option provides the NSH power-off command only. It requires board-specific diff --git a/system/poweroff/poweroff.c b/system/poweroff/poweroff.c index fe27ab331..a3f1a9dbb 100644 --- a/system/poweroff/poweroff.c +++ b/system/poweroff/poweroff.c @@ -37,7 +37,7 @@ * Included Files ****************************************************************************/ -#include +#include /**************************************************************************** * Public Functions @@ -49,24 +49,10 @@ int main(int argc, FAR char *argv[]) int poweroff_main(int argc, char *argv[]) #endif { - /* TODO: - * - replace this by sending general system signal to shutdown, where i.e. nsh - * must issue down script (it may check whether nsh is running before spawning - * a new process with nsh poweroff) - * - wait for some time (~0.5 second for VSN), that SDcard is flashed and synced - * - call poweroff - * - * TODO on boot: - * - if external key is pressed, do not start the nsh! but wait until it is released - * (to get rid of bad mounts of the sdcard etc.) this could be handled in the - * button driver immediately on system boot - */ - - board_power_off(); - - /* If board_power_off function returns, then it was not possible to power-off the + /* Invoide the BOARDIOC_POWEROFF board control to shutdown the board + * If board_power_off function returns, then it was not possible to power-off the * board due to some constraints. */ - return 0; + return boardctl(BOARDIOC_POWEROFF, 0); }