Skip to content

Commit

Permalink
Fix pin lock issue during io reset
Browse files Browse the repository at this point in the history
  • Loading branch information
yogh333 committed Feb 4, 2025
1 parent 1b289c6 commit c08d21c
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions ledger_device_sdk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ledger_device_sdk"
version = "1.20.2"
version = "1.20.3"
authors = ["yhql", "yogh333", "agrojean-ledger", "kingofpayne"]
edition = "2021"
license.workspace = true
Expand All @@ -21,7 +21,7 @@ rand_core = { version = "0.6.3", default-features = false }
zeroize = { version = "1.6.0", default-features = false }
numtoa = "0.2.4"
const-zero = "0.1.1"
ledger_secure_sdk_sys = { path = "../ledger_secure_sdk_sys", version = "1.6.5" }
ledger_secure_sdk_sys = { path = "../ledger_secure_sdk_sys", version = "1.6.6" }

[features]
debug = []
Expand Down
3 changes: 0 additions & 3 deletions ledger_device_sdk/src/nbgl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ use core::ffi::{c_char, c_int};
use core::mem::transmute;
use ledger_secure_sdk_sys::*;

#[no_mangle]
static mut G_ux_params: bolos_ux_params_t = unsafe { const_zero!(bolos_ux_params_t) };

pub mod nbgl_address_review;
pub mod nbgl_choice;
pub mod nbgl_generic_review;
Expand Down
2 changes: 1 addition & 1 deletion ledger_secure_sdk_sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ledger_secure_sdk_sys"
version = "1.6.5"
version = "1.6.6"
authors = ["yhql", "agrojean-ledger", "yogh333"]
edition = "2021"
license.workspace = true
Expand Down
15 changes: 15 additions & 0 deletions ledger_secure_sdk_sys/src/c/src.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ void c_reset_bss() {
memset(bss, 0, bss_len);
}

bolos_ux_params_t G_ux_params;

void c_boot_std() {
// below is a 'manual' implementation of `io_seproxyhal_init`
#ifdef HAVE_MCU_PROTECT
Expand All @@ -277,6 +279,19 @@ void c_boot_std() {
io_seproxyhal_spi_send(c, 4);
#endif

// Warn UX layer of io reset to avoid unwanted pin lock
memset(&G_ux_params, 0, sizeof(G_ux_params));
G_ux_params.ux_id = BOLOS_UX_IO_RESET;

// If the app has just been booted from the UX, multiple os_ux calls may be necessary
// to ensure UX layer has take the BOLOS_UX_IO_RESET instruction into account.
for (uint8_t i = 0; i < 2; i++) {
os_ux(&G_ux_params);
if (os_sched_last_status(TASK_BOLOS_UX) == BOLOS_UX_OK) {
break;
}
}

#ifdef HAVE_BLE
unsigned int plane = G_io_app.plane_mode;
#endif
Expand Down

0 comments on commit c08d21c

Please sign in to comment.