diff options
Diffstat (limited to 'bootloader')
-rw-r--r-- | bootloader/gigabeat.c | 4 | ||||
-rw-r--r-- | bootloader/iriver_h300.c | 11 | ||||
-rw-r--r-- | bootloader/main-pp.c | 2 | ||||
-rw-r--r-- | bootloader/main.c | 10 |
4 files changed, 14 insertions, 13 deletions
diff --git a/bootloader/gigabeat.c b/bootloader/gigabeat.c index e482c70d16..704548b65a 100644 --- a/bootloader/gigabeat.c +++ b/bootloader/gigabeat.c | |||
@@ -66,7 +66,7 @@ void main(void) | |||
66 | usb_init(); | 66 | usb_init(); |
67 | 67 | ||
68 | /* Enter USB mode without USB thread */ | 68 | /* Enter USB mode without USB thread */ |
69 | if(usb_detect()) | 69 | if(usb_detect() == USB_INSERTED) |
70 | { | 70 | { |
71 | const char msg[] = "Bootloader USB mode"; | 71 | const char msg[] = "Bootloader USB mode"; |
72 | reset_screen(); | 72 | reset_screen(); |
@@ -78,7 +78,7 @@ void main(void) | |||
78 | sleep(HZ/20); | 78 | sleep(HZ/20); |
79 | usb_enable(true); | 79 | usb_enable(true); |
80 | 80 | ||
81 | while (usb_detect()) | 81 | while (usb_detect() == USB_INSERTED) |
82 | sleep(HZ); | 82 | sleep(HZ); |
83 | 83 | ||
84 | usb_enable(false); | 84 | usb_enable(false); |
diff --git a/bootloader/iriver_h300.c b/bootloader/iriver_h300.c index dce178fcec..a3a15bd4b5 100644 --- a/bootloader/iriver_h300.c +++ b/bootloader/iriver_h300.c | |||
@@ -169,7 +169,7 @@ void main(void) | |||
169 | 169 | ||
170 | /* Turn off if we believe the start was accidental */ | 170 | /* Turn off if we believe the start was accidental */ |
171 | if(!(rtc_alarm || on_button || rc_on_button || | 171 | if(!(rtc_alarm || on_button || rc_on_button || |
172 | usb_detect() || charger_inserted())) { | 172 | (usb_detect() == USB_INSERTED) || charger_inserted())) { |
173 | __reset_cookie(); | 173 | __reset_cookie(); |
174 | power_off(); | 174 | power_off(); |
175 | } | 175 | } |
@@ -222,7 +222,8 @@ void main(void) | |||
222 | { | 222 | { |
223 | hold_status = true; | 223 | hold_status = true; |
224 | } | 224 | } |
225 | if (hold_status && !rtc_alarm && !usb_detect() && !charger_inserted()) | 225 | if (hold_status && !rtc_alarm && (usb_detect() != USB_INSERTED) && |
226 | !charger_inserted()) | ||
226 | { | 227 | { |
227 | if (detect_original_firmware()) | 228 | if (detect_original_firmware()) |
228 | { | 229 | { |
@@ -282,7 +283,7 @@ void main(void) | |||
282 | break; | 283 | break; |
283 | } | 284 | } |
284 | 285 | ||
285 | if(usb_detect()) | 286 | if(usb_detect() == USB_INSERTED) |
286 | request_start = true; | 287 | request_start = true; |
287 | } | 288 | } |
288 | if(!request_start) | 289 | if(!request_start) |
@@ -297,7 +298,7 @@ void main(void) | |||
297 | usb_init(); | 298 | usb_init(); |
298 | 299 | ||
299 | /* A hack to enter USB mode without using the USB thread */ | 300 | /* A hack to enter USB mode without using the USB thread */ |
300 | if(usb_detect()) | 301 | if(usb_detect() == USB_INSERTED) |
301 | { | 302 | { |
302 | const char msg[] = "Bootloader USB mode"; | 303 | const char msg[] = "Bootloader USB mode"; |
303 | int w, h; | 304 | int w, h; |
@@ -314,7 +315,7 @@ void main(void) | |||
314 | sleep(HZ/20); | 315 | sleep(HZ/20); |
315 | usb_enable(true); | 316 | usb_enable(true); |
316 | cpu_idle_mode(true); | 317 | cpu_idle_mode(true); |
317 | while (usb_detect()) | 318 | while (usb_detect() == USB_INSERTED) |
318 | { | 319 | { |
319 | /* Print the battery status. */ | 320 | /* Print the battery status. */ |
320 | line = 0; | 321 | line = 0; |
diff --git a/bootloader/main-pp.c b/bootloader/main-pp.c index 0d377fd798..8b851394ac 100644 --- a/bootloader/main-pp.c +++ b/bootloader/main-pp.c | |||
@@ -464,7 +464,7 @@ void* main(void) | |||
464 | { | 464 | { |
465 | usb_retry++; | 465 | usb_retry++; |
466 | sleep(HZ/4); | 466 | sleep(HZ/4); |
467 | usb = usb_detect(); | 467 | usb = (usb_detect() == USB_INSERTED); |
468 | } | 468 | } |
469 | if (usb) | 469 | if (usb) |
470 | btn |= BOOTLOADER_BOOT_OF; | 470 | btn |= BOOTLOADER_BOOT_OF; |
diff --git a/bootloader/main.c b/bootloader/main.c index 0306eea5dc..e60799fa65 100644 --- a/bootloader/main.c +++ b/bootloader/main.c | |||
@@ -388,7 +388,7 @@ void main(void) | |||
388 | power_init(); | 388 | power_init(); |
389 | 389 | ||
390 | /* Turn off if neither ON button is pressed */ | 390 | /* Turn off if neither ON button is pressed */ |
391 | if(!(on_button || rc_on_button || usb_detect())) | 391 | if(!(on_button || rc_on_button || (usb_detect() == USB_INSERTED))) |
392 | { | 392 | { |
393 | __reset_cookie(); | 393 | __reset_cookie(); |
394 | power_off(); | 394 | power_off(); |
@@ -439,7 +439,7 @@ void main(void) | |||
439 | } | 439 | } |
440 | 440 | ||
441 | # ifdef EEPROM_SETTINGS | 441 | # ifdef EEPROM_SETTINGS |
442 | if (!hold_status && !usb_detect() && !recovery_mode) | 442 | if (!hold_status && (usb_detect() != USB_INSERTED) && !recovery_mode) |
443 | try_flashboot(); | 443 | try_flashboot(); |
444 | # endif | 444 | # endif |
445 | 445 | ||
@@ -467,7 +467,7 @@ void main(void) | |||
467 | 467 | ||
468 | /* Don't start if the Hold button is active on the device you | 468 | /* Don't start if the Hold button is active on the device you |
469 | are starting with */ | 469 | are starting with */ |
470 | if (!usb_detect() && (hold_status | 470 | if ((usb_detect() != USB_INSERTED) && (hold_status |
471 | #ifdef HAVE_EEPROM_SETTINGS | 471 | #ifdef HAVE_EEPROM_SETTINGS |
472 | || recovery_mode | 472 | || recovery_mode |
473 | #endif | 473 | #endif |
@@ -494,7 +494,7 @@ void main(void) | |||
494 | usb_init(); | 494 | usb_init(); |
495 | 495 | ||
496 | /* A hack to enter USB mode without using the USB thread */ | 496 | /* A hack to enter USB mode without using the USB thread */ |
497 | if(usb_detect()) | 497 | if(usb_detect() == USB_INSERTED) |
498 | { | 498 | { |
499 | const char msg[] = "Bootloader USB mode"; | 499 | const char msg[] = "Bootloader USB mode"; |
500 | int w, h; | 500 | int w, h; |
@@ -520,7 +520,7 @@ void main(void) | |||
520 | sleep(HZ/20); | 520 | sleep(HZ/20); |
521 | usb_enable(true); | 521 | usb_enable(true); |
522 | cpu_idle_mode(true); | 522 | cpu_idle_mode(true); |
523 | while (usb_detect()) | 523 | while (usb_detect() == USB_INSERTED) |
524 | { | 524 | { |
525 | /* Print the battery status. */ | 525 | /* Print the battery status. */ |
526 | line = 0; | 526 | line = 0; |