Skip to content

Commit

Permalink
fix(core/bootloader): fix ignoring disconnected touch in production mode
Browse files Browse the repository at this point in the history
[no changelog]
  • Loading branch information
TychoVrahe committed Sep 20, 2024
1 parent cc4c637 commit ce47da9
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions core/embed/bootloader/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,17 +377,20 @@ int bootloader_main(void) {
unit_variant_init();

#ifdef USE_TOUCH
secbool touch_initialized = secfalse;
secbool allow_touchless_mode = secfalse;
#ifdef TREZOR_MODEL_T3T1
// on T3T1, tester needs to run without touch, so making an exception
// until unit variant is written in OTP
if (unit_variant_present()) {
ensure(touch_init(), "Touch screen panel was not loaded properly.");
} else {
touch_init();
}
#else
ensure(touch_init(), "Touch screen panel was not loaded properly.");
const secbool manufacturing_mode =
unit_variant_present() ? secfalse : sectrue;
allow_touchless_mode = manufacturing_mode;

#endif
touch_initialized = touch_init();
if (allow_touchless_mode != sectrue) {
ensure(touch_initialized, "Touch screen panel was not loaded properly.");
}
#endif

ui_screen_boot_stage_1(false);
Expand Down Expand Up @@ -506,8 +509,10 @@ int bootloader_main(void) {
if (firmware_present == sectrue && stay_in_bootloader != sectrue) {
// Wait until the touch controller is ready
// (on hardware this may take a while)
while (touch_ready() != sectrue) {
hal_delay(1);
if (touch_initialized != secfalse) {
while (touch_ready() != sectrue) {
hal_delay(1);
}
}
#ifdef TREZOR_EMULATOR
hal_delay(500);
Expand Down

0 comments on commit ce47da9

Please sign in to comment.