feat(bluetooth): bootloader after settings reset
This commit is contained in:
parent
bdc706f88d
commit
c49da513b4
4 changed files with 19 additions and 0 deletions
|
@ -143,6 +143,11 @@ config ZMK_BLE_CLEAR_BONDS_ON_START
|
|||
bool "Configuration that clears all bond information from the keyboard on startup."
|
||||
default n
|
||||
|
||||
config ZMK_BOOTLOADER_BLE_CLEAR_BONDS
|
||||
bool "Configuration that resets to bootloader after clearing all bond information"
|
||||
depends on ZMK_BLE_CLEAR_BONDS_ON_START
|
||||
default n
|
||||
|
||||
# HID GATT notifications sent this way are *not* picked up by Linux, and possibly others.
|
||||
config BT_GATT_NOTIFY_MULTIPLE
|
||||
default n
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
CONFIG_ZMK_BLE_CLEAR_BONDS_ON_START=y
|
||||
CONFIG_ZMK_BOOTLOADER_BLE_CLEAR_BONDS=y
|
||||
|
|
|
@ -47,6 +47,10 @@ static uint8_t passkey_digit = 0;
|
|||
|
||||
#endif /* IS_ENABLED(CONFIG_ZMK_BLE_PASSKEY_ENTRY) */
|
||||
|
||||
#if IS_ENABLED(CONFIG_ZMK_BOOTLOADER_BLE_CLEAR_BONDS)
|
||||
#include <sys/reboot.h>
|
||||
#endif
|
||||
|
||||
#if IS_ENABLED(CONFIG_ZMK_SPLIT_ROLE_CENTRAL)
|
||||
#define PROFILE_COUNT (CONFIG_BT_MAX_PAIRED - 1)
|
||||
#else
|
||||
|
@ -585,6 +589,11 @@ static int zmk_ble_init(const struct device *_arg) {
|
|||
LOG_ERR("Failed to delete setting: %d", err);
|
||||
}
|
||||
}
|
||||
#if IS_ENABLED(CONFIG_ZMK_BOOTLOADER_BLE_CLEAR_BONDS)
|
||||
LOG_WRN("Clearing completed, rebooting to bootloader");
|
||||
sys_reboot(0x57);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
bt_conn_cb_register(&conn_callbacks);
|
||||
|
|
|
@ -116,6 +116,10 @@ static int zmk_peripheral_ble_init(const struct device *_arg) {
|
|||
LOG_WRN("Clearing all existing BLE bond information from the keyboard");
|
||||
|
||||
bt_unpair(BT_ID_DEFAULT, NULL);
|
||||
#if IS_ENABLED(CONFIG_ZMK_BOOTLOADER_BLE_CLEAR_BONDS)
|
||||
LOG_WRN("Clearing completed, rebooting to bootloader");
|
||||
sys_reboot(0x57);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
bt_conn_cb_register(&conn_callbacks);
|
||||
|
|
Loading…
Add table
Reference in a new issue