Skip to content

Commit d5c423e

Browse files
committed
Fix pin lock issue during io reset
1 parent 67b1ffe commit d5c423e

File tree

2 files changed

+15
-3
lines changed
  • ledger_device_sdk/src
  • ledger_secure_sdk_sys/src/c

2 files changed

+15
-3
lines changed

ledger_device_sdk/src/nbgl.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ use core::ffi::{c_char, c_int};
88
use core::mem::transmute;
99
use ledger_secure_sdk_sys::*;
1010

11-
#[no_mangle]
12-
static mut G_ux_params: bolos_ux_params_t = unsafe { const_zero!(bolos_ux_params_t) };
13-
1411
pub mod nbgl_address_review;
1512
pub mod nbgl_choice;
1613
pub mod nbgl_generic_review;

ledger_secure_sdk_sys/src/c/src.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,8 @@ void c_reset_bss() {
266266
memset(bss, 0, bss_len);
267267
}
268268

269+
bolos_ux_params_t G_ux_params;
270+
269271
void c_boot_std() {
270272
// below is a 'manual' implementation of `io_seproxyhal_init`
271273
#ifdef HAVE_MCU_PROTECT
@@ -277,6 +279,19 @@ void c_boot_std() {
277279
io_seproxyhal_spi_send(c, 4);
278280
#endif
279281

282+
// Warn UX layer of io reset to avoid unwanted pin lock
283+
memset(&G_ux_params, 0, sizeof(G_ux_params));
284+
G_ux_params.ux_id = BOLOS_UX_IO_RESET;
285+
286+
// If the app has just been booted from the UX, multiple os_ux calls may be necessary
287+
// to ensure UX layer has take the BOLOS_UX_IO_RESET instruction into account.
288+
for (uint8_t i = 0; i < 2; i++) {
289+
os_ux(&G_ux_params);
290+
if (os_sched_last_status(TASK_BOLOS_UX) == BOLOS_UX_OK) {
291+
break;
292+
}
293+
}
294+
280295
#ifdef HAVE_BLE
281296
unsigned int plane = G_io_app.plane_mode;
282297
#endif

0 commit comments

Comments
 (0)