forked from len0rd/rockbox
New poweroff handling, using the SYS_POWEROFF event, allowing plugins to save their settings before powering off.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7019 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
839dbcaed7
commit
6e80ac39a5
4 changed files with 21 additions and 8 deletions
|
|
@ -361,6 +361,13 @@ bool info_menu(void)
|
|||
return result;
|
||||
}
|
||||
|
||||
#ifdef HAVE_LCD_CHARCELLS
|
||||
static void do_shutdown(void)
|
||||
{
|
||||
sys_poweroff(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool main_menu(void)
|
||||
{
|
||||
int m;
|
||||
|
|
@ -405,7 +412,7 @@ bool main_menu(void)
|
|||
|
||||
#ifdef HAVE_LCD_CHARCELLS
|
||||
items[i].desc = ID2P(LANG_SHUTDOWN);
|
||||
items[i++].function = clean_shutdown;
|
||||
items[i++].function = do_shutdown;
|
||||
#endif
|
||||
|
||||
m=menu_init( items, i, NULL, NULL, NULL, NULL );
|
||||
|
|
|
|||
|
|
@ -1253,7 +1253,7 @@ bool shutdown_screen(void)
|
|||
switch(button)
|
||||
{
|
||||
case BUTTON_OFF:
|
||||
clean_shutdown();
|
||||
sys_poweroff(false);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -130,5 +130,6 @@ int get_sleep_timer(void);
|
|||
void set_car_adapter_mode(bool setting);
|
||||
void reset_poweroff_timer(void);
|
||||
void shutdown_hw(void);
|
||||
void sys_poweroff(bool halt);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
#ifdef HAVE_UDA1380
|
||||
#include "uda1380.h"
|
||||
#endif
|
||||
#include "logf.h"
|
||||
|
||||
/*
|
||||
* Define DEBUG_FILE to create a csv (spreadsheet) with battery information
|
||||
|
|
@ -389,7 +390,7 @@ static void handle_auto_poweroff(void)
|
|||
if(TIME_AFTER(current_tick, last_event_tick + timeout) &&
|
||||
TIME_AFTER(current_tick, last_disk_activity + timeout))
|
||||
{
|
||||
shutdown_hw();
|
||||
sys_poweroff(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -412,11 +413,7 @@ static void handle_auto_poweroff(void)
|
|||
#endif
|
||||
{
|
||||
DEBUGF("Sleep timer timeout. Shutting off...\n");
|
||||
/* Make sure that the disk isn't spinning when
|
||||
we cut the power */
|
||||
while(ata_disk_is_active())
|
||||
sleep(HZ);
|
||||
shutdown_hw();
|
||||
sys_poweroff(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -877,6 +874,14 @@ void powermgmt_init(void)
|
|||
|
||||
#endif /* SIMULATOR */
|
||||
|
||||
void sys_poweroff(bool halt)
|
||||
{
|
||||
logf("sys_poweroff(%d)", halt);
|
||||
queue_post(&button_queue, SYS_POWEROFF, NULL);
|
||||
while(halt)
|
||||
yield();
|
||||
}
|
||||
|
||||
/* Various hardware housekeeping tasks relating to shutting down the jukebox */
|
||||
void shutdown_hw(void)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue