fix(core): restart BLE advertising after suspend/resume
What changed, and why it matters
This commit fixes a bug in the Trezor hardware wallet's Bluetooth handling. When the device went to sleep and woke back up, two internal flags that control whether Bluetooth advertising should restart were not saved and restored. As a result, after suspend/resume the device might not resume broadcasting its Bluetooth signal correctly, which could break wireless pairing/reconnection. The patch simply saves and restores those two flags across sleep/wake cycles.
Treat as a normal reliability/availability bugfix. No urgent security response is indicated from the diff alone. If wireless availability is a security concern for the product, validate that advertising correctly resumes after suspend/resume and that the device does not enter an unexpectedly discoverable or non-discoverable state.
Security signals we found
State not preserved across suspend/resume can cause unexpected post-resume behavior
Bluetooth advertising may fail to restart, affecting availability of wireless connectivity
No cryptographic, authentication, or pairing logic is modified
No buffer, pointer, or integer operations are changed
Evidence from the diff
In core/embed/io/ble, ble_suspend() now persists drv->next_adv_with_disconnect and drv->restart_adv_on_disconnect into the ble_wakeup_params_t snapshot, and ble_resume() restores them into drv. Previously these two state flags were omitted from the wakeup context, so after a suspend/resume cycle the BLE driver would lose its advertising-restart policy. The header adds the two bool fields to the wakeup-params struct. This is a state-consistency fix with no change to protocol logic or cryptographic code.
Changed components
core/embed/io/ble/stm32/ble.ccore/embed/io/ble/inc/io/ble.hTrezor Core BLE driver suspend/resume pathInspect captured patch +6 / −0
diff --git a/core/embed/io/ble/inc/io/ble.h b/core/embed/io/ble/inc/io/ble.h
index b925190b7..e83f9696d 100644
--- a/core/embed/io/ble/inc/io/ble.h
+++ b/core/embed/io/ble/inc/io/ble.h
@@ -92,6 +92,8 @@ typedef struct {
ble_mode_t mode_requested;
bt_le_addr_t connected_addr;
ble_adv_start_cmd_data_t adv_data;
+ bool restart_adv_on_disconnect;
+ bool next_adv_with_disconnect;
} ble_wakeup_params_t;
typedef enum {
diff --git a/core/embed/io/ble/stm32/ble.c b/core/embed/io/ble/stm32/ble.c
index 1a1611c08..aa747a444 100644
--- a/core/embed/io/ble/stm32/ble.c
+++ b/core/embed/io/ble/stm32/ble.c
@@ -665,6 +665,8 @@ void ble_suspend(ble_wakeup_params_t *wakeup_params) {
wakeup_params->mode_requested = drv->mode_requested;
wakeup_params->peer_count = drv->peer_count;
wakeup_params->high_speed = drv->high_speed;
+ wakeup_params->next_adv_with_disconnect = drv->next_adv_with_disconnect;
+ wakeup_params->restart_adv_on_disconnect = drv->restart_adv_on_disconnect;
memcpy(&wakeup_params->adv_data, &drv->adv_cmd, sizeof(drv->adv_cmd));
ble_deinit_common(drv);
@@ -708,6 +710,8 @@ bool ble_resume(const ble_wakeup_params_t *wakeup_params) {
sizeof(drv->connected_addr));
memcpy(&drv->adv_cmd, &wakeup_params->adv_data, sizeof(drv->adv_cmd));
drv->mode_requested = wakeup_params->mode_requested;
+ drv->next_adv_with_disconnect = wakeup_params->next_adv_with_disconnect;
+ drv->restart_adv_on_disconnect = wakeup_params->restart_adv_on_disconnect;
irq_unlock(key);
Why this scored 22/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.