mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-08 12:45:26 -05:00
apps: Add ability to do a clean reboot
Allow a clean shutdown to end in either power off or reboot. Add a new event SYS_REBOOT to signal it and sys_reboot() to trigger the event. SYS_REBOOT signals a reboot request and should be listened for alongside SYS_POWEROFF events. Change-Id: I99ba7fb5feed2bb5a0a40a274e8466ad74fe3a43
This commit is contained in:
parent
90960adf56
commit
d55dceff37
15 changed files with 72 additions and 14 deletions
|
|
@ -462,6 +462,7 @@ static void thread(void)
|
|||
in_usb_mode = false;
|
||||
break;
|
||||
case SYS_POWEROFF:
|
||||
case SYS_REBOOT:
|
||||
exit_reason = "power off";
|
||||
exit = true;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -222,6 +222,7 @@ static void cb_wt_callback ( void ) {
|
|||
button = rb->button_get(false);
|
||||
switch (button) {
|
||||
case SYS_POWEROFF:
|
||||
case SYS_REBOOT:
|
||||
cb_sysevent = button;
|
||||
#ifdef CB_RC_QUIT
|
||||
case CB_RC_QUIT:
|
||||
|
|
@ -585,6 +586,7 @@ static struct cb_command cb_get_viewer_command (void) {
|
|||
button = rb->button_get(true);
|
||||
switch (button) {
|
||||
case SYS_POWEROFF:
|
||||
case SYS_REBOOT:
|
||||
cb_sysevent = button;
|
||||
#ifdef CB_RC_QUIT
|
||||
case CB_RC_QUIT:
|
||||
|
|
@ -848,6 +850,7 @@ static struct cb_command cb_getcommand (void) {
|
|||
button = rb->button_get(true);
|
||||
switch (button) {
|
||||
case SYS_POWEROFF:
|
||||
case SYS_REBOOT:
|
||||
cb_sysevent = button;
|
||||
#ifdef CB_RC_QUIT
|
||||
case CB_RC_QUIT:
|
||||
|
|
|
|||
|
|
@ -490,6 +490,7 @@ void thread(void)
|
|||
rb->beep_play(1500, 100, 1000);
|
||||
break;
|
||||
case SYS_POWEROFF:
|
||||
case SYS_REBOOT:
|
||||
gCache.force_flush = true;
|
||||
/*fall through*/
|
||||
case EV_EXIT:
|
||||
|
|
|
|||
|
|
@ -1090,6 +1090,7 @@ LUALIB_API int luaopen_rock(lua_State *L)
|
|||
RB_CONSTANT(SYS_USB_DISCONNECTED),
|
||||
RB_CONSTANT(SYS_TIMEOUT),
|
||||
RB_CONSTANT(SYS_POWEROFF),
|
||||
RB_CONSTANT(SYS_REBOOT),
|
||||
RB_CONSTANT(SYS_CHARGER_CONNECTED),
|
||||
RB_CONSTANT(SYS_CHARGER_DISCONNECTED),
|
||||
|
||||
|
|
|
|||
|
|
@ -192,6 +192,7 @@ int mpeg_sysevent_callback(int btn,
|
|||
{
|
||||
case SYS_USB_CONNECTED:
|
||||
case SYS_POWEROFF:
|
||||
case SYS_REBOOT:
|
||||
mpeg_sysevent_id = btn;
|
||||
return ACTION_STD_CANCEL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,6 +141,7 @@ void exit_on_usb(int button)
|
|||
long result = rb->default_event_handler_ex(button, cleanup_wrapper, NULL);
|
||||
if (result == SYS_USB_CONNECTED)
|
||||
_exit(PLUGIN_USB_CONNECTED);
|
||||
else if (result == SYS_POWEROFF)
|
||||
else if (result == SYS_POWEROFF || result == SYS_REBOOT)
|
||||
/* note: nobody actually pays attention to this exit code */
|
||||
_exit(PLUGIN_POWEROFF);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2149,6 +2149,7 @@ static int solitaire( int skipmenu )
|
|||
break;
|
||||
|
||||
case SYS_POWEROFF:
|
||||
case SYS_REBOOT:
|
||||
return SOLITAIRE_SAVE_AND_QUIT;
|
||||
|
||||
default:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue