diff options
author | Thomas Jarosch <tomj@simonv.com> | 2011-02-15 19:43:04 +0000 |
---|---|---|
committer | Thomas Jarosch <tomj@simonv.com> | 2011-02-15 19:43:04 +0000 |
commit | 258626f4550be2e586c9e5acf20cb71ee001a8e4 (patch) | |
tree | 24659c17ed31eac362056253392c960898540899 | |
parent | 1f85259ef15e51fa912324b635e2474aff4c0a0f (diff) | |
download | rockbox-258626f4550be2e586c9e5acf20cb71ee001a8e4.tar.gz rockbox-258626f4550be2e586c9e5acf20cb71ee001a8e4.zip |
Fix the shutdown sequence for maemo, SDL and simulator builds
Do proper shutdown in RaaA builds like writeout of
last.FM scrobbler file and other neat things.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29309 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/misc.c | 2 | ||||
-rw-r--r-- | firmware/target/hosted/maemo/maemo-thread.c | 6 | ||||
-rw-r--r-- | firmware/target/hosted/sdl/button-sdl.c | 5 | ||||
-rw-r--r-- | uisimulator/common/powermgmt-sim.c | 6 |
4 files changed, 18 insertions, 1 deletions
diff --git a/apps/misc.c b/apps/misc.c index a08dac3ebf..b2f1df52f3 100644 --- a/apps/misc.c +++ b/apps/misc.c | |||
@@ -256,7 +256,7 @@ static void system_restore(void) | |||
256 | 256 | ||
257 | static bool clean_shutdown(void (*callback)(void *), void *parameter) | 257 | static bool clean_shutdown(void (*callback)(void *), void *parameter) |
258 | { | 258 | { |
259 | #if (CONFIG_PLATFORM & PLATFORM_HOSTED) | 259 | #if (CONFIG_PLATFORM & PLATFORM_ANDROID) |
260 | (void)callback; | 260 | (void)callback; |
261 | (void)parameter; | 261 | (void)parameter; |
262 | bookmark_autobookmark(false); | 262 | bookmark_autobookmark(false); |
diff --git a/firmware/target/hosted/maemo/maemo-thread.c b/firmware/target/hosted/maemo/maemo-thread.c index f655ed597e..6593a9faa5 100644 --- a/firmware/target/hosted/maemo/maemo-thread.c +++ b/firmware/target/hosted/maemo/maemo-thread.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <libhal.h> | 23 | #include <libhal.h> |
24 | #include <libosso.h> | 24 | #include <libosso.h> |
25 | #include <SDL_thread.h> | 25 | #include <SDL_thread.h> |
26 | #include <SDL_events.h> | ||
26 | 27 | ||
27 | #include "config.h" | 28 | #include "config.h" |
28 | #include "system.h" | 29 | #include "system.h" |
@@ -213,6 +214,11 @@ void reset_poweroff_timer(void) | |||
213 | 214 | ||
214 | void shutdown_hw(void) | 215 | void shutdown_hw(void) |
215 | { | 216 | { |
217 | /* Shut down SDL event loop */ | ||
218 | SDL_Event event; | ||
219 | memset(&event, 0, sizeof(SDL_Event)); | ||
220 | event.type = SDL_USEREVENT; | ||
221 | SDL_PushEvent(&event); | ||
216 | } | 222 | } |
217 | 223 | ||
218 | void cancel_shutdown(void) | 224 | void cancel_shutdown(void) |
diff --git a/firmware/target/hosted/sdl/button-sdl.c b/firmware/target/hosted/sdl/button-sdl.c index 25dad09341..9c8188a12f 100644 --- a/firmware/target/hosted/sdl/button-sdl.c +++ b/firmware/target/hosted/sdl/button-sdl.c | |||
@@ -261,7 +261,12 @@ static bool event_handler(SDL_Event *event) | |||
261 | break; | 261 | break; |
262 | } | 262 | } |
263 | case SDL_QUIT: | 263 | case SDL_QUIT: |
264 | /* Post SYS_POWEROFF event. Will post SDL_USEREVENT in shutdown_hw() if successful. */ | ||
265 | queue_broadcast(SYS_POWEROFF, 0); | ||
266 | break; | ||
267 | case SDL_USEREVENT: | ||
264 | return true; | 268 | return true; |
269 | break; | ||
265 | } | 270 | } |
266 | 271 | ||
267 | return false; | 272 | return false; |
diff --git a/uisimulator/common/powermgmt-sim.c b/uisimulator/common/powermgmt-sim.c index dbd3149fbb..30b04d6a0b 100644 --- a/uisimulator/common/powermgmt-sim.c +++ b/uisimulator/common/powermgmt-sim.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <time.h> | 24 | #include <time.h> |
25 | #include "kernel.h" | 25 | #include "kernel.h" |
26 | #include "powermgmt.h" | 26 | #include "powermgmt.h" |
27 | #include <SDL_events.h> | ||
27 | 28 | ||
28 | #define BATT_MINMVOLT 2500 /* minimum millivolts of battery */ | 29 | #define BATT_MINMVOLT 2500 /* minimum millivolts of battery */ |
29 | #define BATT_MAXMVOLT 4500 /* maximum millivolts of battery */ | 30 | #define BATT_MAXMVOLT 4500 /* maximum millivolts of battery */ |
@@ -155,6 +156,11 @@ void reset_poweroff_timer(void) | |||
155 | 156 | ||
156 | void shutdown_hw(void) | 157 | void shutdown_hw(void) |
157 | { | 158 | { |
159 | /* Shut down SDL event loop */ | ||
160 | SDL_Event event; | ||
161 | memset(&event, 0, sizeof(SDL_Event)); | ||
162 | event.type = SDL_USEREVENT; | ||
163 | SDL_PushEvent(&event); | ||
158 | } | 164 | } |
159 | 165 | ||
160 | void cancel_shutdown(void) | 166 | void cancel_shutdown(void) |