Browse Source

Move BLE passkey entry behind config flag.

xmkb
Pete Johanson 5 years ago
parent
commit
d9ca07a914
  1. 8
      Kconfig
  2. 8
      README.md
  3. 11
      src/ble.c

8
Kconfig

@ -13,6 +13,14 @@ config ZMK_BLE
select BT_GATT_DIS select BT_GATT_DIS
select BT_GATT_BAS 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 = ZMK_KSCAN
module-str = zmk_kscan module-str = zmk_kscan
source "subsys/logging/Kconfig.template.log_config" source "subsys/logging/Kconfig.template.log_config"

8
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" - Debouncing in the kscan driver itself? Only some GPIO drivers in Zephyr support it "natively"
- Document boards/shields/keymaps usage. - 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. - 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. - 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. - 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? - Fix BT settings to work w/ Zephyr. Do we really need them?
- Tests? - Tests?
@ -25,7 +21,9 @@ with a less restritive license and better BLE support, built on top of the [Zeph
- One Shot - One Shot
- Shell over BLE? - Shell over BLE?
- Split support - 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 ## Long Term

11
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); printk("Passkey for %s: %06u\n", addr, passkey);
} }
#ifdef CONFIG_ZMK_BLE_PASSKEY_ENTRY
static void auth_passkey_entry(struct bt_conn *conn) static void auth_passkey_entry(struct bt_conn *conn)
{ {
char addr[BT_ADDR_LE_STR_LEN]; 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); auth_passkey_entry_conn = bt_conn_ref(conn);
} }
#endif
static void auth_cancel(struct bt_conn *conn) static void auth_cancel(struct bt_conn *conn)
{ {
char addr[BT_ADDR_LE_STR_LEN]; 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 = { static struct bt_conn_auth_cb zmk_ble_auth_cb_display = {
// .passkey_display = auth_passkey_display, // .passkey_display = auth_passkey_display,
// .passkey_entry = auth_passkey_entry,
#ifdef CONFIG_ZMK_BLE_PASSKEY_ENTRY
.passkey_entry = auth_passkey_entry,
#endif
.cancel = auth_cancel, .cancel = auth_cancel,
}; };

Loading…
Cancel
Save