Skip to content

Commit

Permalink
feat(bt): Add more experimental tweaks.
Browse files Browse the repository at this point in the history
* Support auto security upgrade for splits properly.
* Disable 2M and legacy LLCP if the experimental
  Kconfig flag is selected.
  • Loading branch information
petejohanson committed Dec 8, 2023
1 parent 88338a9 commit b2d934f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
22 changes: 13 additions & 9 deletions app/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -144,28 +144,32 @@ if ZMK_BLE

config ZMK_BLE_EXPERIMENTAL_FEATURES
bool "Experimental: Enable experimental/advanced BLE settings/features"
select ZMK_BLE_PASSKEY_ENTRY
select BT_GATT_AUTO_SEC_REQ
select BT_SMP_ALLOW_UNAUTH_OVERWRITE
imply ZMK_BLE_PASSKEY_ENTRY
imply BT_GATT_AUTO_SEC_REQ
imply BT_SMP_ALLOW_UNAUTH_OVERWRITE
help
Enables a combination of settings that are planned to be default in future versions of ZMK.
This includes changes to timing on BLE pairing initation, BT Secure Connection passkey entry,
and allowing overwrite of keys from previously paired hosts.
restores use of the updated/new LLCP implementation, disables 2M PHY support, and allows
overwrite of keys from previously paired hosts.

config ZMK_BLE_PASSKEY_ENTRY
bool "Require passkey entry on the keyboard to complete pairing"
default n
select RING_BUFFER

# BT_TINYCRYPT_ECC is required for BT_SMP_SC_PAIR_ONLY when using HCI
config BT_TINYCRYPT_ECC
default y if BT_HCI && !BT_CTLR

choice BT_LL_SW_LLCP_IMPL
default BT_LL_SW_LLCP_LEGACY
default BT_LL_SW_LLCP_LEGACY if !ZMK_BLE_EXPERIMENTAL_FEATURES

endchoice

config BT_CTLR_PHY_2M
default n if ZMK_BLE_EXPERIMENTAL_FEATURES

# BT_TINYCRYPT_ECC is required for BT_SMP_SC_PAIR_ONLY when using HCI
config BT_TINYCRYPT_ECC
default y if BT_HCI && !BT_CTLR

config SYSTEM_WORKQUEUE_STACK_SIZE
default 4096 if SOC_RP2040
default 2048
Expand Down
2 changes: 2 additions & 0 deletions app/src/split/bluetooth/central.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,11 +397,13 @@ static void split_central_process_connection(struct bt_conn *conn) {

LOG_DBG("Current security for connection: %d", bt_conn_get_security(conn));

#if !IS_ENABLED(CONFIG_BT_GATT_AUTO_SEC_REQ)
err = bt_conn_set_security(conn, BT_SECURITY_L2);
if (err) {
LOG_ERR("Failed to set security (reason %d)", err);
return;
}
#endif // !IS_ENABLED(CONFIG_BT_GATT_AUTO_SEC_REQ)

struct peripheral_slot *slot = peripheral_slot_for_conn(conn);
if (slot == NULL) {
Expand Down
10 changes: 5 additions & 5 deletions docs/docs/config/bluetooth.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ See [Configuration Overview](index.md) for instructions on how to change these s

## Kconfig

| Option | Type | Description | Default |
| -------------------------------------- | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------- |
| `CONFIG_ZMK_BLE_EXPERIMENTAL_FEATURES` | bool | Enables a combination of settings that are planned to be default in future versions of ZMK. This includes changes to timing on BLE pairing initation, BT Secure Connection passkey entry, and allowing overwrite of keys from previously paired hosts. | n |
| `CONFIG_ZMK_BLE_PASSKEY_ENTRY` | bool | Enable passkey entry during pairing for enhanced security. (Note: After enabling this, you will need to re-pair all previously paired hosts) | n |
| `CONFIG_BT_GATT_ENFORCE_SUBSCRIPTION` | bool | Low level setting for GATT subscriptions. Set to `n` to work around an annoying Windows bug with battery notifications. | y |
| Option | Type | Description | Default |
| -------------------------------------- | ---- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| `CONFIG_ZMK_BLE_EXPERIMENTAL_FEATURES` | bool | Enables a combination of settings that are planned to be default in future versions of ZMK. This includes changes to timing on BLE pairing initation, BT Secure Connection passkey entry, restores use of the updated/new LLCP implementation, disables 2M PHY support, and allows overwrite of keys from previously paired hosts. | n |
| `CONFIG_ZMK_BLE_PASSKEY_ENTRY` | bool | Enable passkey entry during pairing for enhanced security. (Note: After enabling this, you will need to re-pair all previously paired hosts) | n |
| `CONFIG_BT_GATT_ENFORCE_SUBSCRIPTION` | bool | Low level setting for GATT subscriptions. Set to `n` to work around an annoying Windows bug with battery notifications. | y |

0 comments on commit b2d934f

Please sign in to comment.