summaryrefslogtreecommitdiff
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
parentd5a2aeb6c48d0533dddcc743154b074d1f813928 (diff)
downloadrockbox-5a223080faa39fd13eb7befab272fcfa0163a506.tar.gz
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
-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)
146 bool rtc_alarm; 146 bool rtc_alarm;
147 int button; 147 int button;
148 int mask; 148 int mask;
149 bool usb_charge = false;
149 150
150 /* We want to read the buttons as early as possible, before the user 151 /* We want to read the buttons as early as possible, before the user
151 releases the ON button */ 152 releases the ON button */
@@ -246,6 +247,13 @@ void main(void)
246 start_iriver_fw(); 247 start_iriver_fw();
247 } 248 }
248 249
250 /* enable usb charging for charge mode and disk mode */
251 if (usb_detect() == USB_INSERTED)
252 {
253 usb_charging_enable(USB_CHARGING_ENABLE);
254 usb_charge = true;
255 }
256
249 if(charger_inserted()) 257 if(charger_inserted())
250 { 258 {
251 const char charging_msg[] = "Charging..."; 259 const char charging_msg[] = "Charging...";
@@ -289,9 +297,6 @@ void main(void)
289 check_battery(); 297 check_battery();
290 break; 298 break;
291 } 299 }
292
293 if(usb_detect() == USB_INSERTED)
294 request_start = true;
295 } 300 }
296 if(!request_start) 301 if(!request_start)
297 { 302 {
@@ -340,6 +345,13 @@ void main(void)
340 lcd_update(); 345 lcd_update();
341 } 346 }
342 347
348 /* disable usb charging if we enabled it earlier */
349 if (usb_charge)
350 {
351 usb_charging_enable(USB_CHARGING_DISABLE);
352 usb_charge = false;
353 }
354
343 rc = storage_init(); 355 rc = storage_init();
344 if(rc) 356 if(rc)
345 { 357 {