Skip to content
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

feat(bt): Add more experimental tweaks. #2062

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/boards/shields/zmk_uno/zmk_uno.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
CONFIG_LOG=y
CONFIG_ZMK_LOG_LEVEL_DBG=y

CONFIG_ZMK_BLE_PASSKEY_ENTRY=n

# Uncomment for Single color backlight
# CONFIG_ZMK_BACKLIGHT=y

Expand Down
2 changes: 2 additions & 0 deletions app/boards/shields/zmk_uno/zmk_uno_split_left.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
CONFIG_LOG=y
CONFIG_ZMK_LOG_LEVEL_DBG=y

CONFIG_ZMK_BLE_PASSKEY_ENTRY=n

# Uncomment for Single color backlight
# CONFIG_ZMK_BACKLIGHT=y

Expand Down
2 changes: 2 additions & 0 deletions app/boards/shields/zmk_uno/zmk_uno_split_right.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
CONFIG_LOG=y
CONFIG_ZMK_LOG_LEVEL_DBG=y

CONFIG_ZMK_BLE_PASSKEY_ENTRY=n

# Uncomment for Single color backlight
# CONFIG_ZMK_BACKLIGHT=y

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 |
Loading