From 1665811d33158ed11336437a22e4a745c1e35695 Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Wed, 25 Sep 2002 19:25:10 +0000 Subject: Don't auto-poweroff if USB is inserted git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2418 a1c6a512-1295-4272-9138-f99709370657 --- firmware/powermgmt.c | 2 ++ firmware/usb.c | 5 +++++ firmware/usb.h | 1 + 3 files changed, 8 insertions(+) (limited to 'firmware') 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 -- cgit v1.2.3