diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/powermgmt.c | 2 | ||||
-rw-r--r-- | firmware/usb.c | 5 | ||||
-rw-r--r-- | firmware/usb.h | 1 |
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 |