summaryrefslogtreecommitdiffstats
path: root/bootloader/iriver_h300.c
diff options
context:
space:
mode:
Diffstat (limited to 'bootloader/iriver_h300.c')
-rw-r--r--bootloader/iriver_h300.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/bootloader/iriver_h300.c b/bootloader/iriver_h300.c
index 04eabcaec2..286e123d53 100644
--- a/bootloader/iriver_h300.c
+++ b/bootloader/iriver_h300.c
@@ -146,6 +146,7 @@ void main(void)
bool rtc_alarm;
int button;
int mask;
+ bool usb_charge = false;
/* We want to read the buttons as early as possible, before the user
releases the ON button */
@@ -246,6 +247,13 @@ void main(void)
start_iriver_fw();
}
+ /* enable usb charging for charge mode and disk mode */
+ if (usb_detect() == USB_INSERTED)
+ {
+ usb_charging_enable(USB_CHARGING_ENABLE);
+ usb_charge = true;
+ }
+
if(charger_inserted())
{
const char charging_msg[] = "Charging...";
@@ -289,9 +297,6 @@ void main(void)
check_battery();
break;
}
-
- if(usb_detect() == USB_INSERTED)
- request_start = true;
}
if(!request_start)
{
@@ -340,6 +345,13 @@ void main(void)
lcd_update();
}
+ /* disable usb charging if we enabled it earlier */
+ if (usb_charge)
+ {
+ usb_charging_enable(USB_CHARGING_DISABLE);
+ usb_charge = false;
+ }
+
rc = storage_init();
if(rc)
{