From d9ca07a914e0e7adcd6aacb9878cf49eb2e85553 Mon Sep 17 00:00:00 2001 From: Pete Johanson Date: Mon, 18 May 2020 15:07:37 -0400 Subject: [PATCH] Move BLE passkey entry behind config flag. --- Kconfig | 8 ++++++++ README.md | 8 +++----- src/ble.c | 11 +++++++++-- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/Kconfig b/Kconfig index 2ab2c6fd..7d06654d 100644 --- a/Kconfig +++ b/Kconfig @@ -13,6 +13,14 @@ config ZMK_BLE select BT_GATT_DIS select BT_GATT_BAS +if ZMK_BLE + +config ZMK_BLE_PASSKEY_ENTRY + bool "Experimental: Requiring typing passkey from host to pair BLE connection" + default n + +endif + module = ZMK_KSCAN module-str = zmk_kscan source "subsys/logging/Kconfig.template.log_config" diff --git a/README.md b/README.md index c2a982ca..c09f6b71 100644 --- a/README.md +++ b/README.md @@ -7,12 +7,8 @@ with a less restritive license and better BLE support, built on top of the [Zeph - Debouncing in the kscan driver itself? Only some GPIO drivers in Zephyr support it "natively" - Document boards/shields/keymaps usage. -- Custom keymap code via `zephyr_library()`> - Move most Kconfig setings to the board/keymap defconfigs and out of the toplevel `prj.conf` file. - Merge the Kscan GPIO driver upstream, or integrate it locally, to avoid use of Zephyr branch. -- BLE SC by typing in the # prompted on the host. - - Store the connection being authenticated. - - Hook into endpoint flow to detect keypresses and store/send them to the connection once 6 are typed. - Display support, including displaying BLE SC auth numbers for "numeric comparison" mode if we have the screen. - Fix BT settings to work w/ Zephyr. Do we really need them? - Tests? @@ -25,7 +21,9 @@ with a less restritive license and better BLE support, built on top of the [Zeph - One Shot - Shell over BLE? - Split support - - custom kscan driver? that recieves events from other side over serial/BLE notifications? + - custom kscan driver? that recieves events from other side over BLE notifications? + - Need to figure out how to do "custom" GATT services. Custom UUID? + - Do we need to send any state updates over from primary to secondary side? ## Long Term diff --git a/src/ble.c b/src/ble.c index 18b4fe31..8b116814 100644 --- a/src/ble.c +++ b/src/ble.c @@ -76,6 +76,8 @@ static void auth_passkey_display(struct bt_conn *conn, unsigned int passkey) printk("Passkey for %s: %06u\n", addr, passkey); } +#ifdef CONFIG_ZMK_BLE_PASSKEY_ENTRY + static void auth_passkey_entry(struct bt_conn *conn) { char addr[BT_ADDR_LE_STR_LEN]; @@ -86,6 +88,8 @@ static void auth_passkey_entry(struct bt_conn *conn) auth_passkey_entry_conn = bt_conn_ref(conn); } +#endif + static void auth_cancel(struct bt_conn *conn) { char addr[BT_ADDR_LE_STR_LEN]; @@ -104,8 +108,11 @@ static void auth_cancel(struct bt_conn *conn) } static struct bt_conn_auth_cb zmk_ble_auth_cb_display = { - // .passkey_display = auth_passkey_display, - // .passkey_entry = auth_passkey_entry, +// .passkey_display = auth_passkey_display, + +#ifdef CONFIG_ZMK_BLE_PASSKEY_ENTRY + .passkey_entry = auth_passkey_entry, +#endif .cancel = auth_cancel, };