From 7ec35e782803708cc69871fd9495ea80c846ff68 Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Wed, 16 Oct 2002 12:40:30 +0000 Subject: Don't reboot unless we are connected to a charger git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2683 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/button.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'firmware/drivers/button.c') diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c index 4657e1d84b..e70246314d 100644 --- a/firmware/drivers/button.c +++ b/firmware/drivers/button.c @@ -29,6 +29,7 @@ #include "backlight.h" #include "adc.h" #include "serial.h" +#include "power.h" struct event_queue button_queue; @@ -127,15 +128,12 @@ static void button_tick(void) /* initial repeat */ count = REPEAT_INTERVAL_START; } - /* If the OFF button is pressed long enough, - and we are still alive, then the unit must be - connected to a charger. Therefore we will - reboot and let the original firmware handle - the charging. */ + /* Reboot if the OFF button is pressed long enough + and we are connected to a charger. */ #ifdef HAVE_RECORDER_KEYPAD - if(btn == BUTTON_OFF) + if(btn == BUTTON_OFF && charger_inserted()) #elif HAVE_PLAYER_KEYPAD - if(btn == BUTTON_STOP) + if(btn == BUTTON_STOP && charger_inserted()) #endif system_reboot(); } -- cgit v1.2.3