summaryrefslogtreecommitdiff
path: root/bootloader
diff options
context:
space:
mode:
authorJames Buren <braewoods+rb@braewoods.net>2020-11-15 09:56:14 +0000
committerJames Buren <braewoods+rb@braewoods.net>2020-11-15 10:11:56 +0000
commitfc5c8192ffc8a10ce5f7ccbd96320dfbade1a8ef (patch)
tree427c066b1169d371885d8247c17dd824f0c4f632 /bootloader
parent29a20bd20974780345197e4fe2be4b06ad08954b (diff)
downloadrockbox-fc5c8192ffc8a10ce5f7ccbd96320dfbade1a8ef.tar.gz
rockbox-fc5c8192ffc8a10ce5f7ccbd96320dfbade1a8ef.zip
h1x0/h300: fix h300 bootloader hold switch check
This fixes an early boot bug on the h300 where hold_status is read before it has a chance to properly check whether the hold switch is even active. This was accomplished by porting over the method the h1x0 uses to perform the same check. Change-Id: I04679d82f65a2edcbee4be9a146437c3988040a2
Diffstat (limited to 'bootloader')
-rw-r--r--bootloader/iriver_h1x0.c6
-rw-r--r--bootloader/iriver_h300.c27
2 files changed, 21 insertions, 12 deletions
diff --git a/bootloader/iriver_h1x0.c b/bootloader/iriver_h1x0.c
index 7af0e86240..94ec6cb0fb 100644
--- a/bootloader/iriver_h1x0.c
+++ b/bootloader/iriver_h1x0.c
@@ -429,15 +429,13 @@ void main(void)
429 429
430 adc_init(); 430 adc_init();
431 button_init(); 431 button_init();
432 sleep(HZ/50); /* Allow the button driver to check the buttons */
432 433
433 /* Only check remote hold status if remote power button was actually used. */ 434 /* Only check remote hold status if remote power button was actually used. */
434 if (rc_on_button) 435 if (rc_on_button)
435 { 436 {
436 lcd_remote_init(); 437 lcd_remote_init();
437 438
438 /* Allow the button driver to check the buttons */
439 sleep(HZ/50);
440
441 if (remote_button_hold()) 439 if (remote_button_hold())
442 hold_status = true; 440 hold_status = true;
443 } 441 }
@@ -476,8 +474,6 @@ void main(void)
476 printf("Rockbox boot loader"); 474 printf("Rockbox boot loader");
477 printf("Version %s", rbversion); 475 printf("Version %s", rbversion);
478 476
479 /* No need to wait here more because lcd_init and others already do that. */
480 // sleep(HZ/50); /* Allow the button driver to check the buttons */
481 rec_button = ((button_status() & BUTTON_REC) == BUTTON_REC) 477 rec_button = ((button_status() & BUTTON_REC) == BUTTON_REC)
482 || ((button_status() & BUTTON_RC_REC) == BUTTON_RC_REC); 478 || ((button_status() & BUTTON_RC_REC) == BUTTON_RC_REC);
483 479
diff --git a/bootloader/iriver_h300.c b/bootloader/iriver_h300.c
index 6cacbc4a42..2e4909fd53 100644
--- a/bootloader/iriver_h300.c
+++ b/bootloader/iriver_h300.c
@@ -425,6 +425,22 @@ void main(void)
425 425
426 adc_init(); 426 adc_init();
427 button_init(); 427 button_init();
428 sleep(HZ/50); /* Allow the button driver to check the buttons */
429
430 /* Only check remote hold status if remote power button was actually used. */
431 if (rc_on_button)
432 {
433 lcd_remote_init();
434
435 if (remote_button_hold())
436 hold_status = true;
437 }
438
439 /* Check main hold switch status too. */
440 if (on_button && button_hold())
441 {
442 hold_status = true;
443 }
428 444
429 /* Power on the hard drive early, to speed up the loading. */ 445 /* Power on the hard drive early, to speed up the loading. */
430 if (!hold_status && !recovery_mode) 446 if (!hold_status && !recovery_mode)
@@ -436,7 +452,10 @@ void main(void)
436 } 452 }
437 453
438 lcd_init(); 454 lcd_init();
439 lcd_remote_init(); 455
456 if (!rc_on_button)
457 lcd_remote_init();
458
440 font_init(); 459 font_init();
441 460
442 lcd_setfont(FONT_SYSFIXED); 461 lcd_setfont(FONT_SYSFIXED);
@@ -446,7 +465,6 @@ void main(void)
446 printf("Rockbox boot loader"); 465 printf("Rockbox boot loader");
447 printf("Version %s", rbversion); 466 printf("Version %s", rbversion);
448 467
449 sleep(HZ/50); /* Allow the button driver to check the buttons */
450 rec_button = ((button_status() & BUTTON_REC) == BUTTON_REC) 468 rec_button = ((button_status() & BUTTON_REC) == BUTTON_REC)
451 || ((button_status() & BUTTON_RC_REC) == BUTTON_RC_REC); 469 || ((button_status() & BUTTON_RC_REC) == BUTTON_RC_REC);
452 470
@@ -457,11 +475,6 @@ void main(void)
457 475
458 /* Don't start if the Hold button is active on the device you 476 /* Don't start if the Hold button is active on the device you
459 are starting with */ 477 are starting with */
460 if ((on_button && button_hold()) ||
461 (rc_on_button && remote_button_hold()))
462 {
463 hold_status = true;
464 }
465 if ((hold_status || recovery_mode) && !rtc_alarm && 478 if ((hold_status || recovery_mode) && !rtc_alarm &&
466 (usb_detect() != USB_INSERTED) && !charger_inserted()) 479 (usb_detect() != USB_INSERTED) && !charger_inserted())
467 { 480 {