summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Buren <braewoods+rb@braewoods.net>2020-11-15 10:33:12 +0000
committerJames Buren <braewoods+rb@braewoods.net>2020-11-15 11:01:53 +0000
commit1bc68d5ad77bca333ac69bd4617a1f3af9375e0d (patch)
treed3e799cb15b62893a4b874f8f32454649cdecd06
parentfc5c8192ffc8a10ce5f7ccbd96320dfbade1a8ef (diff)
downloadrockbox-1bc68d5ad77bca333ac69bd4617a1f3af9375e0d.tar.gz
rockbox-1bc68d5ad77bca333ac69bd4617a1f3af9375e0d.zip
h1x0/h300: change when the hold switch and failsafe are used
After reviewing the code awhile I realized that the failsafe and hold switch have no impact on the boot process when the usb or charger is connected. That makes no real sense to me. If these are connected then neither will be used at all. The boot process will never revisit it either once those other modes end and resume the boot process. It will just continue to try to boot from disk as if these emergency settings never existed. I have decided it makes more sense for them to be evaluated once the higher priority charge and disk mode have finished their roles. Given how the code was originally written it seems to be they were not intended to run prior to these at the very least since the logical conditions preclude that possibility as they include the inverse of the conditions that trigger the charge and disk modes. Change-Id: I0531c97474572c573178f480c239c3c1659f9653
-rw-r--r--bootloader/iriver_h1x0.c31
-rw-r--r--bootloader/iriver_h300.c32
2 files changed, 28 insertions, 35 deletions
diff --git a/bootloader/iriver_h1x0.c b/bootloader/iriver_h1x0.c
index 94ec6cb0fb..7efaaa3308 100644
--- a/bootloader/iriver_h1x0.c
+++ b/bootloader/iriver_h1x0.c
@@ -479,19 +479,6 @@ void main(void)
479 479
480 check_battery(); 480 check_battery();
481 481
482 /* Don't start if the Hold button is active on the device you
483 are starting with */
484 if ((usb_detect() != USB_INSERTED) && (hold_status || recovery_mode))
485 {
486 if (detect_original_firmware())
487 {
488 printf("Hold switch on");
489 shutdown();
490 }
491
492 failsafe_menu();
493 }
494
495 /* Holding REC while starting runs the original firmware */ 482 /* Holding REC while starting runs the original firmware */
496 if (detect_original_firmware() && rec_button) 483 if (detect_original_firmware() && rec_button)
497 { 484 {
@@ -544,10 +531,20 @@ void main(void)
544 lcd_update(); 531 lcd_update();
545 } 532 }
546 533
547 /* boot from flash if that is the default */ 534 /* recheck the hold switch status as it may have changed */
548 try_flashboot(); 535 hold_status = (button_hold() || remote_button_hold());
549 if (recovery_mode) 536
550 printf("Falling back to boot from disk"); 537 /* hold switch shutdown or failsafe recovery mode */
538 if (hold_status || recovery_mode)
539 {
540 if (detect_original_firmware())
541 {
542 printf("Hold switch on");
543 shutdown();
544 }
545
546 failsafe_menu();
547 }
551 548
552 rc = storage_init(); 549 rc = storage_init();
553 if(rc) 550 if(rc)
diff --git a/bootloader/iriver_h300.c b/bootloader/iriver_h300.c
index 2e4909fd53..3a254f4487 100644
--- a/bootloader/iriver_h300.c
+++ b/bootloader/iriver_h300.c
@@ -473,20 +473,6 @@ void main(void)
473 if(rtc_alarm) 473 if(rtc_alarm)
474 printf("RTC alarm detected"); 474 printf("RTC alarm detected");
475 475
476 /* Don't start if the Hold button is active on the device you
477 are starting with */
478 if ((hold_status || recovery_mode) && !rtc_alarm &&
479 (usb_detect() != USB_INSERTED) && !charger_inserted())
480 {
481 if (detect_original_firmware())
482 {
483 printf("Hold switch on");
484 shutdown();
485 }
486
487 failsafe_menu();
488 }
489
490 /* Holding REC while starting runs the original firmware */ 476 /* Holding REC while starting runs the original firmware */
491 if (detect_original_firmware() && rec_button) 477 if (detect_original_firmware() && rec_button)
492 { 478 {
@@ -605,10 +591,20 @@ void main(void)
605 usb_charge = false; 591 usb_charge = false;
606 } 592 }
607 593
608 /* boot from flash if that is the default */ 594 /* recheck the hold switch status as it may have changed */
609 try_flashboot(); 595 hold_status = (button_hold() || remote_button_hold());
610 if (recovery_mode) 596
611 printf("Falling back to boot from disk"); 597 /* hold switch shutdown or failsafe recovery mode */
598 if (hold_status || recovery_mode)
599 {
600 if (detect_original_firmware())
601 {
602 printf("Hold switch on");
603 shutdown();
604 }
605
606 failsafe_menu();
607 }
612 608
613 rc = storage_init(); 609 rc = storage_init();
614 if(rc) 610 if(rc)