mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-23 15:08:19 +00:00
fix(core/bootloader): close booloader BLE pairing mode dialog on disconnect
[no changelog]
This commit is contained in:
parent
a4ea85bd75
commit
f966119817
@ -142,6 +142,9 @@ bool ble_issue_command(ble_command_t *command);
|
||||
// available.
|
||||
bool ble_get_event(ble_event_t *event);
|
||||
|
||||
// Flushes the BLE event queue
|
||||
void ble_event_flush(void);
|
||||
|
||||
// Retrieves the current state of the BLE module
|
||||
//
|
||||
// Obtains the current operational state of the BLE module.
|
||||
|
@ -712,6 +712,20 @@ bool ble_get_event(ble_event_t *event) {
|
||||
return result;
|
||||
}
|
||||
|
||||
void ble_event_flush(void) {
|
||||
ble_driver_t *drv = &g_ble_driver;
|
||||
|
||||
if (!drv->initialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
irq_key_t key = irq_lock();
|
||||
|
||||
tsqueue_reset(&drv->event_queue);
|
||||
|
||||
irq_unlock(key);
|
||||
}
|
||||
|
||||
void ble_get_state(ble_state_t *state) {
|
||||
const ble_driver_t *drv = &g_ble_driver;
|
||||
|
||||
|
@ -179,6 +179,8 @@ bool ble_iface_start_pairing(void) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ble_event_flush();
|
||||
|
||||
ble_command_t cmd = {
|
||||
.cmd_type = BLE_PAIRING_MODE,
|
||||
.data = {.adv_start =
|
||||
|
@ -74,6 +74,9 @@ impl Component for PairingMode {
|
||||
if let Event::BLE(BLEEvent::PairingCanceled) = event {
|
||||
return Some(PairingMsg::Cancel);
|
||||
}
|
||||
if let Event::BLE(BLEEvent::Disconnected) = event {
|
||||
return Some(PairingMsg::Cancel);
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
|
@ -74,6 +74,9 @@ impl Component for PairingModeScreen {
|
||||
if let Event::BLE(BLEEvent::PairingCanceled) = event {
|
||||
return Some(PairingMsg::Cancel);
|
||||
}
|
||||
if let Event::BLE(BLEEvent::Disconnected) = event {
|
||||
return Some(PairingMsg::Cancel);
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user