Index: flash/bootbox/main.c =================================================================== --- flash/bootbox/main.c (revision 17395) +++ flash/bootbox/main.c (working copy) @@ -138,9 +138,9 @@ { button = button_get(true); if (button == SYS_POWEROFF) - { power_off(); - } + else if (button == SYS_REBOOT) + system_reboot(); } while (button != SYS_USB_CONNECTED); usb_screen(); system_reboot(); Index: apps/screens.c =================================================================== --- apps/screens.c (revision 17395) +++ apps/screens.c (working copy) @@ -669,7 +669,7 @@ switch(button) { case ACTION_STD_CANCEL: - sys_poweroff(); + sys_poweroff(false); break; /* do nothing here, because ACTION_NONE might be caused Index: apps/plugins/battery_bench.c =================================================================== --- apps/plugins/battery_bench.c (revision 17395) +++ apps/plugins/battery_bench.c (working copy) @@ -413,6 +413,7 @@ in_usb_mode = false; rb->usb_acknowledge(SYS_USB_DISCONNECTED_ACK); break; + case SYS_REBOOT: case SYS_POWEROFF: exit = 1; break; Index: apps/plugins/solitaire.c =================================================================== --- apps/plugins/solitaire.c (revision 17395) +++ apps/plugins/solitaire.c (working copy) @@ -1816,6 +1816,7 @@ } break; + case SYS_REBOOT: case SYS_POWEROFF: return SOLITAIRE_SAVE_AND_QUIT; Index: apps/plugins/lib/oldmenuapi.c =================================================================== --- apps/plugins/lib/oldmenuapi.c (revision 17395) +++ apps/plugins/lib/oldmenuapi.c (working copy) @@ -115,6 +115,7 @@ case ACTION_STD_CANCEL: case ACTION_STD_MENU: + case SYS_REBOOT: case SYS_POWEROFF: exit = true; break; Index: apps/lang/english.lang =================================================================== --- apps/lang/english.lang (revision 17395) +++ apps/lang/english.lang (working copy) @@ -6847,16 +6847,13 @@ desc: in main menu user: - *: none - soft_shutdown: "Shut down" + *: "Shut down" - *: none - soft_shutdown: "Shut down" + *: "Shut down" - *: none - soft_shutdown: "Shut down" + *: "Shut down" @@ -11688,3 +11685,45 @@ *: "OK" + + id: LANG_POWER + desc: in root menu + user: + + *: "Power" + + + *: "Power" + + + *: "Power" + + + + id: LANG_REBOOT + desc: in power menu + user: + + *: "Reboot" + + + *: "Reboot" + + + *: "Reboot" + + + + id: LANG_REBOOTING + desc: reboot splash + user: + + *: "Rebooting..." + + + *: "Rebooting..." + + + *: "" + + Index: apps/gui/gwps.c =================================================================== --- apps/gui/gwps.c (revision 17395) +++ apps/gui/gwps.c (working copy) @@ -664,6 +664,16 @@ exit = true; break; #endif + case SYS_REBOOT: +#if LCD_DEPTH > 1 + show_main_backdrop(); +#endif +#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 + show_remote_main_backdrop(); +#endif + default_event_handler(SYS_POWEROFF); + break; + case SYS_POWEROFF: #if LCD_DEPTH > 1 show_main_backdrop(); Index: apps/menus/main_menu.c =================================================================== --- apps/menus/main_menu.c (revision 17395) +++ apps/menus/main_menu.c (working copy) @@ -26,6 +26,7 @@ #include "action.h" #include "settings.h" #include "powermgmt.h" +#include "power.h" #include "menu.h" #include "misc.h" #include "exported_menus.h" @@ -416,6 +417,7 @@ } return action; } + static bool show_info(void) { struct info_data data = {.new_data = true }; @@ -463,19 +465,46 @@ &sleep_timer_set, -5, 300, 0, sleep_timer_formatter); } +static int do_shutdown(void) +{ +#if CONFIG_CHARGING + if (charger_inserted()) + charging_splash(); + else +#endif + sys_poweroff(false); + return 0; +} + +static int do_reboot(void) +{ +#if CONFIG_CHARGING + if (charger_inserted()) + charging_splash(); + else +#endif + sys_poweroff(true); + return 0; +} + MENUITEM_FUNCTION(sleep_timer_call, 0, ID2P(LANG_SLEEP_TIMER), sleep_timer, - NULL, NULL, Icon_Menu_setting); /* make it look like a - setting to the user */ + NULL, NULL, Icon_Menu_setting); /* make it look like a + setting to the user */ MENUITEM_FUNCTION(show_credits_item, 0, ID2P(LANG_VERSION), (menu_function)show_credits, NULL, NULL, Icon_NOICON); MENUITEM_FUNCTION(show_runtime_item, 0, ID2P(LANG_RUNNING_TIME), (menu_function)view_runtime, NULL, NULL, Icon_NOICON); MENUITEM_FUNCTION(debug_menu_item, 0, ID2P(LANG_DEBUG), (menu_function)debug_menu, NULL, NULL, Icon_NOICON); +MENUITEM_FUNCTION(do_reboot_item, 0, ID2P(LANG_REBOOT), + (menu_function)do_reboot, NULL, NULL, Icon_NOICON); +MENUITEM_FUNCTION(do_shutdown_item, 0, ID2P(LANG_SHUTDOWN), + (menu_function)do_shutdown, NULL, NULL, Icon_NOICON); MAKE_MENU(info_menu, ID2P(LANG_SYSTEM), 0, Icon_Questionmark, - &show_info_item, &show_credits_item, &show_runtime_item, - &sleep_timer_call, &debug_menu_item); + &show_info_item, &show_credits_item, &show_runtime_item, + &sleep_timer_call, &debug_menu_item, &do_reboot_item, + &do_shutdown_item); /* INFO MENU */ /***********************************/ Index: apps/tagcache.c =================================================================== --- apps/tagcache.c (revision 17395) +++ apps/tagcache.c (working copy) @@ -3659,6 +3659,7 @@ switch (ev.id) { case Q_STOP_SCAN: + case SYS_REBOOT: case SYS_POWEROFF: case SYS_USB_CONNECTED: /* Put the event back into the queue. */ @@ -4367,6 +4368,7 @@ case Q_STOP_SCAN: break ; + case SYS_REBOOT: case SYS_POWEROFF: break ; Index: apps/features.txt =================================================================== --- apps/features.txt (revision 17395) +++ apps/features.txt (working copy) @@ -124,10 +124,6 @@ scrollwheel #endif -#if defined(ARCHOS_RECORDER) || defined(ARCHOS_PLAYER) -soft_shutdown -#endif - #if defined(HAVE_SPDIF_POWER) spdif_power #endif Index: apps/root_menu.c =================================================================== --- apps/root_menu.c (revision 17395) +++ apps/root_menu.c (working copy) @@ -25,13 +25,11 @@ #include "root_menu.h" #include "lang.h" #include "settings.h" -#include "screens.h" #include "kernel.h" #include "debug.h" #include "misc.h" #include "rolo.h" #include "powermgmt.h" -#include "power.h" #include "talk.h" #include "audio.h" #include "hotswap.h" @@ -376,20 +374,7 @@ MENUITEM_RETURNVALUE(bookmarks, ID2P(LANG_BOOKMARK_MENU_RECENT_BOOKMARKS), GO_TO_RECENTBMARKS, item_callback, Icon_Bookmark); -#ifdef HAVE_LCD_CHARCELLS -static int do_shutdown(void) -{ -#if CONFIG_CHARGING - if (charger_inserted()) - charging_splash(); - else -#endif - sys_poweroff(); - return 0; -} -MENUITEM_FUNCTION(do_shutdown_item, 0, ID2P(LANG_SHUTDOWN), - do_shutdown, NULL, NULL, Icon_NOICON); -#endif + MAKE_MENU(root_menu_, ID2P(LANG_ROCKBOX_TITLE), item_callback, Icon_Rockbox, &bookmarks, &file_browser, @@ -403,11 +388,7 @@ #if CONFIG_TUNER &fm, #endif - &playlist_options, &rocks_browser, &info_menu - -#ifdef HAVE_LCD_CHARCELLS - ,&do_shutdown_item -#endif + &playlist_options, &rocks_browser, &info_menu ); int item_callback(int action, const struct menu_item_ex *this_item) Index: apps/misc.c =================================================================== --- apps/misc.c (revision 17395) +++ apps/misc.c (working copy) @@ -643,9 +643,10 @@ tree_restore(); } -static bool clean_shutdown(void (*callback)(void *), void *parameter) +static bool clean_shutdown(bool reboot, void (*callback)(void *), void *parameter) { #ifdef SIMULATOR + (void)reboot; (void)callback; (void)parameter; bookmark_autobookmark(); @@ -678,7 +679,12 @@ } #endif if (battery_level() > 10) - gui_syncsplash(0, str(LANG_SHUTTINGDOWN)); + { + if (reboot) + gui_syncsplash(0, str(LANG_REBOOTING)); + else + gui_syncsplash(0, str(LANG_SHUTTINGDOWN)); + } else { msg_id = LANG_WARNING_BATTERY_LOW; @@ -759,7 +765,7 @@ dircache_disable(); #endif - shutdown_hw(); + shutdown_hw(reboot); } #endif return false; @@ -948,9 +954,13 @@ } return SYS_USB_CONNECTED; case SYS_POWEROFF: - if (!clean_shutdown(callback, parameter)) + if (!clean_shutdown(false, callback, parameter)) return SYS_POWEROFF; break; + case SYS_REBOOT: + if (!clean_shutdown(true, callback, parameter)) + return SYS_REBOOT; + break; #if CONFIG_CHARGING case SYS_CHARGER_CONNECTED: car_adapter_mode_processing(true); Index: firmware/export/kernel.h =================================================================== --- firmware/export/kernel.h (revision 17395) +++ firmware/export/kernel.h (working copy) @@ -63,9 +63,10 @@ #define SYS_USB_DISCONNECTED MAKE_SYS_EVENT(SYS_EVENT_CLS_USB, 2) #define SYS_USB_DISCONNECTED_ACK MAKE_SYS_EVENT(SYS_EVENT_CLS_USB, 3) #define SYS_POWEROFF MAKE_SYS_EVENT(SYS_EVENT_CLS_POWER, 0) -#define SYS_CHARGER_CONNECTED MAKE_SYS_EVENT(SYS_EVENT_CLS_POWER, 1) -#define SYS_CHARGER_DISCONNECTED MAKE_SYS_EVENT(SYS_EVENT_CLS_POWER, 2) -#define SYS_BATTERY_UPDATE MAKE_SYS_EVENT(SYS_EVENT_CLS_POWER, 3) +#define SYS_REBOOT MAKE_SYS_EVENT(SYS_EVENT_CLS_POWER, 1) +#define SYS_CHARGER_CONNECTED MAKE_SYS_EVENT(SYS_EVENT_CLS_POWER, 2) +#define SYS_CHARGER_DISCONNECTED MAKE_SYS_EVENT(SYS_EVENT_CLS_POWER, 3) +#define SYS_BATTERY_UPDATE MAKE_SYS_EVENT(SYS_EVENT_CLS_POWER, 4) #define SYS_FS_CHANGED MAKE_SYS_EVENT(SYS_EVENT_CLS_FILESYS, 0) #define SYS_HOTSWAP_INSERTED MAKE_SYS_EVENT(SYS_EVENT_CLS_PLUG, 0) #define SYS_HOTSWAP_EXTRACTED MAKE_SYS_EVENT(SYS_EVENT_CLS_PLUG, 1) Index: firmware/export/powermgmt.h =================================================================== --- firmware/export/powermgmt.h (revision 17395) +++ firmware/export/powermgmt.h (working copy) @@ -180,8 +180,8 @@ void set_car_adapter_mode(bool setting); void reset_poweroff_timer(void); void cancel_shutdown(void); -void shutdown_hw(void); -void sys_poweroff(void); +void shutdown_hw(bool reboot); +void sys_poweroff(bool reboot); #ifdef HAVE_ACCESSORY_SUPPLY void accessory_supply_set(bool); #endif Index: firmware/backlight.c =================================================================== --- firmware/backlight.c (revision 17395) +++ firmware/backlight.c (working copy) @@ -536,6 +536,7 @@ break; #endif + case SYS_REBOOT: case SYS_POWEROFF: /* Lock backlight on poweroff so it doesn't */ locked = true; /* go off before power is actually cut. */ /* fall through */ Index: firmware/target/coldfire/iaudio/pcf50606-iaudio.c =================================================================== --- firmware/target/coldfire/iaudio/pcf50606-iaudio.c (revision 17395) +++ firmware/target/coldfire/iaudio/pcf50606-iaudio.c (working copy) @@ -115,7 +115,7 @@ { /* ONKEY1S */ if (GPIO_READ & 0x02000000) - sys_poweroff(); /* main ONKEY */ + sys_poweroff(false); /* main ONKEY */ else pcf50606_reset_timeout(); /* remote ONKEY */ } Index: firmware/powermgmt.c =================================================================== --- firmware/powermgmt.c (revision 17588) +++ firmware/powermgmt.c (working copy) @@ -437,7 +437,7 @@ if(battery_millivolts < battery_level_shutoff[battery_type]) { if(!shutdown_timeout) { backlight_on(); - sys_poweroff(); + sys_poweroff(false); } } #endif @@ -454,7 +454,7 @@ if(TIME_AFTER(current_tick, last_event_tick + timeout) && TIME_AFTER(current_tick, last_disk_activity + timeout)) { - sys_poweroff(); + sys_poweroff(false); } } else @@ -477,7 +477,7 @@ #endif { DEBUGF("Sleep timer timeout. Shutting off...\n"); - sys_poweroff(); + sys_poweroff(false); } } } @@ -1037,7 +1037,7 @@ #ifndef NO_LOW_BATTERY_SHUTDOWN if (!shutdown_timeout && (battery_millivolts < battery_level_shutoff[battery_type])) - sys_poweroff(); + sys_poweroff(false); else #endif avgbat += battery_millivolts - (avgbat / BATT_AVE_SAMPLES); @@ -1108,7 +1108,7 @@ #endif /* SIMULATOR */ -void sys_poweroff(void) +void sys_poweroff(bool reboot) { logf("sys_poweroff()"); /* If the main thread fails to shut down the system, we will force a @@ -1125,7 +1125,10 @@ shutdown_timeout += HZ*20; } - queue_broadcast(SYS_POWEROFF, 0); + if (reboot) + queue_broadcast(SYS_REBOOT, 0); + else + queue_broadcast(SYS_POWEROFF, 0); } void cancel_shutdown(void) @@ -1142,14 +1145,19 @@ } /* Various hardware housekeeping tasks relating to shutting down the jukebox */ -void shutdown_hw(void) +void shutdown_hw(bool reboot) { #ifndef SIMULATOR charging_algorithm_close(); audio_stop(); if (battery_level_safe()) { /* do not save on critical battery */ #ifdef HAVE_LCD_BITMAP - glyph_cache_save(); + int i = FONT_UI; /* Skip sysfont, even though glyph_cache_save() would ignore it */ + while (i < MAXFONTS) + { + glyph_cache_save(i); + i++; + } #endif if(ata_disk_is_active()) ata_spindown(1); @@ -1182,8 +1190,11 @@ eeprom chips are quite slow and might be still writing the last byte. */ sleep(HZ/4); - power_off(); -#endif /* #ifndef SIMULATOR */ + if (reboot) + system_reboot(); + else + power_off(); +#endif /* #ifdef SIMULATOR */ } /* Send system battery level update events on reaching certain significant Index: firmware/drivers/button.c =================================================================== --- firmware/drivers/button.c (revision 17395) +++ firmware/drivers/button.c (working copy) @@ -202,7 +202,7 @@ { /* Tell the main thread that it's time to power off */ - sys_poweroff(); + sys_poweroff(false); /* Safety net for players without hardware poweroff */