What changed, and why it matters
This commit is a small code cleanup in the BitBox02 hardware wallet firmware. It moves a direct call to a low-level screen-switching function into a proper hardware-abstraction trait, making the code more testable and consistent. There is no indication it fixes a security bug or changes user-visible behavior.
No security action required. Treat as normal code-quality refactoring.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change introduces a new switch_to_logo() method on the Ui trait and implements it for the real BitBox02 UI and the testing mock. The existing call in hww.rs to bitbox02::ui::screen_process_waiting_switch_to_logo() is replaced with hal.ui().switch_to_logo(), removing a direct dependency on the concrete bitbox02 crate from the higher-level hww module. Documentation comments clarify that startup finishes on the lockscreen and that switch_to_logo() transitions from that lockscreen to the logo. This is a refactoring/abstraction-layer improvement with no functional change to the screen-switching logic itself.
Changed components
src/rust/bitbox-hal/src/ui.rssrc/rust/bitbox02/src/hal/ui.rssrc/rust/bitbox02-rust/src/hww.rssrc/rust/bitbox02-rust/src/hal/testing/ui.rssrc/rust/bitbox-hal/src/system.rsInspect captured patch +17 / −2
diff --git a/src/rust/bitbox-hal/src/system.rs b/src/rust/bitbox-hal/src/system.rs
index 91c12dc..ed1983b 100644
--- a/src/rust/bitbox-hal/src/system.rs
+++ b/src/rust/bitbox-hal/src/system.rs
@@ -3,6 +3,10 @@
#[allow(async_fn_in_trait)]
pub trait System {
/// Runs device-specific startup UI/initialization before regular operation.
+ ///
+ /// Startup may briefly show the logo, but it must finish on the lockscreen.
+ /// Here, "lockscreen" means the waiting screen that shows "See the BitBoxApp"
+ /// and the (possibly empty) device name.
async fn startup();
fn reboot(&mut self) -> !;
diff --git a/src/rust/bitbox-hal/src/ui.rs b/src/rust/bitbox-hal/src/ui.rs
index 746845d..f922a01 100644
--- a/src/rust/bitbox-hal/src/ui.rs
+++ b/src/rust/bitbox-hal/src/ui.rs
@@ -85,6 +85,10 @@ pub trait Ui {
async fn status(&mut self, title: &str, status_success: bool);
+ /// Switches the waiting screen from the lockscreen (as described in
+ /// [`crate::system::System::startup`]) to the BitBox logo.
+ fn switch_to_logo(&mut self);
+
fn progress_create(&mut self, title: &str) -> Self::Progress;
/// If `can_cancel` is `Yes`, the workflow can be cancelled.
diff --git a/src/rust/bitbox02-rust/src/hal/testing/ui.rs b/src/rust/bitbox02-rust/src/hal/testing/ui.rs
index efb7ee5..0a11bc9 100644
--- a/src/rust/bitbox02-rust/src/hal/testing/ui.rs
+++ b/src/rust/bitbox02-rust/src/hal/testing/ui.rs
@@ -138,6 +138,8 @@ impl Ui for TestingUi<'_> {
}
}
+ fn switch_to_logo(&mut self) {}
+
async fn enter_string(
&mut self,
params: &EnterStringParams<'_>,
diff --git a/src/rust/bitbox02-rust/src/hww.rs b/src/rust/bitbox02-rust/src/hww.rs
index 2111f30..f0c55ee 100644
--- a/src/rust/bitbox02-rust/src/hww.rs
+++ b/src/rust/bitbox02-rust/src/hww.rs
@@ -3,7 +3,7 @@
pub mod api;
pub mod noise;
-use crate::hal::Memory;
+use crate::hal::{Memory, Ui};
use alloc::vec::Vec;
const OP_UNLOCK: u8 = b'u';
@@ -106,7 +106,7 @@ pub async fn process_packet(hal: &mut impl crate::hal::Hal, usb_in: Vec<u8>) ->
// connected. When the device is initialized, we delay this until the unlock call, otherwise
// there would be a flicker where the logo would be shown before the host invokes unlock.
if !hal.memory().is_initialized() || usb_in.as_slice() == [OP_UNLOCK] {
- bitbox02::ui::screen_process_waiting_switch_to_logo();
+ hal.ui().switch_to_logo();
}
match usb_in.split_first() {
diff --git a/src/rust/bitbox02/src/hal/ui.rs b/src/rust/bitbox02/src/hal/ui.rs
index 31faa44..a5ddcbb 100644
--- a/src/rust/bitbox02/src/hal/ui.rs
+++ b/src/rust/bitbox02/src/hal/ui.rs
@@ -114,6 +114,11 @@ impl Ui for BitBox02Ui {
crate::ui::status(title, status_success).await
}
+ #[inline(always)]
+ fn switch_to_logo(&mut self) {
+ crate::ui::screen_process_waiting_switch_to_logo();
+ }
+
#[inline(always)]
async fn enter_string(
&mut self,
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.