1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-06-26 09:52:34 +00:00

feat(core): implement reboot command to bypass button check

[no changelog]
This commit is contained in:
tychovrahe 2025-05-07 12:47:46 +02:00 committed by kopecdav
parent 7fa4e2d510
commit c63ff3bf44
5 changed files with 18 additions and 2 deletions

View File

@ -238,7 +238,7 @@ void pm_enter_hibernate(pm_driver_t* drv) {
// Store power manager data with request to hibernate, power manager
// will try to hibernate immediately after reboot.
pm_store_data_to_backup_ram();
reboot_device();
reboot_to_off();
}
void pm_enter_charging(pm_driver_t* drv) {}

View File

@ -33,6 +33,8 @@ typedef enum {
BOOT_COMMAND_INSTALL_UPGRADE = 0xFA4A5C8D,
// Show RSOD and wait for user input
BOOT_COMMAND_SHOW_RSOD = 0x7CD945A0,
// Reboot the device as if it was powered on
BOOT_COMMAND_REBOOT = 0xA5C3D4E2,
} boot_command_t;
// Maximum size boot_args array

View File

@ -22,9 +22,13 @@
#include <trezor_types.h>
// Immediately resets the device and initiates the normal boot sequence.
// Immediately resets the device and initiates the normal boot sequence as if
// the device was powered on
void __attribute__((noreturn)) reboot_device(void);
// Immediately resets the device
void __attribute__((noreturn)) reboot_to_off(void);
// Resets the device and enters the bootloader,
// halting there and waiting for further user instructions.
void __attribute__((noreturn)) reboot_to_bootloader(void);

View File

@ -213,6 +213,10 @@ __attribute__((noreturn)) void reboot_and_upgrade(const uint8_t hash[32]) {
}
__attribute__((noreturn)) void reboot_device(void) {
reboot_with_args(BOOT_COMMAND_REBOOT, NULL, 0);
}
__attribute__((noreturn)) void reboot_to_off(void) {
reboot_with_args(BOOT_COMMAND_NONE, NULL, 0);
}

View File

@ -61,6 +61,12 @@ __attribute__((noreturn)) void reboot_device(void) {
exit(3);
}
__attribute__((noreturn)) void reboot_to_off(void) {
printf("reboot (power off)\n");
exit(3);
}
__attribute__((noreturn)) void reboot_or_halt_after_rsod(void) {
printf("reboot (with timeout)\n");