summaryrefslogtreecommitdiffstats
path: root/bootloader
diff options
context:
space:
mode:
authorJames Buren <braewoods+rb@braewoods.net>2020-11-14 12:10:58 +0000
committerJames Buren <braewoods+rb@braewoods.net>2020-11-14 12:11:30 +0000
commit5a223080faa39fd13eb7befab272fcfa0163a506 (patch)
tree71fd83a0223521fbfcf9cbbdd4d751ee881b231f /bootloader
parentd5a2aeb6c48d0533dddcc743154b074d1f813928 (diff)
downloadrockbox-5a223080faa39fd13eb7befab272fcfa0163a506.tar.gz
rockbox-5a223080faa39fd13eb7befab272fcfa0163a506.tar.bz2
rockbox-5a223080faa39fd13eb7befab272fcfa0163a506.zip
h300: enable usb charging for charge mode and disk mode
This enables USB charging when the bootloader is in charge mode or disk mode. As a byproduct there is a small change in behavior where charge mode is all that is available if it is triggered by the USB cable insertion. Disk mode only becomes available if the user requests to continue the boot process by pressing the power button. It had to be done this way as there's no way to tell this early whether the user wants to simply charge or trigger disk mode as well. Change-Id: I32f29398b22a76e5e754efdc9beecae39dd122d5
Diffstat (limited to 'bootloader')
-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)
{