Skip to content

Commit cebfbb9

Browse files
committed
Foward button event to OS to prevent early pin lock
1 parent b4acd75 commit cebfbb9

File tree

3 files changed

+25
-23
lines changed

3 files changed

+25
-23
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ledger_device_sdk/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ledger_device_sdk"
3-
version = "1.22.2"
3+
version = "1.22.3"
44
authors = ["yhql", "yogh333", "agrojean-ledger", "kingofpayne"]
55
edition = "2021"
66
license.workspace = true

ledger_device_sdk/src/ui/gadgets.rs

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -538,31 +538,33 @@ impl<'a> MultiPageMenu<'a> {
538538

539539
loop {
540540
match self.comm.next_event() {
541-
io::Event::Button(button) => match button {
542-
BothButtonsRelease => return EventOrPageIndex::Index(index),
543-
b => {
544-
match b {
545-
LeftButtonRelease => {
546-
if index as i16 - 1 < 0 {
547-
index = self.pages.len() - 1;
548-
} else {
549-
index = index.saturating_sub(1);
541+
io::Event::Button(button) => if UxEvent::Event.request() == BOLOS_UX_OK {
542+
match button {
543+
BothButtonsRelease => return EventOrPageIndex::Index(index),
544+
b => {
545+
match b {
546+
LeftButtonRelease => {
547+
if index as i16 - 1 < 0 {
548+
index = self.pages.len() - 1;
549+
} else {
550+
index = index.saturating_sub(1);
551+
}
550552
}
551-
}
552-
RightButtonRelease => {
553-
if index < self.pages.len() - 1 {
554-
index += 1;
555-
} else {
556-
index = 0;
553+
RightButtonRelease => {
554+
if index < self.pages.len() - 1 {
555+
index += 1;
556+
} else {
557+
index = 0;
558+
}
557559
}
560+
_ => (),
558561
}
559-
_ => (),
562+
clear_screen();
563+
self.pages[index].place();
564+
LEFT_ARROW.display();
565+
RIGHT_ARROW.display();
566+
crate::ui::screen_util::screen_update();
560567
}
561-
clear_screen();
562-
self.pages[index].place();
563-
LEFT_ARROW.display();
564-
RIGHT_ARROW.display();
565-
crate::ui::screen_util::screen_update();
566568
}
567569
},
568570
io::Event::Command(ins) => return EventOrPageIndex::Event(io::Event::Command(ins)),

0 commit comments

Comments
 (0)