diff options
Diffstat (limited to 'bootloader/iriver_h300.c')
-rw-r--r-- | bootloader/iriver_h300.c | 18 |
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 | { |