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.zip rockbox-258626f4550be2e586c9e5acf20cb71ee001a8e4.tar.gz rockbox-258626f4550be2e586c9e5acf20cb71ee001a8e4.tar.bz2 rockbox-258626f4550be2e586c9e5acf20cb71ee001a8e4.tar.xz | |
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 a08dac3..b2f1df5 100644 --- a/apps/misc.c +++ b/apps/misc.c @@ -256,7 +256,7 @@ static void system_restore(void) static bool clean_shutdown(void (*callback)(void *), void *parameter) { -#if (CONFIG_PLATFORM & PLATFORM_HOSTED) +#if (CONFIG_PLATFORM & PLATFORM_ANDROID) (void)callback; (void)parameter; bookmark_autobookmark(false); diff --git a/firmware/target/hosted/maemo/maemo-thread.c b/firmware/target/hosted/maemo/maemo-thread.c index f655ed5..6593a9f 100644 --- a/firmware/target/hosted/maemo/maemo-thread.c +++ b/firmware/target/hosted/maemo/maemo-thread.c @@ -23,6 +23,7 @@ #include <libhal.h> #include <libosso.h> #include <SDL_thread.h> +#include <SDL_events.h> #include "config.h" #include "system.h" @@ -213,6 +214,11 @@ void reset_poweroff_timer(void) void shutdown_hw(void) { + /* Shut down SDL event loop */ + SDL_Event event; + memset(&event, 0, sizeof(SDL_Event)); + event.type = SDL_USEREVENT; + SDL_PushEvent(&event); } void cancel_shutdown(void) diff --git a/firmware/target/hosted/sdl/button-sdl.c b/firmware/target/hosted/sdl/button-sdl.c index 25dad09..9c8188a 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) break; } case SDL_QUIT: + /* Post SYS_POWEROFF event. Will post SDL_USEREVENT in shutdown_hw() if successful. */ + queue_broadcast(SYS_POWEROFF, 0); + break; + case SDL_USEREVENT: return true; + break; } return false; diff --git a/uisimulator/common/powermgmt-sim.c b/uisimulator/common/powermgmt-sim.c index dbd3149..30b04d6 100644 --- a/uisimulator/common/powermgmt-sim.c +++ b/uisimulator/common/powermgmt-sim.c @@ -24,6 +24,7 @@ #include <time.h> #include "kernel.h" #include "powermgmt.h" +#include <SDL_events.h> #define BATT_MINMVOLT 2500 /* minimum millivolts of battery */ #define BATT_MAXMVOLT 4500 /* maximum millivolts of battery */ @@ -155,6 +156,11 @@ void reset_poweroff_timer(void) void shutdown_hw(void) { + /* Shut down SDL event loop */ + SDL_Event event; + memset(&event, 0, sizeof(SDL_Event)); + event.type = SDL_USEREVENT; + SDL_PushEvent(&event); } void cancel_shutdown(void) |