Index: flash/bootbox/main.c
===================================================================
--- flash/bootbox/main.c (revision 19302)
+++ flash/bootbox/main.c (working copy)
@@ -132,9 +132,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 19302)
+++ apps/screens.c (working copy)
@@ -675,7 +675,7 @@
switch(button)
{
case ACTION_STD_CANCEL:
- sys_poweroff();
+ sys_poweroff(false);
break;
/* do nothing here, because ACTION_NONE might be caused
Index: apps/recorder/recording.c
===================================================================
--- apps/recorder/recording.c (revision 19302)
+++ apps/recorder/recording.c (working copy)
@@ -680,7 +680,7 @@
#if CONFIG_CODEC == SWCODEC
audio_close_recording();
#endif
- sys_poweroff();
+ sys_poweroff(false);
break;
case RECORDING_CMD_STOP:
pm_activate_clipcount(false);
Index: apps/plugins/battery_bench.c
===================================================================
--- apps/plugins/battery_bench.c (revision 19302)
+++ apps/plugins/battery_bench.c (working copy)
@@ -370,6 +370,7 @@
in_usb_mode = false;
rb->usb_acknowledge(SYS_USB_DISCONNECTED_ACK);
break;
+ case SYS_REBOOT:
case SYS_POWEROFF:
exit_reason = "power off";
exit = true;
Index: apps/plugins/solitaire.c
===================================================================
--- apps/plugins/solitaire.c (revision 19302)
+++ apps/plugins/solitaire.c (working copy)
@@ -1814,6 +1814,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 19302)
+++ apps/plugins/lib/oldmenuapi.c (working copy)
@@ -117,6 +117,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 19302)
+++ apps/lang/english.lang (working copy)
@@ -6904,16 +6904,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"
@@ -12242,3 +12239,45 @@
quickscreen: "Set as Bottom Quickscreen Item"
+
+ 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 19302)
+++ apps/gui/gwps.c (working copy)
@@ -633,6 +633,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 19302)
+++ apps/menus/main_menu.c (working copy)
@@ -28,6 +28,7 @@
#include "action.h"
#include "settings.h"
#include "powermgmt.h"
+#include "power.h"
#include "menu.h"
#include "misc.h"
#include "exported_menus.h"
@@ -382,6 +383,7 @@
}
return action;
}
+
static bool show_info(void)
{
struct info_data data = {.new_data = true };
@@ -429,7 +431,29 @@
&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;
+}
+
+
#if CONFIG_RTC
int time_screen(void* ignored);
MENUITEM_FUNCTION(timedate_item, MENU_FUNC_CHECK_RETVAL, ID2P(LANG_TIME_MENU), time_screen,
@@ -437,8 +461,8 @@
#endif
/* This item is in the time/date screen if there is a RTC */
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);
@@ -446,6 +470,10 @@
(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,
#if CONFIG_RTC
@@ -455,7 +483,7 @@
#if CONFIG_RTC == 0
&sleep_timer_call,
#endif
- &debug_menu_item);
+ &debug_menu_item, &do_reboot_item, &do_shutdown_item);
/* INFO MENU */
/***********************************/
Index: apps/tagcache.c
===================================================================
--- apps/tagcache.c (revision 19302)
+++ apps/tagcache.c (working copy)
@@ -3670,6 +3670,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. */
@@ -4379,6 +4380,7 @@
case Q_STOP_SCAN:
break ;
+ case SYS_REBOOT:
case SYS_POWEROFF:
break ;
Index: apps/features.txt
===================================================================
--- apps/features.txt (revision 19302)
+++ apps/features.txt (working copy)
@@ -145,10 +145,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 19302)
+++ apps/root_menu.c (working copy)
@@ -27,13 +27,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"
@@ -378,20 +376,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,
@@ -405,11 +390,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
);
static int item_callback(int action, const struct menu_item_ex *this_item)
Index: apps/misc.c
===================================================================
--- apps/misc.c (revision 19302)
+++ apps/misc.c (working copy)
@@ -632,9 +632,10 @@
scrobbler_init();
}
-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();
@@ -667,7 +668,12 @@
}
#endif
if (battery_level() > 10)
- splash(0, str(LANG_SHUTTINGDOWN));
+ {
+ if (reboot)
+ splash(0, str(LANG_REBOOTING));
+ else
+ splash(0, str(LANG_SHUTTINGDOWN));
+ }
else
{
msg_id = LANG_WARNING_BATTERY_LOW;
@@ -746,7 +752,7 @@
dircache_disable();
#endif
- shutdown_hw();
+ shutdown_hw(reboot);
}
#endif
return false;
@@ -934,9 +940,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 19302)
+++ firmware/export/kernel.h (working copy)
@@ -66,9 +66,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 19302)
+++ firmware/export/powermgmt.h (working copy)
@@ -170,8 +170,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);
/* Returns true if the system should force shutdown for some reason -
* eg. low battery */
bool query_force_shutdown(void);
Index: firmware/backlight.c
===================================================================
--- firmware/backlight.c (revision 19302)
+++ firmware/backlight.c (working copy)
@@ -673,6 +673,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 19302)
+++ firmware/target/coldfire/iaudio/pcf50606-iaudio.c (working copy)
@@ -117,7 +117,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 19302)
+++ firmware/powermgmt.c (working copy)
@@ -322,7 +322,7 @@
if (!shutdown_timeout && query_force_shutdown()) {
backlight_on();
- sys_poweroff();
+ sys_poweroff(false);
}
if (timeout &&
#if CONFIG_TUNER
@@ -336,7 +336,7 @@
if (TIME_AFTER(tick, last_event_tick + timeout) &&
TIME_AFTER(tick, storage_last_disk_activity() + timeout)) {
- sys_poweroff();
+ sys_poweroff(false);
}
}
else if (sleeptimer_active) {
/* Handle sleeptimer */
@@ -355,7 +355,7 @@
else {
DEBUGF("Sleep timer timeout. Shutting off...\n");
- sys_poweroff();
+ sys_poweroff(false);
}
}
}
}
@@ -618,7 +618,7 @@
/* update battery status every time an update is available */
battery_status_update();
if (!shutdown_timeout && query_force_shutdown()) {
- sys_poweroff();
+ sys_poweroff(false);
}
else {
@@ -733,9 +733,12 @@
}
/* Various hardware housekeeping tasks relating to shutting down the player */
-void shutdown_hw(void)
+void shutdown_hw(bool reboot)
{
+#ifdef SIMULATOR
+(void)reboot;
+#else
charging_algorithm_close();
audio_stop();
if (battery_level_safe()) { /* do not save on critical battery */
@@ -774,6 +774,10 @@
eeprom chips are quite slow and might be still writing the last
byte. */
sleep(HZ/4);
- power_off();
+ if (reboot)
+ system_reboot();
+ else
+ power_off();
+#endif /* #ifdef SIMULATOR */
}
@@ -777,7 +777,7 @@
power_off();
}
-void sys_poweroff(void)
+void sys_poweroff(bool reboot)
{
#ifndef BOOTLOADER
logf("sys_poweroff()");
@@ -794,7 +794,10 @@
shutdown_timeout += HZ*20;
}
- queue_broadcast(SYS_POWEROFF, 0);
+ if (reboot)
+ queue_broadcast(SYS_REBOOT, 0);
+ else
+ queue_broadcast(SYS_POWEROFF, 0);
#endif /* BOOTLOADER */
}
void cancel_shutdown(void)
Index: firmware/drivers/button.c
===================================================================
--- firmware/drivers/button.c (revision 19302)
+++ firmware/drivers/button.c (working copy)
@@ -204,7 +204,7 @@
{
/* Tell the main thread that it's time to
power off */
- sys_poweroff();
+ sys_poweroff(false);
/* Safety net for players without hardware
poweroff */