From 16c4665c6f4981a25df67f6ccf5ab1912acc40a0 Mon Sep 17 00:00:00 2001 From: GroM Date: Thu, 9 Jan 2025 10:33:58 +0100 Subject: [PATCH] Return device locked error when lock screen (pin code) is activated --- rust-app/src/main_nanos.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/rust-app/src/main_nanos.rs b/rust-app/src/main_nanos.rs index 3cbb132..5b641d7 100644 --- a/rust-app/src/main_nanos.rs +++ b/rust-app/src/main_nanos.rs @@ -15,6 +15,16 @@ use core::cell::RefCell; use core::pin::Pin; use pin_cell::*; +// Trick to manage pin code +use core::convert::TryFrom; +struct Temp {} +impl TryFrom for Temp { + type Error = io::StatusWords; + fn try_from(_header: io::ApduHeader) -> Result { + Ok(Self {}) + } +} + #[allow(dead_code)] pub fn app_main() { let comm: SingleThreaded> = SingleThreaded(RefCell::new(io::Comm::new())); @@ -116,7 +126,8 @@ pub fn app_main() { } io::Event::Ticker => { if UxEvent::Event.request() != BOLOS_UX_OK { - UxEvent::block(); + let mut c = comm.borrow_mut(); + UxEvent::block_and_get_event::(&mut c); // Redisplay application menu here menu(states.borrow(), &idle_menu, &busy_menu); }