What changed, and why it matters
This commit is a straightforward internal code cleanup for the Trezor hardware wallet's on-device menu system. It renames function parameters, result types, and message identifiers to be clearer and more consistent (for example, 'pin_code' becomes 'pin_enabled' and 'ScreenBrightness' becomes 'SetBrightness'). No security-sensitive behavior appears to change; the same menu options are still presented and handled the same way.
No security action required. Treat as a normal maintainability refactor; standard review and CI testing are sufficient.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch refactors the device-menu API across the Rust UI layer and the Python homescreen app. Changes are purely nominal: qstr identifiers, enum variants, struct fields, trait method signatures, and Python variable names are renamed for readability. The call sites and control flow in device_menu.py are updated to match the new names. There are no algorithmic, permission, or trust-boundary changes visible in the diff.
Changed components
core/embed/rust/src/ui/api/firmware_micropython.rscore/embed/rust/src/ui/layout/device_menu_result.rscore/embed/rust/src/ui/layout_bolt/ui_firmware.rscore/embed/rust/src/ui/layout_caesar/ui_firmware.rscore/embed/rust/src/ui/layout_delizia/ui_firmware.rscore/embed/rust/src/ui/layout_eckhart/component_msg_obj.rscore/embed/rust/src/ui/layout_eckhart/firmware/device_menu_screen.rscore/embed/rust/src/ui/layout_eckhart/ui_firmware.rscore/embed/rust/src/ui/ui_firmware.rscore/mocks/generated/trezorui_api.pyicore/src/apps/homescreen/device_menu.pycore/embed/rust/librust_qstr.hInspect captured patch +328 / −310
diff --git a/core/embed/rust/librust_qstr.h b/core/embed/rust/librust_qstr.h
index 0b922bc2..8ae7281b 100644
--- a/core/embed/rust/librust_qstr.h
+++ b/core/embed/rust/librust_qstr.h
@@ -18,59 +18,59 @@ static void _librust_qstrs(void) {
MP_QSTR_;
MP_QSTR_ATTACHED;
MP_QSTR_AttachType;
- MP_QSTR_AutoLockBattery;
- MP_QSTR_AutoLockUSB;
MP_QSTR_BACK;
MP_QSTR_BLEIF;
MP_QSTR_BacklightLevels;
MP_QSTR_BackupDevice;
- MP_QSTR_BackupFailed;
MP_QSTR_CANCELLED;
MP_QSTR_CONFIRMED;
MP_QSTR_CheckBackup;
MP_QSTR_DIM;
MP_QSTR_DONE;
- MP_QSTR_DeviceDisconnect;
MP_QSTR_DeviceMenuResult;
- MP_QSTR_DeviceName;
- MP_QSTR_DevicePair;
- MP_QSTR_DeviceUnpair;
- MP_QSTR_DeviceUnpairAll;
- MP_QSTR_HapticFeedback;
+ MP_QSTR_DisconnectDevice;
MP_QSTR_INFO;
MP_QSTR_INITIAL;
MP_QSTR_LOW;
MP_QSTR_LayoutObj;
MP_QSTR_LayoutState;
- MP_QSTR_LedEnabled;
MP_QSTR_MAX;
MP_QSTR_MESSAGE_NAME;
MP_QSTR_MESSAGE_WIRE_TYPE;
- MP_QSTR_MenuRefresh;
MP_QSTR_MessageType;
MP_QSTR_Msg;
MP_QSTR_MsgDef;
MP_QSTR_NONE;
MP_QSTR_NORMAL;
- MP_QSTR_PinCode;
- MP_QSTR_PinRemove;
+ MP_QSTR_PairDevice;
MP_QSTR_RESUME;
MP_QSTR_RX_PACKET_LEN;
MP_QSTR_Reboot;
MP_QSTR_RebootToBootloader;
+ MP_QSTR_RefreshMenu;
+ MP_QSTR_RemovePin;
+ MP_QSTR_RemoveWipeCode;
+ MP_QSTR_ReviewFailedBackup;
MP_QSTR_SWIPE_DOWN;
MP_QSTR_SWIPE_LEFT;
MP_QSTR_SWIPE_RIGHT;
MP_QSTR_SWIPE_UP;
- MP_QSTR_ScreenBrightness;
+ MP_QSTR_SetAutoLockBattery;
+ MP_QSTR_SetAutoLockUSB;
+ MP_QSTR_SetBrightness;
+ MP_QSTR_SetDeviceName;
+ MP_QSTR_SetOrChangePin;
+ MP_QSTR_SetOrChangeWipeCode;
MP_QSTR_TR;
MP_QSTR_TRANSITIONING;
MP_QSTR_TX_PACKET_LEN;
+ MP_QSTR_ToggleHaptics;
+ MP_QSTR_ToggleLed;
MP_QSTR_TranslationsHeader;
MP_QSTR_TurnOff;
- MP_QSTR_WipeCode;
+ MP_QSTR_UnpairAllDevices;
+ MP_QSTR_UnpairDevice;
MP_QSTR_WipeDevice;
- MP_QSTR_WipeRemove;
MP_QSTR___del__;
MP_QSTR___dict__;
MP_QSTR___name__;
@@ -126,13 +126,13 @@ static void _librust_qstrs(void) {
MP_QSTR_attempts;
MP_QSTR_authenticate__confirm_template;
MP_QSTR_authenticate__header;
+ MP_QSTR_auto_lock;
MP_QSTR_auto_lock__change_template;
MP_QSTR_auto_lock__description;
MP_QSTR_auto_lock__on_battery;
MP_QSTR_auto_lock__on_usb;
MP_QSTR_auto_lock__title;
MP_QSTR_auto_lock__turned_on;
- MP_QSTR_auto_lock_delay;
MP_QSTR_back_button;
MP_QSTR_backlight_fade;
MP_QSTR_backlight_get;
@@ -152,6 +152,9 @@ static void _librust_qstrs(void) {
MP_QSTR_backup__title_create_wallet_backup;
MP_QSTR_backup__title_skip;
MP_QSTR_backup__want_to_skip;
+ MP_QSTR_backup_check_allowed;
+ MP_QSTR_backup_failed;
+ MP_QSTR_backup_needed;
MP_QSTR_bitcoin__commitment_data;
MP_QSTR_bitcoin__confirm_locktime;
MP_QSTR_bitcoin__create_proof_of_ownership;
@@ -202,6 +205,7 @@ static void _librust_qstrs(void) {
MP_QSTR_bootscreen;
MP_QSTR_br_code;
MP_QSTR_br_name;
+ MP_QSTR_brightness;
MP_QSTR_brightness__change_title;
MP_QSTR_brightness__changed_title;
MP_QSTR_brightness__title;
@@ -255,7 +259,6 @@ static void _librust_qstrs(void) {
MP_QSTR_cancel;
MP_QSTR_cancel_text;
MP_QSTR_case_sensitive;
- MP_QSTR_check_backup;
MP_QSTR_check_homescreen_format;
MP_QSTR_chunkify;
MP_QSTR_code;
@@ -329,7 +332,6 @@ static void _librust_qstrs(void) {
MP_QSTR_extra_item;
MP_QSTR_extra_items;
MP_QSTR_extra_title;
- MP_QSTR_failed_backup;
MP_QSTR_fee;
MP_QSTR_fee_items;
MP_QSTR_fee_label;
@@ -346,11 +348,11 @@ static void _librust_qstrs(void) {
MP_QSTR_get_bonds;
MP_QSTR_get_language;
MP_QSTR_get_transition_out;
- MP_QSTR_haptic_feedback;
MP_QSTR_haptic_feedback__disable;
MP_QSTR_haptic_feedback__enable;
MP_QSTR_haptic_feedback__subtitle;
MP_QSTR_haptic_feedback__title;
+ MP_QSTR_haptics_enabled;
MP_QSTR_hint;
MP_QSTR_hold;
MP_QSTR_hold_danger;
@@ -378,7 +380,7 @@ static void _librust_qstrs(void) {
MP_QSTR_info;
MP_QSTR_info_button;
MP_QSTR_init;
- MP_QSTR_init_submenu;
+ MP_QSTR_init_submenu_idx;
MP_QSTR_inputs__back;
MP_QSTR_inputs__cancel;
MP_QSTR_inputs__delete;
@@ -466,7 +468,6 @@ static void _librust_qstrs(void) {
MP_QSTR_modify_fee__transaction_fee;
MP_QSTR_more_info_callback;
MP_QSTR_multiple_pages_texts;
- MP_QSTR_needs_backup;
MP_QSTR_notification;
MP_QSTR_notification_level;
MP_QSTR_page_count;
@@ -531,7 +532,7 @@ static void _librust_qstrs(void) {
MP_QSTR_pin__wipe_code_exists_description;
MP_QSTR_pin__wipe_code_exists_title;
MP_QSTR_pin__wrong_pin;
- MP_QSTR_pin_code;
+ MP_QSTR_pin_enabled;
MP_QSTR_plurals__contains_x_keys;
MP_QSTR_plurals__lock_after_x_days;
MP_QSTR_plurals__lock_after_x_hours;
@@ -740,7 +741,6 @@ static void _librust_qstrs(void) {
MP_QSTR_safety_checks__enforce_strict;
MP_QSTR_safety_checks__title;
MP_QSTR_safety_checks__title_safety_override;
- MP_QSTR_screen_brightness;
MP_QSTR_sd_card__all_data_will_be_lost;
MP_QSTR_sd_card__card_required;
MP_QSTR_sd_card__disable;
@@ -930,7 +930,6 @@ static void _librust_qstrs(void) {
MP_QSTR_wipe__start_again;
MP_QSTR_wipe__title;
MP_QSTR_wipe__want_to_wipe;
- MP_QSTR_wipe_code;
MP_QSTR_wipe_code__cancel_setup;
MP_QSTR_wipe_code__change;
MP_QSTR_wipe_code__change_question;
@@ -953,6 +952,7 @@ static void _librust_qstrs(void) {
MP_QSTR_wipe_code__turn_off;
MP_QSTR_wipe_code__turn_on;
MP_QSTR_wipe_code__wipe_code_mismatch;
+ MP_QSTR_wipe_code_enabled;
MP_QSTR_word_count__title;
MP_QSTR_words;
MP_QSTR_words__about;
diff --git a/core/embed/rust/src/ui/api/firmware_micropython.rs b/core/embed/rust/src/ui/api/firmware_micropython.rs
index 7dbeca0e..78eea09b 100644
--- a/core/embed/rust/src/ui/api/firmware_micropython.rs
+++ b/core/embed/rust/src/ui/api/firmware_micropython.rs
@@ -937,44 +937,48 @@ extern "C" fn new_show_homescreen(n_args: usize, args: *const Obj, kwargs: *mut
extern "C" fn new_show_device_menu(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
let block = move |_args: &[Obj], kwargs: &Map| {
- let init_submenu: Option<u8> = kwargs.get(Qstr::MP_QSTR_init_submenu)?.try_into_option()?;
- let failed_backup: bool = kwargs.get(Qstr::MP_QSTR_failed_backup)?.try_into()?;
- let needs_backup: bool = kwargs.get(Qstr::MP_QSTR_needs_backup)?.try_into()?;
+ let init_submenu_idx: Option<u8> = kwargs
+ .get(Qstr::MP_QSTR_init_submenu_idx)?
+ .try_into_option()?;
+ let backup_failed: bool = kwargs.get(Qstr::MP_QSTR_backup_failed)?.try_into()?;
+ let backup_needed: bool = kwargs.get(Qstr::MP_QSTR_backup_needed)?.try_into()?;
let paired_devices: Obj = kwargs.get(Qstr::MP_QSTR_paired_devices)?;
let paired_devices: Vec<TString, MAX_PAIRED_DEVICES> = util::iter_into_vec(paired_devices)?;
let connected_idx: Option<u8> =
kwargs.get(Qstr::MP_QSTR_connected_idx)?.try_into_option()?;
- let pin_code: Option<bool> = kwargs.get(Qstr::MP_QSTR_pin_code)?.try_into_option()?;
- let auto_lock_delay: Option<[TString; 2]> = kwargs
- .get(Qstr::MP_QSTR_auto_lock_delay)?
+ let pin_enabled: Option<bool> = kwargs.get(Qstr::MP_QSTR_pin_enabled)?.try_into_option()?;
+ let auto_lock: Option<[TString; 2]> = kwargs
+ .get(Qstr::MP_QSTR_auto_lock)?
.try_into_option()?
.map(util::iter_into_array)
.transpose()?;
- let wipe_code: Option<bool> = kwargs.get(Qstr::MP_QSTR_wipe_code)?.try_into_option()?;
- let check_backup: bool = kwargs.get(Qstr::MP_QSTR_check_backup)?.try_into()?;
+ let wipe_code_enabled: Option<bool> = kwargs
+ .get(Qstr::MP_QSTR_wipe_code_enabled)?
+ .try_into_option()?;
+ let backup_check_allowed: bool =
+ kwargs.get(Qstr::MP_QSTR_backup_check_allowed)?.try_into()?;
let device_name: Option<TString> =
kwargs.get(Qstr::MP_QSTR_device_name)?.try_into_option()?;
- let screen_brightness: Option<TString> = kwargs
- .get(Qstr::MP_QSTR_screen_brightness)?
- .try_into_option()?;
- let haptic_feedback: Option<bool> = kwargs
- .get(Qstr::MP_QSTR_haptic_feedback)?
+ let brightness: Option<TString> =
+ kwargs.get(Qstr::MP_QSTR_brightness)?.try_into_option()?;
+ let haptics_enabled: Option<bool> = kwargs
+ .get(Qstr::MP_QSTR_haptics_enabled)?
.try_into_option()?;
let led_enabled: Option<bool> = kwargs.get(Qstr::MP_QSTR_led_enabled)?.try_into_option()?;
let about_items: Obj = kwargs.get(Qstr::MP_QSTR_about_items)?;
let layout = ModelUI::show_device_menu(
- init_submenu,
- failed_backup,
- needs_backup,
+ init_submenu_idx,
+ backup_failed,
+ backup_needed,
paired_devices,
connected_idx,
- pin_code,
- auto_lock_delay,
- wipe_code,
- check_backup,
+ pin_enabled,
+ auto_lock,
+ wipe_code_enabled,
+ backup_check_allowed,
device_name,
- screen_brightness,
- haptic_feedback,
+ brightness,
+ haptics_enabled,
led_enabled,
about_items,
)?;
@@ -1919,18 +1923,18 @@ pub static mp_module_trezorui_api: Module = obj_module! {
/// def show_device_menu(
/// *,
- /// init_submenu: int | None,
- /// failed_backup: bool,
- /// needs_backup: bool,
+ /// init_submenu_idx: int | None,
+ /// backup_failed: bool,
+ /// backup_needed: bool,
/// paired_devices: Iterable[str],
/// connected_idx: int | None,
- /// pin_code: bool | None,
- /// auto_lock_delay: tuple[str, str] | None,
- /// wipe_code: bool | None,
- /// check_backup: bool,
+ /// pin_enabled: bool | None,
+ /// auto_lock: tuple[str, str] | None,
+ /// wipe_code_enabled: bool | None,
+ /// backup_check_allowed: bool,
/// device_name: str | None,
- /// screen_brightness: str | None,
- /// haptic_feedback: bool | None,
+ /// brightness: str | None,
+ /// haptics_enabled: bool | None,
/// led_enabled: bool | None,
/// about_items: list[tuple[str | None, str | bytes | None, bool | None]],
/// ) -> LayoutObj[UiResult | DeviceMenuResult | tuple[DeviceMenuResult, int]]:
@@ -2138,27 +2142,27 @@ pub static mp_module_trezorui_api: Module = obj_module! {
/// class DeviceMenuResult:
/// """Result of a device menu operation."""
- /// BackupFailed: ClassVar[DeviceMenuResult]
+ /// ReviewFailedBackup: ClassVar[DeviceMenuResult]
/// BackupDevice: ClassVar[DeviceMenuResult]
- /// DeviceDisconnect: ClassVar[DeviceMenuResult]
- /// DevicePair: ClassVar[DeviceMenuResult]
- /// DeviceUnpair: ClassVar[DeviceMenuResult]
- /// DeviceUnpairAll: ClassVar[DeviceMenuResult]
- /// PinCode: ClassVar[DeviceMenuResult]
- /// PinRemove: ClassVar[DeviceMenuResult]
- /// AutoLockBattery: ClassVar[DeviceMenuResult]
- /// AutoLockUSB: ClassVar[DeviceMenuResult]
- /// WipeCode: ClassVar[DeviceMenuResult]
- /// WipeRemove: ClassVar[DeviceMenuResult]
+ /// DisconnectDevice: ClassVar[DeviceMenuResult]
+ /// PairDevice: ClassVar[DeviceMenuResult]
+ /// UnpairDevice: ClassVar[DeviceMenuResult]
+ /// UnpairAllDevices: ClassVar[DeviceMenuResult]
+ /// SetOrChangePin: ClassVar[DeviceMenuResult]
+ /// RemovePin: ClassVar[DeviceMenuResult]
+ /// SetAutoLockBattery: ClassVar[DeviceMenuResult]
+ /// SetAutoLockUSB: ClassVar[DeviceMenuResult]
+ /// SetOrChangeWipeCode: ClassVar[DeviceMenuResult]
+ /// RemoveWipeCode: ClassVar[DeviceMenuResult]
/// CheckBackup: ClassVar[DeviceMenuResult]
- /// DeviceName: ClassVar[DeviceMenuResult]
- /// ScreenBrightness: ClassVar[DeviceMenuResult]
- /// HapticFeedback: ClassVar[DeviceMenuResult]
- /// LedEnabled: ClassVar[DeviceMenuResult]
+ /// SetDeviceName: ClassVar[DeviceMenuResult]
+ /// SetBrightness: ClassVar[DeviceMenuResult]
+ /// ToggleHaptics: ClassVar[DeviceMenuResult]
+ /// ToggleLed: ClassVar[DeviceMenuResult]
/// WipeDevice: ClassVar[DeviceMenuResult]
/// Reboot: ClassVar[DeviceMenuResult]
/// RebootToBootloader: ClassVar[DeviceMenuResult]
/// TurnOff: ClassVar[DeviceMenuResult]
- /// MenuRefresh: ClassVar[DeviceMenuResult]
+ /// RefreshMenu: ClassVar[DeviceMenuResult]
Qstr::MP_QSTR_DeviceMenuResult => DEVICE_MENU_RESULT.as_obj(),
};
diff --git a/core/embed/rust/src/ui/layout/device_menu_result.rs b/core/embed/rust/src/ui/layout/device_menu_result.rs
index 9f50d9a6..94b53d89 100644
--- a/core/embed/rust/src/ui/layout/device_menu_result.rs
+++ b/core/embed/rust/src/ui/layout/device_menu_result.rs
@@ -8,60 +8,61 @@ use crate::micropython::{
static DEVICE_MENU_RESULT_BASE_TYPE: Type = obj_type! { name: Qstr::MP_QSTR_DeviceMenuResult, };
// Root menu
-pub static BACKUP_FAILED: SimpleTypeObj = SimpleTypeObj::new(&DEVICE_MENU_RESULT_BASE_TYPE);
+pub static REVIEW_FAILED_BACKUP: SimpleTypeObj = SimpleTypeObj::new(&DEVICE_MENU_RESULT_BASE_TYPE);
pub static BACKUP_DEVICE: SimpleTypeObj = SimpleTypeObj::new(&DEVICE_MENU_RESULT_BASE_TYPE);
// "Pair & Connect"
-pub static DEVICE_PAIR: SimpleTypeObj = SimpleTypeObj::new(&DEVICE_MENU_RESULT_BASE_TYPE);
-pub static DEVICE_DISCONNECT: SimpleTypeObj = SimpleTypeObj::new(&DEVICE_MENU_RESULT_BASE_TYPE);
-pub static DEVICE_UNPAIR: SimpleTypeObj = SimpleTypeObj::new(&DEVICE_MENU_RESULT_BASE_TYPE);
-pub static DEVICE_UNPAIR_ALL: SimpleTypeObj = SimpleTypeObj::new(&DEVICE_MENU_RESULT_BASE_TYPE);
+pub static PAIR_DEVICE: SimpleTypeObj = SimpleTypeObj::new(&DEVICE_MENU_RESULT_BASE_TYPE);
+pub static DISCONNECT_DEVICE: SimpleTypeObj = SimpleTypeObj::new(&DEVICE_MENU_RESULT_BASE_TYPE);
+pub static UNPAIR_DEVICE: SimpleTypeObj = SimpleTypeObj::new(&DEVICE_MENU_RESULT_BASE_TYPE);
+pub static UNPAIR_ALL_DEVICES: SimpleTypeObj = SimpleTypeObj::new(&DEVICE_MENU_RESULT_BASE_TYPE);
// Security menu
-pub static PIN_CODE: SimpleTypeObj = SimpleTypeObj::new(&DEVICE_MENU_RESULT_BASE_TYPE);
-pub static PIN_REMOVE: SimpleTypeObj = SimpleTypeObj::new(&DEVICE_MENU_RESULT_BASE_TYPE);
-pub static AUTO_LOCK_BATTERY: SimpleTypeObj = SimpleTypeObj::new(&DEVICE_MENU_RESULT_BASE_TYPE);
-pub static AUTO_LOCK_USB: SimpleTypeObj = SimpleTypeObj::new(&DEVICE_MENU_RESULT_BASE_TYPE);
-pub static WIPE_CODE: SimpleTypeObj = SimpleTypeObj::new(&DEVICE_MENU_RESULT_BASE_TYPE);
-pub static WIPE_REMOVE: SimpleTypeObj = SimpleTypeObj::new(&DEVICE_MENU_RESULT_BASE_TYPE);
+pub static SET_OR_CHANGE_PIN: SimpleTypeObj = SimpleTypeObj::new(&DEVICE_MENU_RESULT_BASE_TYPE);
+pub static REMOVE_PIN: SimpleTypeObj = SimpleTypeObj::new(&DEVICE_MENU_RESULT_BASE_TYPE);
+pub static SET_AUTO_LOCK_BATTERY: SimpleTypeObj = SimpleTypeObj::new(&DEVICE_MENU_RESULT_BASE_TYPE);
+pub static SET_AUTO_LOCK_USB: SimpleTypeObj = SimpleTypeObj::new(&DEVICE_MENU_RESULT_BASE_TYPE);
+pub static SET_OR_CHANGE_WIPE_CODE: SimpleTypeObj =
+ SimpleTypeObj::new(&DEVICE_MENU_RESULT_BASE_TYPE);
+pub static REMOVE_WIPE_CODE: SimpleTypeObj = SimpleTypeObj::new(&DEVICE_MENU_RESULT_BASE_TYPE);
pub static CHECK_BACKUP: SimpleTypeObj = SimpleTypeObj::new(&DEVICE_MENU_RESULT_BASE_TYPE);
// Device menu
-pub static DEVICE_NAME: SimpleTypeObj = SimpleTypeObj::new(&DEVICE_MENU_RESULT_BASE_TYPE);
-pub static SCREEN_BRIGHTNESS: SimpleTypeObj = SimpleTypeObj::new(&DEVICE_MENU_RESULT_BASE_TYPE);
-pub static HAPTIC_FEEDBACK: SimpleTypeObj = SimpleTypeObj::new(&DEVICE_MENU_RESULT_BASE_TYPE);
-pub static LED_ENABLED: SimpleTypeObj = SimpleTypeObj::new(&DEVICE_MENU_RESULT_BASE_TYPE);
+pub static SET_DEVICE_NAME: SimpleTypeObj = SimpleTypeObj::new(&DEVICE_MENU_RESULT_BASE_TYPE);
+pub static SET_BRIGHTNESS: SimpleTypeObj = SimpleTypeObj::new(&DEVICE_MENU_RESULT_BASE_TYPE);
+pub static TOGGLE_HAPTICS: SimpleTypeObj = SimpleTypeObj::new(&DEVICE_MENU_RESULT_BASE_TYPE);
+pub static TOGGLE_LED: SimpleTypeObj = SimpleTypeObj::new(&DEVICE_MENU_RESULT_BASE_TYPE);
pub static WIPE_DEVICE: SimpleTypeObj = SimpleTypeObj::new(&DEVICE_MENU_RESULT_BASE_TYPE);
// Power settings
pub static TURN_OFF: SimpleTypeObj = SimpleTypeObj::new(&DEVICE_MENU_RESULT_BASE_TYPE);
pub static REBOOT: SimpleTypeObj = SimpleTypeObj::new(&DEVICE_MENU_RESULT_BASE_TYPE);
pub static REBOOT_TO_BOOTLOADER: SimpleTypeObj = SimpleTypeObj::new(&DEVICE_MENU_RESULT_BASE_TYPE);
// Misc
-pub static MENU_REFRESH: SimpleTypeObj = SimpleTypeObj::new(&DEVICE_MENU_RESULT_BASE_TYPE);
+pub static REFRESH_MENU: SimpleTypeObj = SimpleTypeObj::new(&DEVICE_MENU_RESULT_BASE_TYPE);
// Create a DeviceMenuResult class that contains all result types
static DEVICE_MENU_RESULT_TYPE: Type = obj_type! {
name: Qstr::MP_QSTR_DeviceMenuResult,
locals: &obj_dict! { obj_map! {
- Qstr::MP_QSTR_BackupFailed => BACKUP_FAILED.as_obj(),
+ Qstr::MP_QSTR_ReviewFailedBackup => REVIEW_FAILED_BACKUP.as_obj(),
Qstr::MP_QSTR_BackupDevice => BACKUP_DEVICE.as_obj(),
- Qstr::MP_QSTR_DevicePair => DEVICE_PAIR.as_obj(),
- Qstr::MP_QSTR_DeviceDisconnect => DEVICE_DISCONNECT.as_obj(),
- Qstr::MP_QSTR_DeviceUnpair => DEVICE_UNPAIR.as_obj(),
- Qstr::MP_QSTR_DeviceUnpairAll => DEVICE_UNPAIR_ALL.as_obj(),
- Qstr::MP_QSTR_PinCode => PIN_CODE.as_obj(),
- Qstr::MP_QSTR_PinRemove => PIN_REMOVE.as_obj(),
- Qstr::MP_QSTR_AutoLockBattery => AUTO_LOCK_BATTERY.as_obj(),
- Qstr::MP_QSTR_AutoLockUSB => AUTO_LOCK_USB.as_obj(),
- Qstr::MP_QSTR_WipeCode => WIPE_CODE.as_obj(),
- Qstr::MP_QSTR_WipeRemove => WIPE_REMOVE.as_obj(),
+ Qstr::MP_QSTR_PairDevice => PAIR_DEVICE.as_obj(),
+ Qstr::MP_QSTR_DisconnectDevice => DISCONNECT_DEVICE.as_obj(),
+ Qstr::MP_QSTR_UnpairDevice => UNPAIR_DEVICE.as_obj(),
+ Qstr::MP_QSTR_UnpairAllDevices => UNPAIR_ALL_DEVICES.as_obj(),
+ Qstr::MP_QSTR_SetOrChangePin => SET_OR_CHANGE_PIN.as_obj(),
+ Qstr::MP_QSTR_RemovePin => REMOVE_PIN.as_obj(),
+ Qstr::MP_QSTR_SetAutoLockBattery => SET_AUTO_LOCK_BATTERY.as_obj(),
+ Qstr::MP_QSTR_SetAutoLockUSB => SET_AUTO_LOCK_USB.as_obj(),
+ Qstr::MP_QSTR_SetOrChangeWipeCode => SET_OR_CHANGE_WIPE_CODE.as_obj(),
+ Qstr::MP_QSTR_RemoveWipeCode => REMOVE_WIPE_CODE.as_obj(),
Qstr::MP_QSTR_CheckBackup => CHECK_BACKUP.as_obj(),
- Qstr::MP_QSTR_DeviceName => DEVICE_NAME.as_obj(),
- Qstr::MP_QSTR_ScreenBrightness => SCREEN_BRIGHTNESS.as_obj(),
- Qstr::MP_QSTR_HapticFeedback => HAPTIC_FEEDBACK.as_obj(),
- Qstr::MP_QSTR_LedEnabled => LED_ENABLED.as_obj(),
+ Qstr::MP_QSTR_SetDeviceName => SET_DEVICE_NAME.as_obj(),
+ Qstr::MP_QSTR_SetBrightness => SET_BRIGHTNESS.as_obj(),
+ Qstr::MP_QSTR_ToggleHaptics => TOGGLE_HAPTICS.as_obj(),
+ Qstr::MP_QSTR_ToggleLed => TOGGLE_LED.as_obj(),
Qstr::MP_QSTR_WipeDevice => WIPE_DEVICE.as_obj(),
Qstr::MP_QSTR_TurnOff => TURN_OFF.as_obj(),
Qstr::MP_QSTR_Reboot => REBOOT.as_obj(),
Qstr::MP_QSTR_RebootToBootloader => REBOOT_TO_BOOTLOADER.as_obj(),
- Qstr::MP_QSTR_MenuRefresh => MENU_REFRESH.as_obj(),
+ Qstr::MP_QSTR_RefreshMenu => REFRESH_MENU.as_obj(),
} },
};
diff --git a/core/embed/rust/src/ui/layout_bolt/ui_firmware.rs b/core/embed/rust/src/ui/layout_bolt/ui_firmware.rs
index 5748b2af..a815c1c3 100644
--- a/core/embed/rust/src/ui/layout_bolt/ui_firmware.rs
+++ b/core/embed/rust/src/ui/layout_bolt/ui_firmware.rs
@@ -935,18 +935,18 @@ impl FirmwareUI for UIBolt {
}
fn show_device_menu(
- _init_submenu: Option<u8>,
- _failed_backup: bool,
- _needs_backup: bool,
+ _init_submenu_idx: Option<u8>,
+ _backup_failed: bool,
+ _backup_needed: bool,
_paired_devices: heapless::Vec<TString<'static>, MAX_PAIRED_DEVICES>,
_connected_idx: Option<u8>,
- _pin_code: Option<bool>,
- _auto_lock_delay: Option<[TString<'static>; 2]>,
- _wipe_code: Option<bool>,
- _check_backup: bool,
+ _pin_enabled: Option<bool>,
+ _auto_lock: Option<[TString<'static>; 2]>,
+ _wipe_code_enabled: Option<bool>,
+ _backup_check_allowed: bool,
_device_name: Option<TString<'static>>,
- _screen_brightness: Option<TString<'static>>,
- _haptic_feedback: Option<bool>,
+ _brightness: Option<TString<'static>>,
+ _haptics_enabled: Option<bool>,
_led_enabled: Option<bool>,
_about_items: Obj,
) -> Result<impl LayoutMaybeTrace, Error> {
diff --git a/core/embed/rust/src/ui/layout_caesar/ui_firmware.rs b/core/embed/rust/src/ui/layout_caesar/ui_firmware.rs
index 3f4cc226..0ee0caea 100644
--- a/core/embed/rust/src/ui/layout_caesar/ui_firmware.rs
+++ b/core/embed/rust/src/ui/layout_caesar/ui_firmware.rs
@@ -1132,18 +1132,18 @@ impl FirmwareUI for UICaesar {
}
fn show_device_menu(
- _init_submenu: Option<u8>,
- _failed_backup: bool,
- _needs_backup: bool,
+ _init_submenu_idx: Option<u8>,
+ _backup_failed: bool,
+ _backup_needed: bool,
_paired_devices: heapless::Vec<TString<'static>, MAX_PAIRED_DEVICES>,
_connected_idx: Option<u8>,
- _pin_code: Option<bool>,
- _auto_lock_delay: Option<[TString<'static>; 2]>,
- _wipe_code: Option<bool>,
- _check_backup: bool,
+ _pin_enabled: Option<bool>,
+ _auto_lock: Option<[TString<'static>; 2]>,
+ _wipe_code_enabled: Option<bool>,
+ _backup_check_allowed: bool,
_device_name: Option<TString<'static>>,
- _screen_brightness: Option<TString<'static>>,
- _haptic_feedback: Option<bool>,
+ _brightness: Option<TString<'static>>,
+ _haptics_enabled: Option<bool>,
_led_enabled: Option<bool>,
_about_items: Obj,
) -> Result<impl LayoutMaybeTrace, Error> {
diff --git a/core/embed/rust/src/ui/layout_delizia/ui_firmware.rs b/core/embed/rust/src/ui/layout_delizia/ui_firmware.rs
index 6f16d812..6babf624 100644
--- a/core/embed/rust/src/ui/layout_delizia/ui_firmware.rs
+++ b/core/embed/rust/src/ui/layout_delizia/ui_firmware.rs
@@ -1017,18 +1017,18 @@ impl FirmwareUI for UIDelizia {
}
fn show_device_menu(
- _init_submenu: Option<u8>,
- _failed_backup: bool,
- _needs_backup: bool,
+ _init_submenu_idx: Option<u8>,
+ _backup_failed: bool,
+ _backup_needed: bool,
_paired_devices: heapless::Vec<TString<'static>, MAX_PAIRED_DEVICES>,
_connected_idx: Option<u8>,
- _pin_code: Option<bool>,
- _auto_lock_delay: Option<[TString<'static>; 2]>,
- _wipe_code: Option<bool>,
- _check_backup: bool,
+ _pin_enabled: Option<bool>,
+ _auto_lock: Option<[TString<'static>; 2]>,
+ _wipe_code_enabled: Option<bool>,
+ _backup_check_allowed: bool,
_device_name: Option<TString<'static>>,
- _screen_brightness: Option<TString<'static>>,
- _haptic_feedback: Option<bool>,
+ _brightness: Option<TString<'static>>,
+ _haptics_enabled: Option<bool>,
_led_enabled: Option<bool>,
_about_items: Obj,
) -> Result<impl LayoutMaybeTrace, Error> {
diff --git a/core/embed/rust/src/ui/layout_eckhart/component_msg_obj.rs b/core/embed/rust/src/ui/layout_eckhart/component_msg_obj.rs
index 5ed6be11..6b33a52a 100644
--- a/core/embed/rust/src/ui/layout_eckhart/component_msg_obj.rs
+++ b/core/embed/rust/src/ui/layout_eckhart/component_msg_obj.rs
@@ -158,37 +158,37 @@ impl ComponentMsgObj for DeviceMenuScreen {
fn msg_try_into_obj(&self, msg: Self::Msg) -> Result<Obj, Error> {
match msg {
// Root menu
- DeviceMenuMsg::BackupFailed => Ok(BACKUP_FAILED.as_obj()),
+ DeviceMenuMsg::ReviewFailedBackup => Ok(REVIEW_FAILED_BACKUP.as_obj()),
DeviceMenuMsg::BackupDevice => Ok(BACKUP_DEVICE.as_obj()),
// "Pair & Connect"
- DeviceMenuMsg::DevicePair => Ok(DEVICE_PAIR.as_obj()),
- DeviceMenuMsg::DeviceDisconnect => Ok(DEVICE_DISCONNECT.as_obj()),
- DeviceMenuMsg::DeviceUnpair(index) => {
- Ok(new_tuple(&[DEVICE_UNPAIR.as_obj(), index.into()])?)
+ DeviceMenuMsg::PairDevice => Ok(PAIR_DEVICE.as_obj()),
+ DeviceMenuMsg::DisconnectDevice => Ok(DISCONNECT_DEVICE.as_obj()),
+ DeviceMenuMsg::UnpairDevice(index) => {
+ Ok(new_tuple(&[UNPAIR_DEVICE.as_obj(), index.into()])?)
}
- DeviceMenuMsg::DeviceUnpairAll => Ok(DEVICE_UNPAIR_ALL.as_obj()),
+ DeviceMenuMsg::UnpairAllDevices => Ok(UNPAIR_ALL_DEVICES.as_obj()),
// Security menu
- DeviceMenuMsg::PinCode => Ok(PIN_CODE.as_obj()),
- DeviceMenuMsg::PinRemove => Ok(PIN_REMOVE.as_obj()),
- DeviceMenuMsg::AutoLockBattery => Ok(AUTO_LOCK_BATTERY.as_obj()),
- DeviceMenuMsg::AutoLockUSB => Ok(AUTO_LOCK_USB.as_obj()),
- DeviceMenuMsg::WipeCode => Ok(WIPE_CODE.as_obj()),
- DeviceMenuMsg::WipeRemove => Ok(WIPE_REMOVE.as_obj()),
+ DeviceMenuMsg::SetOrChangePin => Ok(SET_OR_CHANGE_PIN.as_obj()),
+ DeviceMenuMsg::RemovePin => Ok(REMOVE_PIN.as_obj()),
+ DeviceMenuMsg::SetAutoLockBattery => Ok(SET_AUTO_LOCK_BATTERY.as_obj()),
+ DeviceMenuMsg::SetAutoLockUSB => Ok(SET_AUTO_LOCK_USB.as_obj()),
+ DeviceMenuMsg::SetOrChangeWipeCode => Ok(SET_OR_CHANGE_WIPE_CODE.as_obj()),
+ DeviceMenuMsg::RemoveWipeCode => Ok(REMOVE_WIPE_CODE.as_obj()),
DeviceMenuMsg::CheckBackup => Ok(CHECK_BACKUP.as_obj()),
// Device menu
- DeviceMenuMsg::DeviceName => Ok(DEVICE_NAME.as_obj()),
- DeviceMenuMsg::ScreenBrightness => Ok(SCREEN_BRIGHTNESS.as_obj()),
- DeviceMenuMsg::HapticFeedback => Ok(HAPTIC_FEEDBACK.as_obj()),
- DeviceMenuMsg::LedEnabled => Ok(LED_ENABLED.as_obj()),
+ DeviceMenuMsg::SetDeviceName => Ok(SET_DEVICE_NAME.as_obj()),
+ DeviceMenuMsg::SetBrightness => Ok(SET_BRIGHTNESS.as_obj()),
+ DeviceMenuMsg::ToggleHaptics => Ok(TOGGLE_HAPTICS.as_obj()),
+ DeviceMenuMsg::ToggleLed => Ok(TOGGLE_LED.as_obj()),
DeviceMenuMsg::WipeDevice => Ok(WIPE_DEVICE.as_obj()),
// Power settings
DeviceMenuMsg::TurnOff => Ok(TURN_OFF.as_obj()),
DeviceMenuMsg::Reboot => Ok(REBOOT.as_obj()),
DeviceMenuMsg::RebootToBootloader => Ok(REBOOT_TO_BOOTLOADER.as_obj()),
// Misc
- DeviceMenuMsg::MenuRefresh(submenu_id) => {
+ DeviceMenuMsg::RefreshMenu(submenu_id) => {
let submenu_idx: u8 = submenu_id.into();
- Ok(new_tuple(&[MENU_REFRESH.as_obj(), submenu_idx.into()])?)
+ Ok(new_tuple(&[REFRESH_MENU.as_obj(), submenu_idx.into()])?)
}
DeviceMenuMsg::Close => Ok(CANCELLED.as_obj()),
}
diff --git a/core/embed/rust/src/ui/layout_eckhart/firmware/device_menu_screen.rs b/core/embed/rust/src/ui/layout_eckhart/firmware/device_menu_screen.rs
index ad44de2f..53ffacc6 100644
--- a/core/embed/rust/src/ui/layout_eckhart/firmware/device_menu_screen.rs
+++ b/core/embed/rust/src/ui/layout_eckhart/firmware/device_menu_screen.rs
@@ -107,16 +107,16 @@ enum Action {
#[derive(Copy, Clone)]
pub enum DeviceMenuMsg {
// Root menu
- BackupFailed,
+ ReviewFailedBackup,
BackupDevice,
// "Pair & Connect"
- DevicePair, // pair a new device
- DeviceDisconnect, // disconnect a device
- DeviceUnpair(
+ PairDevice, // pair a new device
+ DisconnectDevice, // disconnect a device
+ UnpairDevice(
u8, /* which device to unpair, index in the list of devices */
),
- DeviceUnpairAll,
+ UnpairAllDevices,
// Power
TurnOff,
@@ -124,23 +124,23 @@ pub enum DeviceMenuMsg {
RebootToBootloader,
// Security menu
- PinCode,
- PinRemove,
- AutoLockBattery,
- AutoLockUSB,
- WipeCode,
- WipeRemove,
+ SetOrChangePin,
+ RemovePin,
+ SetAutoLockBattery,
+ SetAutoLockUSB,
+ SetOrChangeWipeCode,
+ RemoveWipeCode,
CheckBackup,
// Device menu
- DeviceName,
- ScreenBrightness,
- HapticFeedback,
- LedEnabled,
+ SetDeviceName,
+ SetBrightness,
+ ToggleHaptics,
+ ToggleLed,
WipeDevice,
// Misc
- MenuRefresh(DeviceMenuId),
+ RefreshMenu(DeviceMenuId),
Close,
}
@@ -305,18 +305,18 @@ pub struct DeviceMenuScreen {
impl DeviceMenuScreen {
#[allow(clippy::too_many_arguments)]
pub fn new(
- init_submenu: Option<u8>,
- failed_backup: bool,
- needs_backup: bool,
+ init_submenu_idx: Option<u8>,
+ backup_failed: bool,
+ backup_needed: bool,
paired_devices: Vec<TString<'static>, MAX_PAIRED_DEVICES>,
connected_idx: Option<u8>,
- pin_code: Option<bool>,
- auto_lock_delay: Option<[TString<'static>; 2]>,
- wipe_code: Option<bool>,
- check_backup: bool,
+ pin_enabled: Option<bool>,
+ auto_lock: Option<[TString<'static>; 2]>,
+ wipe_code_enabled: Option<bool>,
+ backup_check_allowed: bool,
device_name: Option<TString<'static>>,
- screen_brightness: Option<TString<'static>>,
- haptic_feedback: Option<bool>,
+ brightness: Option<TString<'static>>,
+ haptics_enabled: Option<bool>,
led_enabled: Option<bool>,
about_items: Obj,
) -> Result<Self, Error> {
@@ -330,10 +330,19 @@ impl DeviceMenuScreen {
submenu_index: [None; MAX_SUBMENUS],
};
- if pin_code.is_some() || auto_lock_delay.is_some() || wipe_code.is_some() || check_backup {
- screen.register_security_menu(pin_code, auto_lock_delay, wipe_code, check_backup);
+ if pin_enabled.is_some()
+ || auto_lock.is_some()
+ || wipe_code_enabled.is_some()
+ || backup_check_allowed
+ {
+ screen.register_security_menu(
+ pin_enabled,
+ auto_lock,
+ wipe_code_enabled,
+ backup_check_allowed,
+ );
}
- screen.register_device_menu(device_name, screen_brightness, haptic_feedback, led_enabled);
+ screen.register_device_menu(device_name, brightness, haptics_enabled, led_enabled);
screen.register_settings_menu();
screen.register_power_menu();
@@ -349,11 +358,11 @@ impl DeviceMenuScreen {
}
screen.register_pair_and_connect_menu(paired_devices, submenu_indices, connected_idx);
- let pin_unset = pin_code == Some(false);
- screen.register_root_menu(failed_backup, needs_backup, pin_unset, connected_subtext);
+ let pin_unset = pin_enabled == Some(false);
+ screen.register_root_menu(backup_failed, backup_needed, pin_unset, connected_subtext);
// Activate the init submenu
- let init_submenu_id = init_submenu
+ let init_submenu_id = init_submenu_idx
.and_then(|v| DeviceMenuId::try_from(v).ok())
.unwrap_or_default();
@@ -401,10 +410,11 @@ impl DeviceMenuScreen {
items.add(MenuItem::return_msg(
TR::ble__pair_new.into(),
- DeviceMenuMsg::DevicePair,
+ DeviceMenuMsg::PairDevice,
));
let unpair_all_item =
- MenuItem::return_msg(TR::ble__forget_all.into(), DeviceMenuMsg::DeviceUnpairAll).warn();
+ MenuItem::return_msg(TR::ble__forget_all.into(), DeviceMenuMsg::UnpairAllDevices)
+ .warn();
items.add(unpair_all_item);
self.register_submenu(DeviceMenuId::PairAndConnect, Submenu::new(items));
@@ -456,8 +466,8 @@ impl DeviceMenuScreen {
}
.into();
let change_msg = match wipe_code {
- true => DeviceMenuMsg::WipeCode,
- false => DeviceMenuMsg::PinCode,
+ true => DeviceMenuMsg::SetOrChangeWipeCode,
+ false => DeviceMenuMsg::SetOrChangePin,
};
let change_pin_item = MenuItem::return_msg(change_text, change_msg);
items.add(change_pin_item);
@@ -468,8 +478,8 @@ impl DeviceMenuScreen {
}
.into();
let remove_msg = match wipe_code {
- true => DeviceMenuMsg::WipeRemove,
- false => DeviceMenuMsg::PinRemove,
+ true => DeviceMenuMsg::RemoveWipeCode,
+ false => DeviceMenuMsg::RemovePin,
};
let remove_pin_item = MenuItem::return_msg(remove_text, remove_msg).warn();
items.add(remove_pin_item);
@@ -485,14 +495,14 @@ impl DeviceMenuScreen {
let mut items: Vec<MenuItem, MEDIUM_MENU_ITEMS> = Vec::new();
let battery_delay = MenuItem::new(
auto_lock_delay[0],
- Some(Action::Return(DeviceMenuMsg::AutoLockBattery)),
+ Some(Action::Return(DeviceMenuMsg::SetAutoLockBattery)),
)
.with_subtext(Some((TR::auto_lock__on_battery.into(), None)));
items.add(battery_delay);
let usb_delay = MenuItem::new(
auto_lock_delay[1],
- Some(Action::Return(DeviceMenuMsg::AutoLockUSB)),
+ Some(Action::Return(DeviceMenuMsg::SetAutoLockUSB)),
)
.with_subtext(Some((TR::auto_lock__on_usb.into(), None)));
items.add(usb_delay);
@@ -519,7 +529,7 @@ impl DeviceMenuScreen {
)),
)
} else {
- MenuItem::return_msg(TR::pin__title.into(), DeviceMenuMsg::PinCode)
+ MenuItem::return_msg(TR::pin__title.into(), DeviceMenuMsg::SetOrChangePin)
.with_subtext(Some((TR::words__disabled.into(), None)))
};
items.add(item);
@@ -541,8 +551,11 @@ impl DeviceMenuScreen {
Some(&theme::TEXT_MENU_ITEM_SUBTITLE_GREEN),
)))
} else {
- MenuItem::return_msg(TR::wipe_code__title.into(), DeviceMenuMsg::WipeCode)
- .with_subtext(Some((TR::words__disabled.into(), None)))
+ MenuItem::return_msg(
+ TR::wipe_code__title.into(),
+ DeviceMenuMsg::SetOrChangeWipeCode,
+ )
+ .with_subtext(Some((TR::words__disabled.into(), None)))
};
items.add(item);
}
@@ -560,26 +573,26 @@ impl DeviceMenuScreen {
fn register_device_menu(
&mut self,
device_name: Option<TString<'static>>,
- screen_brightness: Option<TString<'static>>,
- haptic_feedback: Option<bool>,
+ brightness: Option<TString<'static>>,
+ haptics_enabled: Option<bool>,
led_enabled: Option<bool>,
) {
let mut items: Vec<MenuItem, MEDIUM_MENU_ITEMS> = Vec::new();
if let Some(device_name) = device_name {
let item_device_name =
- MenuItem::return_msg(TR::words__name.into(), DeviceMenuMsg::DeviceName)
+ MenuItem::return_msg(TR::words__name.into(), DeviceMenuMsg::SetDeviceName)
.with_subtext(Some((device_name, None)))
.with_subtext_marquee();
items.add(item_device_name);
}
- if let Some(brightness) = screen_brightness {
- let brightness_item = MenuItem::return_msg(brightness, DeviceMenuMsg::ScreenBrightness);
+ if let Some(brightness) = brightness {
+ let brightness_item = MenuItem::return_msg(brightness, DeviceMenuMsg::SetBrightness);
items.add(brightness_item);
}
- if let Some(haptic_feedback) = haptic_feedback {
- let subtext = match haptic_feedback {
+ if let Some(haptics_enabled) = haptics_enabled {
+ let subtext = match haptics_enabled {
true => (
TR::words__on.into(),
Some(&theme::TEXT_MENU_ITEM_SUBTITLE_GREEN),
@@ -588,7 +601,7 @@ impl DeviceMenuScreen {
};
let haptic_item = MenuItem::return_msg(
TR::haptic_feedback__title.into(),
- DeviceMenuMsg::HapticFeedback,
+ DeviceMenuMsg::ToggleHaptics,
)
.with_subtext(Some(subtext));
items.add(haptic_item);
@@ -602,7 +615,7 @@ impl DeviceMenuScreen {
),
_ => (TR::words__off.into(), None),
};
- let led_item = MenuItem::return_msg(TR::words__led.into(), DeviceMenuMsg::LedEnabled)
+ let led_item = MenuItem::return_msg(TR::words__led.into(), DeviceMenuMsg::ToggleLed)
.with_subtext(Some(subtext));
items.add(led_item);
}
@@ -628,24 +641,24 @@ impl DeviceMenuScreen {
fn register_root_menu(
&mut self,
- failed_backup: bool,
- needs_backup: bool,
+ backup_failed: bool,
+ backup_needed: bool,
pin_unset: bool,
connected_subtext: Option<TString<'static>>,
) {
let mut items: Vec<MenuItem, MEDIUM_MENU_ITEMS> = Vec::new();
- if failed_backup {
+ if backup_failed {
let item = MenuItem::return_msg(
TR::homescreen__title_backup_failed.into(),
- DeviceMenuMsg::BackupFailed,
+ DeviceMenuMsg::ReviewFailedBackup,
)
.with_subtext(Some((TR::words__review.into(), None)))
.error();
items.add(item);
}
- if needs_backup {
+ if backup_needed {
let item = MenuItem::return_msg(
TR::homescreen__title_backup_needed.into(),
DeviceMenuMsg::BackupDevice,
@@ -658,7 +671,7 @@ impl DeviceMenuScreen {
if pin_unset {
let item = MenuItem::return_msg(
TR::homescreen__title_pin_not_set.into(),
- DeviceMenuMsg::PinCode,
+ DeviceMenuMsg::SetOrChangePin,
)
.with_subtext(Some((TR::words__set.into(), None)))
.light_warn();
@@ -900,7 +913,7 @@ impl Component for DeviceMenuScreen {
ActiveScreen::Empty => DeviceMenuId::Root,
};
- return Some(DeviceMenuMsg::MenuRefresh(submenu_idx));
+ return Some(DeviceMenuMsg::RefreshMenu(submenu_idx));
}
// Handle the event for the active menu
@@ -924,10 +937,10 @@ impl Component for DeviceMenuScreen {
match menu.event(ctx, event) {
Some(VerticalMenuScreenMsg::Selected(button_idx)) => match button_idx {
DISCONNECT_DEVICE_MENU_INDEX if *connected => {
- return Some(DeviceMenuMsg::DeviceDisconnect);
+ return Some(DeviceMenuMsg::DisconnectDevice);
}
_ => {
- return Some(DeviceMenuMsg::DeviceUnpair(*device_idx));
+ return Some(DeviceMenuMsg::UnpairDevice(*device_idx));
}
},
Some(VerticalMenuScreenMsg::Back) => {
diff --git a/core/embed/rust/src/ui/layout_eckhart/ui_firmware.rs b/core/embed/rust/src/ui/layout_eckhart/ui_firmware.rs
index 83349340..ea61a037 100644
--- a/core/embed/rust/src/ui/layout_eckhart/ui_firmware.rs
+++ b/core/embed/rust/src/ui/layout_eckhart/ui_firmware.rs
@@ -1201,34 +1201,34 @@ impl FirmwareUI for UIEckhart {
}
fn show_device_menu(
- init_submenu: Option<u8>,
- failed_backup: bool,
- needs_backup: bool,
+ init_submenu_idx: Option<u8>,
+ backup_failed: bool,
+ backup_needed: bool,
paired_devices: heapless::Vec<TString<'static>, MAX_PAIRED_DEVICES>,
connected_idx: Option<u8>,
- pin_code: Option<bool>,
- auto_lock_delay: Option<[TString<'static>; 2]>,
- wipe_code: Option<bool>,
- check_backup: bool,
+ pin_enabled: Option<bool>,
+ auto_lock: Option<[TString<'static>; 2]>,
+ wipe_code_enabled: Option<bool>,
+ backup_check_allowed: bool,
device_name: Option<TString<'static>>,
- screen_brightness: Option<TString<'static>>,
- haptic_feedback: Option<bool>,
+ brightness: Option<TString<'static>>,
+ haptics_enabled: Option<bool>,
led_enabled: Option<bool>,
about_items: Obj,
) -> Result<impl LayoutMaybeTrace, Error> {
let layout = RootComponent::new(DeviceMenuScreen::new(
- init_submenu,
- failed_backup,
- needs_backup,
+ init_submenu_idx,
+ backup_failed,
+ backup_needed,
paired_devices,
connected_idx,
- pin_code,
- auto_lock_delay,
- wipe_code,
- check_backup,
+ pin_enabled,
+ auto_lock,
+ wipe_code_enabled,
+ backup_check_allowed,
device_name,
- screen_brightness,
- haptic_feedback,
+ brightness,
+ haptics_enabled,
led_enabled,
about_items,
)?);
diff --git a/core/embed/rust/src/ui/ui_firmware.rs b/core/embed/rust/src/ui/ui_firmware.rs
index 9a1360e5..261a9e20 100644
--- a/core/embed/rust/src/ui/ui_firmware.rs
+++ b/core/embed/rust/src/ui/ui_firmware.rs
@@ -362,18 +362,18 @@ pub trait FirmwareUI {
#[allow(clippy::too_many_arguments)]
fn show_device_menu(
- init_submenu: Option<u8>,
- failed_backup: bool,
- needs_backup: bool,
+ init_submenu_idx: Option<u8>,
+ backup_failed: bool,
+ backup_needed: bool,
paired_devices: heapless::Vec<TString<'static>, MAX_PAIRED_DEVICES>,
connected_idx: Option<u8>,
- pin_code: Option<bool>,
- auto_lock_delay: Option<[TString<'static>; 2]>,
- wipe_code: Option<bool>,
- check_backup: bool,
+ pin_enabled: Option<bool>,
+ auto_lock: Option<[TString<'static>; 2]>,
+ wipe_code_enabled: Option<bool>,
+ backup_check_allowed: bool,
device_name: Option<TString<'static>>,
- screen_brightness: Option<TString<'static>>,
- haptic_feedback: Option<bool>,
+ brightness: Option<TString<'static>>,
+ haptics_enabled: Option<bool>,
led_enabled: Option<bool>,
about_items: Obj,
) -> Result<impl LayoutMaybeTrace, Error>;
diff --git a/core/mocks/generated/trezorui_api.pyi b/core/mocks/generated/trezorui_api.pyi
index 3015700a..d54155fc 100644
--- a/core/mocks/generated/trezorui_api.pyi
+++ b/core/mocks/generated/trezorui_api.pyi
@@ -625,18 +625,18 @@ def show_homescreen(
# rust/src/ui/api/firmware_micropython.rs
def show_device_menu(
*,
- init_submenu: int | None,
- failed_backup: bool,
- needs_backup: bool,
+ init_submenu_idx: int | None,
+ backup_failed: bool,
+ backup_needed: bool,
paired_devices: Iterable[str],
connected_idx: int | None,
- pin_code: bool | None,
- auto_lock_delay: tuple[str, str] | None,
- wipe_code: bool | None,
- check_backup: bool,
+ pin_enabled: bool | None,
+ auto_lock: tuple[str, str] | None,
+ wipe_code_enabled: bool | None,
+ backup_check_allowed: bool,
device_name: str | None,
- screen_brightness: str | None,
- haptic_feedback: bool | None,
+ brightness: str | None,
+ haptics_enabled: bool | None,
led_enabled: bool | None,
about_items: list[tuple[str | None, str | bytes | None, bool | None]],
) -> LayoutObj[UiResult | DeviceMenuResult | tuple[DeviceMenuResult, int]]:
@@ -865,25 +865,25 @@ class LayoutState:
# rust/src/ui/api/firmware_micropython.rs
class DeviceMenuResult:
"""Result of a device menu operation."""
- BackupFailed: ClassVar[DeviceMenuResult]
+ ReviewFailedBackup: ClassVar[DeviceMenuResult]
BackupDevice: ClassVar[DeviceMenuResult]
- DeviceDisconnect: ClassVar[DeviceMenuResult]
- DevicePair: ClassVar[DeviceMenuResult]
- DeviceUnpair: ClassVar[DeviceMenuResult]
- DeviceUnpairAll: ClassVar[DeviceMenuResult]
- PinCode: ClassVar[DeviceMenuResult]
- PinRemove: ClassVar[DeviceMenuResult]
- AutoLockBattery: ClassVar[DeviceMenuResult]
- AutoLockUSB: ClassVar[DeviceMenuResult]
- WipeCode: ClassVar[DeviceMenuResult]
- WipeRemove: ClassVar[DeviceMenuResult]
+ DisconnectDevice: ClassVar[DeviceMenuResult]
+ PairDevice: ClassVar[DeviceMenuResult]
+ UnpairDevice: ClassVar[DeviceMenuResult]
+ UnpairAllDevices: ClassVar[DeviceMenuResult]
+ SetOrChangePin: ClassVar[DeviceMenuResult]
+ RemovePin: ClassVar[DeviceMenuResult]
+ SetAutoLockBattery: ClassVar[DeviceMenuResult]
+ SetAutoLockUSB: ClassVar[DeviceMenuResult]
+ SetOrChangeWipeCode: ClassVar[DeviceMenuResult]
+ RemoveWipeCode: ClassVar[DeviceMenuResult]
CheckBackup: ClassVar[DeviceMenuResult]
- DeviceName: ClassVar[DeviceMenuResult]
- ScreenBrightness: ClassVar[DeviceMenuResult]
- HapticFeedback: ClassVar[DeviceMenuResult]
- LedEnabled: ClassVar[DeviceMenuResult]
+ SetDeviceName: ClassVar[DeviceMenuResult]
+ SetBrightness: ClassVar[DeviceMenuResult]
+ ToggleHaptics: ClassVar[DeviceMenuResult]
+ ToggleLed: ClassVar[DeviceMenuResult]
WipeDevice: ClassVar[DeviceMenuResult]
Reboot: ClassVar[DeviceMenuResult]
RebootToBootloader: ClassVar[DeviceMenuResult]
TurnOff: ClassVar[DeviceMenuResult]
- MenuRefresh: ClassVar[DeviceMenuResult]
+ RefreshMenu: ClassVar[DeviceMenuResult]
diff --git a/core/src/apps/homescreen/device_menu.py b/core/src/apps/homescreen/device_menu.py
index d4288d35..b1131d10 100644
--- a/core/src/apps/homescreen/device_menu.py
+++ b/core/src/apps/homescreen/device_menu.py
@@ -73,7 +73,7 @@ async def handle_device_menu() -> None:
assert utils.USE_THP and utils.USE_BLE
from ..thp import paired_cache
- init_submenu = None
+ init_submenu_idx = None
# Remain in the device loop until the menu is explicitly closed
while True:
@@ -81,8 +81,8 @@ async def handle_device_menu() -> None:
is_initialized = storage_device.is_initialized()
led_configurable = is_initialized and utils.USE_RGB_LED
haptic_configurable = is_initialized and utils.USE_HAPTIC
- failed_backup = is_initialized and storage_device.unfinished_backup()
- needs_backup = is_initialized and storage_device.needs_backup()
+ backup_failed = is_initialized and storage_device.unfinished_backup()
+ backup_needed = is_initialized and storage_device.needs_backup()
bonds = ble.get_bonds()
if __debug__:
@@ -111,26 +111,26 @@ async def handle_device_menu() -> None:
menu_result = await interact(
trezorui_api.show_device_menu(
- init_submenu=init_submenu,
- failed_backup=failed_backup,
- needs_backup=needs_backup,
+ init_submenu_idx=init_submenu_idx,
+ backup_failed=backup_failed,
+ backup_needed=backup_needed,
paired_devices=paired_devices,
connected_idx=connected_idx,
- pin_code=config.has_pin() if is_initialized else None,
- auto_lock_delay=get_auto_lock_delay(),
- wipe_code=(
+ pin_enabled=config.has_pin() if is_initialized else None,
+ auto_lock=get_auto_lock_delay(),
+ wipe_code_enabled=(
config.has_wipe_code()
if (is_initialized and config.has_pin())
else None
),
- check_backup=is_initialized,
+ backup_check_allowed=is_initialized,
device_name=(
(storage_device.get_label() or utils.MODEL_FULL_NAME)
if is_initialized
else None
),
- screen_brightness=TR.brightness__title if is_initialized else None,
- haptic_feedback=(
+ brightness=TR.brightness__title if is_initialized else None,
+ haptics_enabled=(
storage_device.get_haptic_feedback()
if haptic_configurable
else None
@@ -148,7 +148,7 @@ async def handle_device_menu() -> None:
raise_on_cancel=None,
)
# Root menu
- if menu_result is DeviceMenuResult.BackupFailed and failed_backup:
+ if menu_result is DeviceMenuResult.ReviewFailedBackup and backup_failed:
from trezor.messages import WipeDevice
from apps.management.wipe_device import wipe_device
@@ -165,10 +165,10 @@ async def handle_device_menu() -> None:
)
await wipe_device(WipeDevice())
except ActionCancelled:
- init_submenu = SubmenuId.ROOT
+ init_submenu_idx = SubmenuId.ROOT
else:
break
- elif menu_result is DeviceMenuResult.BackupDevice and needs_backup:
+ elif menu_result is DeviceMenuResult.BackupDevice and backup_needed:
from trezor.messages import BackupDevice
from apps.management.backup_device import backup_device
@@ -176,19 +176,19 @@ async def handle_device_menu() -> None:
try:
await backup_device(BackupDevice())
except ActionCancelled:
- init_submenu = SubmenuId.ROOT
+ init_submenu_idx = SubmenuId.ROOT
else:
break
# Pair & Connect
- elif menu_result is DeviceMenuResult.DeviceDisconnect and ble.is_connected():
- init_submenu = SubmenuId.PAIR_AND_CONNECT
+ elif menu_result is DeviceMenuResult.DisconnectDevice and ble.is_connected():
+ init_submenu_idx = SubmenuId.PAIR_AND_CONNECT
try:
ble.disconnect()
except ActionCancelled:
pass
finally:
- init_submenu = SubmenuId.PAIR_AND_CONNECT
- elif menu_result is DeviceMenuResult.DevicePair:
+ init_submenu_idx = SubmenuId.PAIR_AND_CONNECT
+ elif menu_result is DeviceMenuResult.PairDevice:
from trezor.ui.layouts import show_warning
from apps.management.ble.pair_new_device import pair_new_device
@@ -208,8 +208,8 @@ async def handle_device_menu() -> None:
except ActionCancelled:
pass
finally:
- init_submenu = SubmenuId.PAIR_AND_CONNECT
- elif menu_result is DeviceMenuResult.DeviceUnpairAll:
+ init_submenu_idx = SubmenuId.PAIR_AND_CONNECT
+ elif menu_result is DeviceMenuResult.UnpairAllDevices:
from trezor.messages import BleUnpair
from apps.management.ble.unpair import unpair
@@ -219,7 +219,7 @@ async def handle_device_menu() -> None:
except ActionCancelled:
pass
finally:
- init_submenu = SubmenuId.PAIR_AND_CONNECT
+ init_submenu_idx = SubmenuId.PAIR_AND_CONNECT
elif isinstance(menu_result, tuple):
from trezor.messages import BleUnpair
@@ -227,20 +227,20 @@ async def handle_device_menu() -> None:
# It's a tuple with (result_type, index)
result_type, index = menu_result
- if result_type is DeviceMenuResult.DeviceUnpair and index < len(bonds):
+ if result_type is DeviceMenuResult.UnpairDevice and index < len(bonds):
try:
await unpair(BleUnpair(addr=bonds[index]))
except ActionCancelled:
pass
finally:
- init_submenu = SubmenuId.PAIR_AND_CONNECT
+ init_submenu_idx = SubmenuId.PAIR_AND_CONNECT
# Refresh only
- elif result_type is DeviceMenuResult.MenuRefresh:
- init_submenu = index
+ elif result_type is DeviceMenuResult.RefreshMenu:
+ init_submenu_idx = index
else:
raise RuntimeError(f"Unknown menu {result_type}, {index}")
# Security settings
- elif menu_result is DeviceMenuResult.PinCode and is_initialized:
+ elif menu_result is DeviceMenuResult.SetOrChangePin and is_initialized:
from trezor.messages import ChangePin
from apps.management.change_pin import change_pin
@@ -250,8 +250,8 @@ async def handle_device_menu() -> None:
except (ActionCancelled, PinCancelled):
pass
finally:
- init_submenu = SubmenuId.SECURITY
- elif menu_result is DeviceMenuResult.PinRemove and config.has_pin():
+ init_submenu_idx = SubmenuId.SECURITY
+ elif menu_result is DeviceMenuResult.RemovePin and config.has_pin():
from trezor.messages import ChangePin
from apps.management.change_pin import change_pin
@@ -261,10 +261,10 @@ async def handle_device_menu() -> None:
except (ActionCancelled, PinCancelled):
pass
finally:
- init_submenu = SubmenuId.SECURITY
+ init_submenu_idx = SubmenuId.SECURITY
elif (
menu_result
- in (DeviceMenuResult.AutoLockUSB, DeviceMenuResult.AutoLockBattery)
+ in (DeviceMenuResult.SetAutoLockUSB, DeviceMenuResult.SetAutoLockBattery)
and config.has_pin()
):
from trezor.messages import ApplySettings
@@ -272,7 +272,7 @@ async def handle_device_menu() -> None:
from apps.management.apply_settings import apply_settings
try:
- if menu_result is DeviceMenuResult.AutoLockUSB:
+ if menu_result is DeviceMenuResult.SetAutoLockUSB:
duration_ms = storage_device.get_autolock_delay_ms()
min_ms = storage_device.AUTOLOCK_DELAY_USB_MIN_MS
max_ms = storage_device.AUTOLOCK_DELAY_USB_MAX_MS
@@ -293,7 +293,7 @@ async def handle_device_menu() -> None:
)
# Necessary for the style check not to raise type error
assert isinstance(auto_lock_delay_ms, int)
- if menu_result is DeviceMenuResult.AutoLockUSB:
+ if menu_result is DeviceMenuResult.SetAutoLockUSB:
settings = ApplySettings(
auto_lock_delay_ms=auto_lock_delay_ms,
)
@@ -305,8 +305,8 @@ async def handle_device_menu() -> None:
except ActionCancelled:
pass
finally:
- init_submenu = SubmenuId.SECURITY
- elif menu_result is DeviceMenuResult.WipeCode and is_initialized:
+ init_submenu_idx = SubmenuId.SECURITY
+ elif menu_result is DeviceMenuResult.SetOrChangeWipeCode and is_initialized:
from trezor.messages import ChangeWipeCode
from apps.management.change_wipe_code import change_wipe_code
@@ -316,8 +316,8 @@ async def handle_device_menu() -> None:
except (ActionCancelled, PinCancelled):
pass
finally:
- init_submenu = SubmenuId.SECURITY
- elif menu_result is DeviceMenuResult.WipeRemove and config.has_wipe_code():
+ init_submenu_idx = SubmenuId.SECURITY
+ elif menu_result is DeviceMenuResult.RemoveWipeCode and config.has_wipe_code():
from trezor.messages import ChangeWipeCode
from apps.management.change_wipe_code import change_wipe_code
@@ -327,7 +327,7 @@ async def handle_device_menu() -> None:
except (ActionCancelled, PinCancelled):
pass
finally:
- init_submenu = SubmenuId.SECURITY
+ init_submenu_idx = SubmenuId.SECURITY
elif menu_result is DeviceMenuResult.CheckBackup and is_initialized:
from trezor.enums import RecoveryType
from trezor.messages import RecoveryDevice
@@ -344,9 +344,9 @@ async def handle_device_menu() -> None:
except ActionCancelled:
pass
finally:
- init_submenu = SubmenuId.SECURITY
+ init_submenu_idx = SubmenuId.SECURITY
# Device settings
- elif menu_result is DeviceMenuResult.DeviceName and is_initialized:
+ elif menu_result is DeviceMenuResult.SetDeviceName and is_initialized:
from trezor.messages import ApplySettings
from apps.management.apply_settings import apply_settings
@@ -367,8 +367,8 @@ async def handle_device_menu() -> None:
except ActionCancelled:
pass
finally:
- init_submenu = SubmenuId.DEVICE
- elif menu_result is DeviceMenuResult.ScreenBrightness and is_initialized:
+ init_submenu_idx = SubmenuId.DEVICE
+ elif menu_result is DeviceMenuResult.SetBrightness and is_initialized:
from trezor.messages import SetBrightness
from apps.management.set_brightness import set_brightness
@@ -378,8 +378,8 @@ async def handle_device_menu() -> None:
except ActionCancelled:
pass
finally:
- init_submenu = SubmenuId.DEVICE
- elif menu_result is DeviceMenuResult.HapticFeedback and haptic_configurable:
+ init_submenu_idx = SubmenuId.DEVICE
+ elif menu_result is DeviceMenuResult.ToggleHaptics and haptic_configurable:
from trezor import io
try:
@@ -389,8 +389,8 @@ async def handle_device_menu() -> None:
except ActionCancelled:
pass
finally:
- init_submenu = SubmenuId.DEVICE
- elif menu_result is DeviceMenuResult.LedEnabled and led_configurable:
+ init_submenu_idx = SubmenuId.DEVICE
+ elif menu_result is DeviceMenuResult.ToggleLed and led_configurable:
from trezor import io
try:
@@ -400,7 +400,7 @@ async def handle_device_menu() -> None:
except ActionCancelled:
pass
finally:
- init_submenu = SubmenuId.DEVICE
+ init_submenu_idx = SubmenuId.DEVICE
elif menu_result is DeviceMenuResult.WipeDevice:
from trezor.messages import WipeDevice
@@ -409,7 +409,7 @@ async def handle_device_menu() -> None:
try:
await wipe_device(WipeDevice())
except ActionCancelled:
- init_submenu = SubmenuId.DEVICE
+ init_submenu_idx = SubmenuId.DEVICE
else:
break
# Power settings
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.