1
0
Fork 0
forked from len0rd/rockbox

New feature: clean shutdown if you press OFF twice in the file browser, or select "Shut

off" in the main menu. Players only have the menu option, due to lack of keys.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4940 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2004-07-24 21:26:41 +00:00
parent 6b8d020876
commit 5b5003dcb1
9 changed files with 113 additions and 13 deletions

View file

@ -17,6 +17,7 @@
*
****************************************************************************/
#include <ctype.h>
#include "lang.h"
#include "string.h"
#include "config.h"
#include "file.h"
@ -25,6 +26,13 @@
#include "errno.h"
#include "system.h"
#include "timefuncs.h"
#include "screens.h"
#include "mpeg.h"
#include "mp3_playback.h"
#include "settings.h"
#include "ata.h"
#include "kernel.h"
#include "power.h"
#define ONE_KILOBYTE 1024
#define ONE_MEGABYTE (1024*1024)
@ -204,3 +212,23 @@ bool settings_parseline(char* line, char** name, char** value)
*value = ptr;
return true;
}
bool clean_shutdown(void)
{
lcd_clear_display();
splash(0, true, str(LANG_SHUTTINGDOWN));
mpeg_stop();
settings_save();
ata_flush();
ata_spindown(1);
#ifndef SIMULATOR
while(ata_disk_is_active())
sleep(HZ/10);
if(!charger_inserted())
{
mp3_shutdown();
power_off();
}
#endif
return false;
}