From cf970efb98c5af97955bfffbcebb3b065b16edc4 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Fri, 28 Aug 2020 14:15:16 -0400 Subject: feat(bluetooth): Proper bond management, identity support for non-splits * Add `bt` behavior that can be used to perform certain actions, such as next/prev identity, reset identity, etc. NOTE: Multiple identities is only supported for non-split shields, due to missing Zephyr identity functionality for dual central/peripheral devices. * Proper bond reset tied to action, that honors peripheral bonds, so folks can reset and pair to other hosts, without breaking bonds between splt halves. --- app/Kconfig | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'app/Kconfig') diff --git a/app/Kconfig b/app/Kconfig index 877fce4..b60db05 100644 --- a/app/Kconfig +++ b/app/Kconfig @@ -40,8 +40,6 @@ menuconfig ZMK_BLE select BT_PERIPHERAL select BT_GATT_DIS select BT_GATT_BAS - select SETTINGS - # select BT_SETTINGS if ZMK_BLE @@ -49,6 +47,12 @@ config ZMK_BLE_INIT_PRIORITY int "Init Priority" default 50 +config SETTINGS + default y + +config BT_SETTINGS + default y + config SYSTEM_WORKQUEUE_STACK_SIZE default 2048 @@ -103,8 +107,11 @@ config ZMK_SPLIT_BLE_ROLE_CENTRAL if ZMK_SPLIT_BLE_ROLE_CENTRAL +config BT_MAX_PAIRED + default 2 + config BT_MAX_CONN - default 5 + default 2 config BT_MAX_PAIRED # Bump this everywhere once we support switching active connections! @@ -120,15 +127,18 @@ if ZMK_SPLIT_BLE_ROLE_PERIPHERAL config ZMK_USB default n +config BT_MAX_PAIRED + default 1 config BT_MAX_CONN - default 5 + default 2 config BT_GAP_AUTO_UPDATE_CONN_PARAMS default n endif + endchoice endif @@ -138,6 +148,17 @@ endif endmenu +if ZMK_BLE && !ZMK_SPLIT_BLE + +config BT_ID_MAX + default 5 + +# Used to update the name to include the identity used +config BT_DEVICE_NAME_DYNAMIC + default y + +endif + config ZMK_KSCAN_MOCK_DRIVER bool "Enable mock kscan driver to simulate key presses" default n -- cgit v1.2.3 From a4d06f69ac9879618e91a9befac6f2e84ef37428 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Mon, 31 Aug 2020 16:56:05 -0400 Subject: fix(bluetooth): Fix max pair settings for non-split. --- app/Kconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app/Kconfig') diff --git a/app/Kconfig b/app/Kconfig index b60db05..3640dc6 100644 --- a/app/Kconfig +++ b/app/Kconfig @@ -107,9 +107,6 @@ config ZMK_SPLIT_BLE_ROLE_CENTRAL if ZMK_SPLIT_BLE_ROLE_CENTRAL -config BT_MAX_PAIRED - default 2 - config BT_MAX_CONN default 2 @@ -153,6 +150,9 @@ if ZMK_BLE && !ZMK_SPLIT_BLE config BT_ID_MAX default 5 +config BT_MAX_PAIRED + default 5 + # Used to update the name to include the identity used config BT_DEVICE_NAME_DYNAMIC default y -- cgit v1.2.3 From fc0812bd2eb08d66819f38bafd1f5d00b933c87b Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Tue, 1 Sep 2020 23:22:30 -0400 Subject: fix(bluetooth): Remove identity, minimal `bt`. * Simplify the `bt` behavior to one current command `BT_CLEAR_BONDS_CMD`. * Simplify BLE code for split and non-split keyboards. * Remove keymap processing from split peripheral side. --- app/Kconfig | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) (limited to 'app/Kconfig') diff --git a/app/Kconfig b/app/Kconfig index 3640dc6..11a3cc0 100644 --- a/app/Kconfig +++ b/app/Kconfig @@ -40,18 +40,14 @@ menuconfig ZMK_BLE select BT_PERIPHERAL select BT_GATT_DIS select BT_GATT_BAS + select BT_SETTINGS + select SETTINGS if ZMK_BLE config ZMK_BLE_INIT_PRIORITY int "Init Priority" default 50 - -config SETTINGS - default y - -config BT_SETTINGS - default y config SYSTEM_WORKQUEUE_STACK_SIZE default 2048 @@ -144,21 +140,6 @@ endif endmenu - -if ZMK_BLE && !ZMK_SPLIT_BLE - -config BT_ID_MAX - default 5 - -config BT_MAX_PAIRED - default 5 - -# Used to update the name to include the identity used -config BT_DEVICE_NAME_DYNAMIC - default y - -endif - config ZMK_KSCAN_MOCK_DRIVER bool "Enable mock kscan driver to simulate key presses" default n -- cgit v1.2.3 From 13842a8a1e45b399864ba1ae5a759c614313b4db Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Thu, 3 Sep 2020 13:21:01 -0400 Subject: fix(bluetooth): Kconfig to clear bonds on start --- app/Kconfig | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'app/Kconfig') diff --git a/app/Kconfig b/app/Kconfig index 11a3cc0..b9d05a9 100644 --- a/app/Kconfig +++ b/app/Kconfig @@ -52,6 +52,10 @@ config ZMK_BLE_INIT_PRIORITY config SYSTEM_WORKQUEUE_STACK_SIZE default 2048 +config ZMK_BLE_CLEAR_BONDS_ON_START + bool "Configuration that clears all bond information from the keyboard on startup." + default n + # HID GATT notifications sent this way are *not* picked up by Linux, and possibly others. config BT_GATT_NOTIFY_MULTIPLE default n -- cgit v1.2.3 From 39f980a06dac1769e4f09abaf19d3ccbb4b34e67 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Tue, 8 Sep 2020 23:26:00 -0400 Subject: feat(bluetooth): Add back profiles, split fixes. * Add back in profiles, not using Zephyr BT identity infrastructure. * Restore additional `&bt` commands for profile operations. * Fix for split pairing and subscriptions, since Zephyr persists subscriptions across connects. * Remove keymap from peripheral builds, reduces firmware size, and avoids unneeded attempts to send HID data. --- app/Kconfig | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'app/Kconfig') diff --git a/app/Kconfig b/app/Kconfig index b9d05a9..917674d 100644 --- a/app/Kconfig +++ b/app/Kconfig @@ -37,6 +37,7 @@ menuconfig ZMK_BLE select BT select BT_SMP select BT_SMP_SC_PAIR_ONLY + select BT_SMP_APP_PAIRING_ACCEPT select BT_PERIPHERAL select BT_GATT_DIS select BT_GATT_BAS @@ -105,19 +106,9 @@ config ZMK_SPLIT_BLE_ROLE_CENTRAL select BT_CENTRAL select BT_GATT_CLIENT -if ZMK_SPLIT_BLE_ROLE_CENTRAL - -config BT_MAX_CONN - default 2 - -config BT_MAX_PAIRED - # Bump this everywhere once we support switching active connections! - default 2 - -endif - config ZMK_SPLIT_BLE_ROLE_PERIPHERAL bool "Peripheral" + select BT_KEYS_OVERWRITE_OLDEST if ZMK_SPLIT_BLE_ROLE_PERIPHERAL @@ -128,16 +119,25 @@ config BT_MAX_PAIRED default 1 config BT_MAX_CONN - default 2 + default 1 config BT_GAP_AUTO_UPDATE_CONN_PARAMS default n endif - endchoice +if ZMK_BLE && (!ZMK_SPLIT_BLE || ZMK_SPLIT_BLE_ROLE_CENTRAL) + +config BT_MAX_CONN + default 6 + +config BT_MAX_PAIRED + default 5 + +endif + endif endif -- cgit v1.2.3 From fb91be5164a5b6ba78b19c7a2597c13ddd992f81 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Wed, 9 Sep 2020 14:33:09 -0400 Subject: fix(bluetooth): Configs for non-splits. --- app/Kconfig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'app/Kconfig') diff --git a/app/Kconfig b/app/Kconfig index 917674d..6180565 100644 --- a/app/Kconfig +++ b/app/Kconfig @@ -128,6 +128,10 @@ endif endchoice +endif + +endif + if ZMK_BLE && (!ZMK_SPLIT_BLE || ZMK_SPLIT_BLE_ROLE_CENTRAL) config BT_MAX_CONN @@ -138,10 +142,6 @@ config BT_MAX_PAIRED endif -endif - -endif - endmenu config ZMK_KSCAN_MOCK_DRIVER -- cgit v1.2.3