Skip to content

Suspend from application layer #5606

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 21, 2025
Merged

Conversation

obrusvit
Copy link
Contributor

This PR adds the first simplified version of suspend to the application firmware. More improvements will follow.

Description:

  • builds on function suspend introduced to uPy in Firmware autodim #5417
  • power button event is handled before the event is passed to rust layout
    • if PIN is not set
    • if PIN is set: power BTN stops all workflows and locks the device. Repeated power BTN press suspends the device.
  • Wakeup flags handled: BTN/BLE/PWR - all treated equally - wakes up the device

Missing:

  • auto-suspend
  • charging indication on PWR button (when charging starts)

Supersedes #5199

@obrusvit obrusvit requested a review from Copilot August 21, 2025 13:22
@obrusvit obrusvit self-assigned this Aug 21, 2025
@obrusvit obrusvit requested a review from TychoVrahe as a code owner August 21, 2025 13:22
@obrusvit obrusvit added core Trezor Core firmware. Runs on Trezor Model T and Safe models. T3W1 labels Aug 21, 2025
@github-project-automation github-project-automation bot moved this to 🔎 Needs review in Firmware Aug 21, 2025
@obrusvit obrusvit mentioned this pull request Aug 21, 2025
8 tasks
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements a simplified suspend functionality for the Trezor device application firmware. The implementation allows the device to enter a low-power state and wake up on button, BLE, or power events.

  • Adds power button handling that either locks the device (when PIN is set) or suspends it (when no PIN is set)
  • Implements suspend device functionality with configurable wakeup flags
  • Integrates power button event detection into the UI event handling system

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
core/src/trezor/ui/__init__.py Adds power button event handling and integrates suspend functionality into the UI event loop
core/src/apps/management/pm/suspend.py New module implementing the suspend device functionality with wakeup flag handling
core/embed/upymod/qstrdefsport.h Adds string constants for the new suspend module to MicroPython's string table

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link

github-actions bot commented Aug 21, 2025

en main(all)

model device_test click_test persistence_test
T2T1 test(all) main(all) test(all) main(all) test(all) main(all)
T3B1 test(all) main(all) test(all) main(all) test(all) main(all)
T3T1 test(all) main(all) test(all) main(all) test(all) main(all)
T3W1 test(all) main(all) test(all) main(all) test(all) main(all)

Latest CI run: 17131271804

@romanz romanz self-requested a review August 21, 2025 14:42
Copy link
Contributor

@romanz romanz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM % small question:

- power button event is handled before the event is passed to rust
layout

[no changelog]
@obrusvit obrusvit force-pushed the obrusvit/firmware-suspend-simple branch from 3ca5d8b to c7efbf4 Compare August 21, 2025 15:18
@obrusvit obrusvit merged commit dbda8d0 into main Aug 21, 2025
177 of 178 checks passed
@obrusvit obrusvit deleted the obrusvit/firmware-suspend-simple branch August 21, 2025 19:21
@github-project-automation github-project-automation bot moved this from 🔎 Needs review to 🤝 Needs QA in Firmware Aug 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Trezor Core firmware. Runs on Trezor Model T and Safe models. T3W1
Projects
Status: 🤝 Needs QA
Development

Successfully merging this pull request may close these issues.

2 participants