feat(core): add tap-to-wake storage key and syscall interface
What changed, and why it matters
This commit adds a new user-facing setting called 'tap to wake' to the Trezor hardware wallet firmware. It lets users choose whether tapping the touchscreen wakes the device, and stores that preference in device memory. It also adds the low-level system calls needed for the firmware to turn the feature on or off. There is nothing in the commit that fixes a bug or addresses a security vulnerability.
No security action required; treat as a normal feature commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change introduces a persistent boolean storage key _DISABLE_TAP_TO_WAKE (0x27) in core/src/storage/device.py, plus getter/setter helpers. It also adds two new syscalls, SYSCALL_TOUCH_WAKEUP_SET_ENABLED and SYSCALL_TOUCH_WAKEUP_GET_ENABLED, with matching dispatch logic in the STM32 syscall handler and stub implementations. The feature is gated by USE_TOUCH_WAKEUP. No existing behavior is altered and no vulnerability is remediated.
Changed components
core/src/storage/device.pycore/embed/sys/syscall/inc/sys/syscall_numbers.hcore/embed/sys/syscall/stm32/syscall_dispatch.ccore/embed/sys/syscall/stm32/syscall_stubs.cInspect captured patch +42 / −2
diff --git a/core/embed/sys/syscall/inc/sys/syscall_numbers.h b/core/embed/sys/syscall/inc/sys/syscall_numbers.h
index 893b2748..63378080 100644
--- a/core/embed/sys/syscall/inc/sys/syscall_numbers.h
+++ b/core/embed/sys/syscall/inc/sys/syscall_numbers.h
@@ -96,6 +96,8 @@ typedef enum {
SYSCALL_BUTTON_GET_EVENT,
SYSCALL_TOUCH_GET_EVENT,
+ SYSCALL_TOUCH_WAKEUP_SET_ENABLED,
+ SYSCALL_TOUCH_WAKEUP_GET_ENABLED,
SYSCALL_RGB_LED_SET_ENABLED,
SYSCALL_RGB_LED_GET_ENABLED,
diff --git a/core/embed/sys/syscall/stm32/syscall_dispatch.c b/core/embed/sys/syscall/stm32/syscall_dispatch.c
index 14d15c40..c38e83ee 100644
--- a/core/embed/sys/syscall/stm32/syscall_dispatch.c
+++ b/core/embed/sys/syscall/stm32/syscall_dispatch.c
@@ -394,7 +394,18 @@ __attribute((no_stack_protector)) void syscall_handler(uint32_t *args,
case SYSCALL_TOUCH_GET_EVENT: {
args[0] = touch_get_event();
} break;
-#endif
+
+#ifdef USE_TOUCH_WAKEUP
+ case SYSCALL_TOUCH_WAKEUP_SET_ENABLED: {
+ bool enabled = (args[0] != 0);
+ touch_wakeup_set_enabled(enabled);
+ } break;
+
+ case SYSCALL_TOUCH_WAKEUP_GET_ENABLED: {
+ args[0] = touch_wakeup_get_enabled();
+ } break;
+#endif // USE_TOUCH_WAKEUP
+#endif // USE_TOUCH
#ifdef USE_RGB_LED
case SYSCALL_RGB_LED_SET_ENABLED: {
diff --git a/core/embed/sys/syscall/stm32/syscall_stubs.c b/core/embed/sys/syscall/stm32/syscall_stubs.c
index da127d1b..e507546d 100644
--- a/core/embed/sys/syscall/stm32/syscall_stubs.c
+++ b/core/embed/sys/syscall/stm32/syscall_stubs.c
@@ -398,7 +398,19 @@ uint32_t touch_get_event(void) {
return syscall_invoke0(SYSCALL_TOUCH_GET_EVENT);
}
-#endif
+#ifdef USE_TOUCH_WAKEUP
+
+void touch_wakeup_set_enabled(bool enabled) {
+ syscall_invoke1((uint32_t)enabled, SYSCALL_TOUCH_WAKEUP_SET_ENABLED);
+}
+
+bool touch_wakeup_get_enabled(void) {
+ return (bool)syscall_invoke0(SYSCALL_TOUCH_WAKEUP_GET_ENABLED);
+}
+
+#endif // USE_TOUCH_WAKEUP
+
+#endif // USE_TOUCH
// =============================================================================
// rgb_led.h
diff --git a/core/src/storage/device.py b/core/src/storage/device.py
index 72ab926b..b28f0810 100644
--- a/core/src/storage/device.py
+++ b/core/src/storage/device.py
@@ -52,6 +52,7 @@ _DISABLE_BLUETOOTH = const(0x24) # bool (0x01 or empty)
if not utils.BITCOIN_ONLY:
_BINARY_MNEMONIC = const(0x25) # bytes
_DELEGATED_IDENTITY_KEY_ROTATION_INDEX = const(0x26) # int
+_DISABLE_TAP_TO_WAKE = const(0x27) # bool (0x01 or empty)
SAFETY_CHECK_LEVEL_STRICT : Literal[0] = const(0)
@@ -493,6 +494,20 @@ def get_haptic_feedback() -> bool:
return not common.get_bool(_NAMESPACE, _DISABLE_HAPTIC_FEEDBACK, True)
+def set_tap_to_wake(enable: bool) -> None:
+ """
+ Enable or disable tap to wake.
+ """
+ common.set_bool(_NAMESPACE, _DISABLE_TAP_TO_WAKE, not enable, True)
+
+
+def get_tap_to_wake() -> bool:
+ """
+ Get tap to wake enable, default to true if not set.
+ """
+ return not common.get_bool(_NAMESPACE, _DISABLE_TAP_TO_WAKE, True)
+
+
def set_ble(enable: bool) -> None:
"""
Enable or disable Bluetooth.
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.