summaryrefslogtreecommitdiff
path: root/apps/plugins/plugin_crt0.c
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/plugin_crt0.c
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/plugin_crt0.c')
-rw-r--r--apps/plugins/plugin_crt0.c3
1 files changed, 2 insertions, 1 deletions
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}