summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2022-04-16 14:25:49 +0100
committerAidan MacDonald <amachronic@protonmail.com>2022-04-16 14:36:39 +0100
commitd55dceff371c4080d179fb26e6f175927cc48768 (patch)
tree65598ecdc8142d4178b1f8b13dce37e871cc7016 /apps/plugins
parent90960adf56d4798a23b8fdc7e6a9bb25dd0bf530 (diff)
downloadrockbox-d55dceff371c4080d179fb26e6f175927cc48768.tar.gz
rockbox-d55dceff371c4080d179fb26e6f175927cc48768.zip
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
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/battery_bench.c1
-rw-r--r--apps/plugins/chessbox/chessbox.c3
-rw-r--r--apps/plugins/lastfm_scrobbler.c1
-rw-r--r--apps/plugins/lua/rocklib.c1
-rw-r--r--apps/plugins/mpegplayer/mpeg_misc.c1
-rw-r--r--apps/plugins/plugin_crt0.c3
-rw-r--r--apps/plugins/solitaire.c1
7 files changed, 10 insertions, 1 deletions
diff --git a/apps/plugins/battery_bench.c b/apps/plugins/battery_bench.c
index d8e29d73ca..17d3b918cf 100644
--- a/apps/plugins/battery_bench.c
+++ b/apps/plugins/battery_bench.c
@@ -462,6 +462,7 @@ static void thread(void)
462 in_usb_mode = false; 462 in_usb_mode = false;
463 break; 463 break;
464 case SYS_POWEROFF: 464 case SYS_POWEROFF:
465 case SYS_REBOOT:
465 exit_reason = "power off"; 466 exit_reason = "power off";
466 exit = true; 467 exit = true;
467 break; 468 break;
diff --git a/apps/plugins/chessbox/chessbox.c b/apps/plugins/chessbox/chessbox.c
index 13df4f177e..089cf7c400 100644
--- a/apps/plugins/chessbox/chessbox.c
+++ b/apps/plugins/chessbox/chessbox.c
@@ -222,6 +222,7 @@ static void cb_wt_callback ( void ) {
222 button = rb->button_get(false); 222 button = rb->button_get(false);
223 switch (button) { 223 switch (button) {
224 case SYS_POWEROFF: 224 case SYS_POWEROFF:
225 case SYS_REBOOT:
225 cb_sysevent = button; 226 cb_sysevent = button;
226#ifdef CB_RC_QUIT 227#ifdef CB_RC_QUIT
227 case CB_RC_QUIT: 228 case CB_RC_QUIT:
@@ -585,6 +586,7 @@ static struct cb_command cb_get_viewer_command (void) {
585 button = rb->button_get(true); 586 button = rb->button_get(true);
586 switch (button) { 587 switch (button) {
587 case SYS_POWEROFF: 588 case SYS_POWEROFF:
589 case SYS_REBOOT:
588 cb_sysevent = button; 590 cb_sysevent = button;
589#ifdef CB_RC_QUIT 591#ifdef CB_RC_QUIT
590 case CB_RC_QUIT: 592 case CB_RC_QUIT:
@@ -848,6 +850,7 @@ static struct cb_command cb_getcommand (void) {
848 button = rb->button_get(true); 850 button = rb->button_get(true);
849 switch (button) { 851 switch (button) {
850 case SYS_POWEROFF: 852 case SYS_POWEROFF:
853 case SYS_REBOOT:
851 cb_sysevent = button; 854 cb_sysevent = button;
852#ifdef CB_RC_QUIT 855#ifdef CB_RC_QUIT
853 case CB_RC_QUIT: 856 case CB_RC_QUIT:
diff --git a/apps/plugins/lastfm_scrobbler.c b/apps/plugins/lastfm_scrobbler.c
index 4d4940945d..7bd213b6d2 100644
--- a/apps/plugins/lastfm_scrobbler.c
+++ b/apps/plugins/lastfm_scrobbler.c
@@ -490,6 +490,7 @@ void thread(void)
490 rb->beep_play(1500, 100, 1000); 490 rb->beep_play(1500, 100, 1000);
491 break; 491 break;
492 case SYS_POWEROFF: 492 case SYS_POWEROFF:
493 case SYS_REBOOT:
493 gCache.force_flush = true; 494 gCache.force_flush = true;
494 /*fall through*/ 495 /*fall through*/
495 case EV_EXIT: 496 case EV_EXIT:
diff --git a/apps/plugins/lua/rocklib.c b/apps/plugins/lua/rocklib.c
index 6131a479db..cadc8be6ac 100644
--- a/apps/plugins/lua/rocklib.c
+++ b/apps/plugins/lua/rocklib.c
@@ -1090,6 +1090,7 @@ LUALIB_API int luaopen_rock(lua_State *L)
1090 RB_CONSTANT(SYS_USB_DISCONNECTED), 1090 RB_CONSTANT(SYS_USB_DISCONNECTED),
1091 RB_CONSTANT(SYS_TIMEOUT), 1091 RB_CONSTANT(SYS_TIMEOUT),
1092 RB_CONSTANT(SYS_POWEROFF), 1092 RB_CONSTANT(SYS_POWEROFF),
1093 RB_CONSTANT(SYS_REBOOT),
1093 RB_CONSTANT(SYS_CHARGER_CONNECTED), 1094 RB_CONSTANT(SYS_CHARGER_CONNECTED),
1094 RB_CONSTANT(SYS_CHARGER_DISCONNECTED), 1095 RB_CONSTANT(SYS_CHARGER_DISCONNECTED),
1095 1096
diff --git a/apps/plugins/mpegplayer/mpeg_misc.c b/apps/plugins/mpegplayer/mpeg_misc.c
index c85285f4f8..31f0644212 100644
--- a/apps/plugins/mpegplayer/mpeg_misc.c
+++ b/apps/plugins/mpegplayer/mpeg_misc.c
@@ -192,6 +192,7 @@ int mpeg_sysevent_callback(int btn,
192 { 192 {
193 case SYS_USB_CONNECTED: 193 case SYS_USB_CONNECTED:
194 case SYS_POWEROFF: 194 case SYS_POWEROFF:
195 case SYS_REBOOT:
195 mpeg_sysevent_id = btn; 196 mpeg_sysevent_id = btn;
196 return ACTION_STD_CANCEL; 197 return ACTION_STD_CANCEL;
197 } 198 }
diff --git a/apps/plugins/plugin_crt0.c b/apps/plugins/plugin_crt0.c
index 680bb0723d..5564c5575f 100644
--- a/apps/plugins/plugin_crt0.c
+++ b/apps/plugins/plugin_crt0.c
@@ -141,6 +141,7 @@ void exit_on_usb(int button)
141 long result = rb->default_event_handler_ex(button, cleanup_wrapper, NULL); 141 long result = rb->default_event_handler_ex(button, cleanup_wrapper, NULL);
142 if (result == SYS_USB_CONNECTED) 142 if (result == SYS_USB_CONNECTED)
143 _exit(PLUGIN_USB_CONNECTED); 143 _exit(PLUGIN_USB_CONNECTED);
144 else if (result == SYS_POWEROFF) 144 else if (result == SYS_POWEROFF || result == SYS_REBOOT)
145 /* note: nobody actually pays attention to this exit code */
145 _exit(PLUGIN_POWEROFF); 146 _exit(PLUGIN_POWEROFF);
146} 147}
diff --git a/apps/plugins/solitaire.c b/apps/plugins/solitaire.c
index b1ede16f90..ebc042f6db 100644
--- a/apps/plugins/solitaire.c
+++ b/apps/plugins/solitaire.c
@@ -2149,6 +2149,7 @@ static int solitaire( int skipmenu )
2149 break; 2149 break;
2150 2150
2151 case SYS_POWEROFF: 2151 case SYS_POWEROFF:
2152 case SYS_REBOOT:
2152 return SOLITAIRE_SAVE_AND_QUIT; 2153 return SOLITAIRE_SAVE_AND_QUIT;
2153 2154
2154 default: 2155 default: