summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2002-09-25 19:25:10 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2002-09-25 19:25:10 +0000
commit1665811d33158ed11336437a22e4a745c1e35695 (patch)
tree7f3f51f6ece14599dd3c454ce3210a2de281b669 /firmware
parent805040484870d54bcee055049ad7f62f7e46192d (diff)
Don't auto-poweroff if USB is inserted
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2418 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/powermgmt.c2
-rw-r--r--firmware/usb.c5
-rw-r--r--firmware/usb.h1
3 files changed, 8 insertions, 0 deletions
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c
index 9d3bf721aa..0af7d63a26 100644
--- a/firmware/powermgmt.c
+++ b/firmware/powermgmt.c
@@ -31,6 +31,7 @@
#include "button.h"
#include "ata.h"
#include "mpeg.h"
+#include "usb.h"
#include "powermgmt.h"
#ifdef SIMULATOR
@@ -127,6 +128,7 @@ static void handle_auto_poweroff(void)
last_charge_time = current_tick;
if(timeout &&
+ !usb_inserted() &&
(mpeg_stat == 0 ||
mpeg_stat == (MPEG_STATUS_PLAY | MPEG_STATUS_PAUSE)))
{
diff --git a/firmware/usb.c b/firmware/usb.c
index 2e978ff54e..962e373a67 100644
--- a/firmware/usb.c
+++ b/firmware/usb.c
@@ -297,6 +297,11 @@ void usb_start_monitoring(void)
usb_monitor_enabled = true;
}
+bool usb_inserted(void)
+{
+ return usb_state == USB_INSERTED;
+}
+
#else
/* Dummy simulator functions */
diff --git a/firmware/usb.h b/firmware/usb.h
index a29ff9832c..455775c1d2 100644
--- a/firmware/usb.h
+++ b/firmware/usb.h
@@ -26,5 +26,6 @@ void usb_start_monitoring(void);
void usb_acknowledge(int id);
void usb_wait_for_disconnect(struct event_queue *q);
void usb_display_info(void);
+bool usb_inserted(void);
#endif