Modify board_power_off() so that is is called only via boardctl()
This commit is contained in:
parent
8f16c5d32d
commit
e297b94eae
@ -6,6 +6,8 @@
|
|||||||
config SYSTEM_POWEROFF
|
config SYSTEM_POWEROFF
|
||||||
bool "Power-Off"
|
bool "Power-Off"
|
||||||
default n
|
default n
|
||||||
|
depends on LIB_BOARDCTL
|
||||||
|
select BOARDCTL_POWEROFF
|
||||||
---help---
|
---help---
|
||||||
Enable support for the NSH poweroff command. NOTE: This option
|
Enable support for the NSH poweroff command. NOTE: This option
|
||||||
provides the NSH power-off command only. It requires board-specific
|
provides the NSH power-off command only. It requires board-specific
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
* Included Files
|
* Included Files
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <nuttx/board.h>
|
#include <sys/boardctl.h>
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
@ -49,24 +49,10 @@ int main(int argc, FAR char *argv[])
|
|||||||
int poweroff_main(int argc, char *argv[])
|
int poweroff_main(int argc, char *argv[])
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
/* TODO:
|
/* Invoide the BOARDIOC_POWEROFF board control to shutdown the board
|
||||||
* - replace this by sending general system signal to shutdown, where i.e. nsh
|
* If board_power_off function returns, then it was not possible to power-off the
|
||||||
* 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
|
|
||||||
* board due to some constraints.
|
* board due to some constraints.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return 0;
|
return boardctl(BOARDIOC_POWEROFF, 0);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user