Browse Source

refactor(splits): Ability to override split role.

* Move central/peripheral setting to Kconfig.defconfig
  files to allow left/right .conf files to override
  central/peripheral role for splits.
xmkb
Pete Johanson 4 years ago
parent
commit
4db5b169bf
  1. 12
      app/CMakeLists.txt
  2. 15
      app/Kconfig
  3. 7
      app/boards/shields/corne/Kconfig.defconfig
  4. 2
      app/boards/shields/corne/corne_left.conf
  5. 2
      app/boards/shields/corne/corne_right.conf
  6. 10
      app/boards/shields/cradio/Kconfig.defconfig
  7. 3
      app/boards/shields/cradio/cradio_left.conf
  8. 2
      app/boards/shields/cradio/cradio_right.conf
  9. 10
      app/boards/shields/iris/Kconfig.defconfig
  10. 2
      app/boards/shields/iris/iris_left.conf
  11. 2
      app/boards/shields/iris/iris_right.conf
  12. 4
      app/boards/shields/jian/Kconfig.defconfig
  13. 2
      app/boards/shields/jian/jian_left.conf
  14. 2
      app/boards/shields/jian/jian_right.conf
  15. 3
      app/boards/shields/jorne/Kconfig.defconfig
  16. 2
      app/boards/shields/jorne/jorne_left.conf
  17. 2
      app/boards/shields/jorne/jorne_right.conf
  18. 3
      app/boards/shields/kyria/Kconfig.defconfig
  19. 2
      app/boards/shields/kyria/kyria_left.conf
  20. 2
      app/boards/shields/kyria/kyria_right.conf
  21. 7
      app/boards/shields/lily58/Kconfig.defconfig
  22. 3
      app/boards/shields/lily58/lily58_left.conf
  23. 3
      app/boards/shields/lily58/lily58_right.conf
  24. 3
      app/boards/shields/microdox/Kconfig.defconfig
  25. 2
      app/boards/shields/microdox/microdox_left.conf
  26. 2
      app/boards/shields/microdox/microdox_right.conf
  27. 10
      app/boards/shields/quefrency/Kconfig.defconfig
  28. 2
      app/boards/shields/quefrency/quefrency_left.conf
  29. 2
      app/boards/shields/quefrency/quefrency_right.conf
  30. 7
      app/boards/shields/sofle/Kconfig.defconfig
  31. 3
      app/boards/shields/sofle/sofle_left.conf
  32. 3
      app/boards/shields/sofle/sofle_right.conf
  33. 6
      app/boards/shields/splitreus62/Kconfig.defconfig
  34. 2
      app/boards/shields/splitreus62/splitreus62_left.conf
  35. 2
      app/boards/shields/splitreus62/splitreus62_right.conf
  36. 25
      app/src/ble.c

12
app/CMakeLists.txt

@ -39,7 +39,7 @@ target_sources(app PRIVATE src/events/sensor_event.c)
target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/events/ble_active_profile_changed.c) target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/events/ble_active_profile_changed.c)
target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/events/battery_state_changed.c) target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/events/battery_state_changed.c)
target_sources_ifdef(CONFIG_USB app PRIVATE src/events/usb_conn_state_changed.c) target_sources_ifdef(CONFIG_USB app PRIVATE src/events/usb_conn_state_changed.c)
if (NOT CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL) if ((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL)
target_sources(app PRIVATE src/behaviors/behavior_key_press.c) target_sources(app PRIVATE src/behaviors/behavior_key_press.c)
target_sources(app PRIVATE src/behaviors/behavior_reset.c) target_sources(app PRIVATE src/behaviors/behavior_reset.c)
target_sources(app PRIVATE src/behaviors/behavior_hold_tap.c) target_sources(app PRIVATE src/behaviors/behavior_hold_tap.c)
@ -57,9 +57,13 @@ target_sources_ifdef(CONFIG_ZMK_RGB_UNDERGLOW app PRIVATE src/behaviors/behavior
target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/behaviors/behavior_bt.c) target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/behaviors/behavior_bt.c)
target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/ble.c) target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/ble.c)
target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/battery.c) target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/battery.c)
target_sources_ifdef(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL app PRIVATE src/split_listener.c) if (CONFIG_ZMK_SPLIT_BLE AND (NOT CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL))
target_sources_ifdef(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL app PRIVATE src/split/bluetooth/service.c) target_sources(app PRIVATE src/split_listener.c)
target_sources_ifdef(CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL app PRIVATE src/split/bluetooth/central.c) target_sources(app PRIVATE src/split/bluetooth/service.c)
endif()
if (CONFIG_ZMK_SPLIT_BLE AND CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL)
target_sources(app PRIVATE src/split/bluetooth/central.c)
endif()
target_sources_ifdef(CONFIG_USB app PRIVATE src/usb.c) target_sources_ifdef(CONFIG_USB app PRIVATE src/usb.c)
target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/hog.c) target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/hog.c)
target_sources_ifdef(CONFIG_ZMK_RGB_UNDERGLOW app PRIVATE src/rgb_underglow.c) target_sources_ifdef(CONFIG_ZMK_RGB_UNDERGLOW app PRIVATE src/rgb_underglow.c)

15
app/Kconfig

@ -83,7 +83,6 @@ menu "Split Support"
config ZMK_SPLIT config ZMK_SPLIT
bool "Split keyboard support" bool "Split keyboard support"
default n
if ZMK_SPLIT if ZMK_SPLIT
@ -95,19 +94,12 @@ config ZMK_SPLIT_BLE
if ZMK_SPLIT_BLE if ZMK_SPLIT_BLE
choice ZMK_SPLIT_BLE_ROLE
bool "BLE Role For Split Communication"
default ZMK_SPLIT_BLE_ROLE_CENTRAL
config ZMK_SPLIT_BLE_ROLE_CENTRAL config ZMK_SPLIT_BLE_ROLE_CENTRAL
bool "Central" bool "Central"
select BT_CENTRAL select BT_CENTRAL
select BT_GATT_CLIENT select BT_GATT_CLIENT
config ZMK_SPLIT_BLE_ROLE_PERIPHERAL if !ZMK_SPLIT_BLE_ROLE_CENTRAL
bool "Peripheral"
if ZMK_SPLIT_BLE_ROLE_PERIPHERAL
config ZMK_USB config ZMK_USB
default n default n
@ -121,12 +113,9 @@ config BT_MAX_CONN
config BT_GAP_AUTO_UPDATE_CONN_PARAMS config BT_GAP_AUTO_UPDATE_CONN_PARAMS
default n default n
#ZMK_SPLIT_BLE_ROLE_PERIPHERAL #!ZMK_SPLIT_BLE_ROLE_CENTRAL
endif endif
#ZMK_SPLIT_BLE_ROLE
endchoice
#ZMK_SPLIT_BLE #ZMK_SPLIT_BLE
endif endif

7
app/boards/shields/corne/Kconfig.defconfig

@ -1,11 +1,12 @@
if SHIELD_CORNE_LEFT if SHIELD_CORNE_LEFT
config ZMK_KEYBOARD_NAME config ZMK_KEYBOARD_NAME
default "Corne Left" default "Corne"
endif config ZMK_SPLIT_BLE_ROLE_CENTRAL
default y
endif
if SHIELD_CORNE_RIGHT if SHIELD_CORNE_RIGHT

2
app/boards/shields/corne/corne_left.conf

@ -1,2 +0,0 @@
CONFIG_ZMK_SPLIT=y
CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y

2
app/boards/shields/corne/corne_right.conf

@ -1,2 +0,0 @@
CONFIG_ZMK_SPLIT=y
CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y

10
app/boards/shields/cradio/Kconfig.defconfig

@ -6,6 +6,9 @@ if SHIELD_CRADIO_LEFT
config ZMK_KEYBOARD_NAME config ZMK_KEYBOARD_NAME
default "cradio left" default "cradio left"
config ZMK_SPLIT_BLE_ROLE_CENTRAL
default y
endif endif
if SHIELD_CRADIO_RIGHT if SHIELD_CRADIO_RIGHT
@ -14,3 +17,10 @@ config ZMK_KEYBOARD_NAME
default "cradio right" default "cradio right"
endif endif
if SHIELD_CRADIO_LEFT || SHIELD_CRADIO_RIGHT
config ZMK_SPLIT
default y
endif

3
app/boards/shields/cradio/cradio_left.conf

@ -1,5 +1,2 @@
# Copyright (c) 2020 The ZMK Contributors # Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
CONFIG_ZMK_SPLIT=y
CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y

2
app/boards/shields/cradio/cradio_right.conf

@ -1,5 +1,3 @@
# Copyright (c) 2020 The ZMK Contributors # Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
CONFIG_ZMK_SPLIT=y
CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y

10
app/boards/shields/iris/Kconfig.defconfig

@ -6,6 +6,9 @@ if SHIELD_IRIS_LEFT
config ZMK_KEYBOARD_NAME config ZMK_KEYBOARD_NAME
default "Iris Left" default "Iris Left"
config ZMK_SPLIT_BLE_ROLE_CENTRAL
default y
endif endif
if SHIELD_IRIS_RIGHT if SHIELD_IRIS_RIGHT
@ -14,3 +17,10 @@ config ZMK_KEYBOARD_NAME
default "Iris Right" default "Iris Right"
endif endif
if SHIELD_IRIS_LEFT || SHIELD_IRIS_RIGHT
config ZMK_SPLIT
default y
endif

2
app/boards/shields/iris/iris_left.conf

@ -1,2 +0,0 @@
CONFIG_ZMK_SPLIT=y
CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y

2
app/boards/shields/iris/iris_right.conf

@ -1,2 +0,0 @@
CONFIG_ZMK_SPLIT=y
CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y

4
app/boards/shields/jian/Kconfig.defconfig

@ -4,6 +4,9 @@ if SHIELD_JIAN_LEFT
config ZMK_KEYBOARD_NAME config ZMK_KEYBOARD_NAME
default "Jian Left" default "Jian Left"
config ZMK_SPLIT_BLE_ROLE_CENTRAL
default y
endif endif
@ -19,5 +22,4 @@ if SHIELD_JIAN_LEFT || SHIELD_JIAN_RIGHT
config ZMK_SPLIT config ZMK_SPLIT
default y default y
endif endif

2
app/boards/shields/jian/jian_left.conf

@ -1,2 +0,0 @@
CONFIG_ZMK_SPLIT=y
CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y

2
app/boards/shields/jian/jian_right.conf

@ -1,2 +0,0 @@
CONFIG_ZMK_SPLIT=y
CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y

3
app/boards/shields/jorne/Kconfig.defconfig

@ -4,6 +4,9 @@ if SHIELD_JORNE_LEFT
config ZMK_KEYBOARD_NAME config ZMK_KEYBOARD_NAME
default "Jorne Left" default "Jorne Left"
config ZMK_SPLIT_BLE_ROLE_CENTRAL
default y
endif endif

2
app/boards/shields/jorne/jorne_left.conf

@ -1,2 +0,0 @@
CONFIG_ZMK_SPLIT=y
CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y

2
app/boards/shields/jorne/jorne_right.conf

@ -1,2 +0,0 @@
CONFIG_ZMK_SPLIT=y
CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y

3
app/boards/shields/kyria/Kconfig.defconfig

@ -4,6 +4,9 @@ if SHIELD_KYRIA_LEFT
config ZMK_KEYBOARD_NAME config ZMK_KEYBOARD_NAME
default "Kyria Left" default "Kyria Left"
config ZMK_SPLIT_BLE_ROLE_CENTRAL
default y
endif endif

2
app/boards/shields/kyria/kyria_left.conf

@ -1,2 +0,0 @@
CONFIG_ZMK_SPLIT=y
CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y

2
app/boards/shields/kyria/kyria_right.conf

@ -1,2 +0,0 @@
CONFIG_ZMK_SPLIT=y
CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y

7
app/boards/shields/lily58/Kconfig.defconfig

@ -4,6 +4,9 @@ if SHIELD_LILY58_LEFT
config ZMK_KEYBOARD_NAME config ZMK_KEYBOARD_NAME
default "Lily58 Left" default "Lily58 Left"
config ZMK_SPLIT_BLE_ROLE_CENTRAL
default y
endif endif
if SHIELD_LILY58_RIGHT if SHIELD_LILY58_RIGHT
@ -15,6 +18,9 @@ endif
if SHIELD_LILY58_LEFT || SHIELD_LILY58_RIGHT if SHIELD_LILY58_LEFT || SHIELD_LILY58_RIGHT
config ZMK_SPLIT
default y
if ZMK_DISPLAY if ZMK_DISPLAY
config I2C config I2C
@ -52,3 +58,4 @@ endchoice
endif # LVGL endif # LVGL
endif endif

3
app/boards/shields/lily58/lily58_left.conf

@ -1,6 +1,3 @@
# Uncomment to enable encoder # Uncomment to enable encoder
# CONFIG_EC11=y # CONFIG_EC11=y
# CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y # CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y
CONFIG_ZMK_SPLIT=y
CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y

3
app/boards/shields/lily58/lily58_right.conf

@ -1,2 +1 @@
CONFIG_ZMK_SPLIT=y
CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y

3
app/boards/shields/microdox/Kconfig.defconfig

@ -6,6 +6,9 @@ if SHIELD_MICRODOX_LEFT
config ZMK_KEYBOARD_NAME config ZMK_KEYBOARD_NAME
default "Microdox Left" default "Microdox Left"
config ZMK_SPLIT_BLE_ROLE_CENTRAL
default y
endif endif

2
app/boards/shields/microdox/microdox_left.conf

@ -1,2 +0,0 @@
CONFIG_ZMK_SPLIT=y
CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y

2
app/boards/shields/microdox/microdox_right.conf

@ -1,2 +0,0 @@
CONFIG_ZMK_SPLIT=y
CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y

10
app/boards/shields/quefrency/Kconfig.defconfig

@ -7,6 +7,9 @@ if SHIELD_QUEFRENCY_LEFT
config ZMK_KEYBOARD_NAME config ZMK_KEYBOARD_NAME
default "Quefrency Left" default "Quefrency Left"
config ZMK_SPLIT_BLE_ROLE_CENTRAL
default y
endif endif
if SHIELD_QUEFRENCY_RIGHT if SHIELD_QUEFRENCY_RIGHT
@ -15,3 +18,10 @@ config ZMK_KEYBOARD_NAME
default "Quefrency Right" default "Quefrency Right"
endif endif
if SHIELD_QUEFRENCY_LEFT || SHIELD_QUEFRENCY_RIGHT
config ZMK_SPLIT
default y
endif

2
app/boards/shields/quefrency/quefrency_left.conf

@ -1,2 +0,0 @@
CONFIG_ZMK_SPLIT=y
CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y

2
app/boards/shields/quefrency/quefrency_right.conf

@ -1,2 +0,0 @@
CONFIG_ZMK_SPLIT=y
CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y

7
app/boards/shields/sofle/Kconfig.defconfig

@ -5,6 +5,10 @@ if SHIELD_SOFLE_LEFT
config ZMK_KEYBOARD_NAME config ZMK_KEYBOARD_NAME
default "Sofle Left" default "Sofle Left"
config ZMK_SPLIT_BLE_ROLE_CENTRAL
default y
endif endif
if SHIELD_SOFLE_RIGHT if SHIELD_SOFLE_RIGHT
@ -15,6 +19,9 @@ endif
if SHIELD_SOFLE_LEFT || SHIELD_SOFLE_RIGHT if SHIELD_SOFLE_LEFT || SHIELD_SOFLE_RIGHT
config ZMK_SPLIT
default y
if ZMK_DISPLAY if ZMK_DISPLAY
config I2C config I2C

3
app/boards/shields/sofle/sofle_left.conf

@ -1,5 +1,2 @@
# Copyright (c) 2020 Ryan Cross # Copyright (c) 2020 Ryan Cross
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
CONFIG_ZMK_SPLIT=y
CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y

3
app/boards/shields/sofle/sofle_right.conf

@ -1,5 +1,2 @@
# Copyright (c) 2020 Ryan Cross # Copyright (c) 2020 Ryan Cross
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
CONFIG_ZMK_SPLIT=y
CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y

6
app/boards/shields/splitreus62/Kconfig.defconfig

@ -8,6 +8,9 @@ if SHIELD_SPLITREUS62_LEFT
config ZMK_KEYBOARD_NAME config ZMK_KEYBOARD_NAME
default "Splitreus62 Left" default "Splitreus62 Left"
config ZMK_SPLIT_BLE_ROLE_CENTRAL
default y
endif endif
if SHIELD_SPLITREUS62_RIGHT if SHIELD_SPLITREUS62_RIGHT
@ -19,4 +22,7 @@ endif
if SHIELD_SPLITREUS62_LEFT || SHIELD_SPLITREUS62_RIGHT if SHIELD_SPLITREUS62_LEFT || SHIELD_SPLITREUS62_RIGHT
config ZMK_SPLIT
default y
endif endif

2
app/boards/shields/splitreus62/splitreus62_left.conf

@ -1,2 +0,0 @@
CONFIG_ZMK_SPLIT=y
CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y

2
app/boards/shields/splitreus62/splitreus62_right.conf

@ -1,2 +0,0 @@
CONFIG_ZMK_SPLIT=y
CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y

25
app/src/ble.c

@ -63,19 +63,24 @@ static uint8_t active_profile;
#define DEVICE_NAME CONFIG_BT_DEVICE_NAME #define DEVICE_NAME CONFIG_BT_DEVICE_NAME
#define DEVICE_NAME_LEN (sizeof(DEVICE_NAME) - 1) #define DEVICE_NAME_LEN (sizeof(DEVICE_NAME) - 1)
#define IS_HOST_PERIPHERAL \
(!IS_ENABLED(CONFIG_ZMK_SPLIT) || IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL))
#define IS_SPLIT_PERIPHERAL \
(IS_ENABLED(CONFIG_ZMK_SPLIT) && !IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL))
static const struct bt_data zmk_ble_ad[] = { static const struct bt_data zmk_ble_ad[] = {
#if !IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL) #if IS_HOST_PERIPHERAL
BT_DATA(BT_DATA_NAME_COMPLETE, DEVICE_NAME, DEVICE_NAME_LEN), BT_DATA(BT_DATA_NAME_COMPLETE, DEVICE_NAME, DEVICE_NAME_LEN),
BT_DATA_BYTES(BT_DATA_GAP_APPEARANCE, 0xC1, 0x03), BT_DATA_BYTES(BT_DATA_GAP_APPEARANCE, 0xC1, 0x03),
#endif #endif
BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)), BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)),
BT_DATA_BYTES(BT_DATA_UUID16_SOME, BT_DATA_BYTES(BT_DATA_UUID16_SOME,
#if !IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL) #if IS_HOST_PERIPHERAL
0x12, 0x18, /* HID Service */ 0x12, 0x18, /* HID Service */
#endif #endif
0x0f, 0x18 /* Battery Service */ 0x0f, 0x18 /* Battery Service */
), ),
#if IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL) #if IS_SPLIT_PERIPHERAL
BT_DATA_BYTES(BT_DATA_UUID128_ALL, ZMK_SPLIT_BT_SERVICE_UUID) BT_DATA_BYTES(BT_DATA_UUID128_ALL, ZMK_SPLIT_BT_SERVICE_UUID)
#endif #endif
}; };
@ -373,7 +378,7 @@ static void connected(struct bt_conn *conn, uint8_t err) {
bt_conn_le_param_update(conn, BT_LE_CONN_PARAM(0x0006, 0x000c, 30, 400)); bt_conn_le_param_update(conn, BT_LE_CONN_PARAM(0x0006, 0x000c, 30, 400));
#if IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL) #if IS_SPLIT_PERIPHERAL
bt_conn_le_phy_update(conn, BT_CONN_LE_PHY_PARAM_2M); bt_conn_le_phy_update(conn, BT_CONN_LE_PHY_PARAM_2M);
#endif #endif
@ -462,7 +467,7 @@ static void auth_cancel(struct bt_conn *conn) {
LOG_DBG("Pairing cancelled: %s", log_strdup(addr)); LOG_DBG("Pairing cancelled: %s", log_strdup(addr));
} }
#if !IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL) #if IS_HOST_PERIPHERAL
static enum bt_security_err auth_pairing_accept(struct bt_conn *conn, static enum bt_security_err auth_pairing_accept(struct bt_conn *conn,
const struct bt_conn_pairing_feat *const feat) { const struct bt_conn_pairing_feat *const feat) {
struct bt_conn_info info; struct bt_conn_info info;
@ -476,7 +481,7 @@ static enum bt_security_err auth_pairing_accept(struct bt_conn *conn,
return BT_SECURITY_ERR_SUCCESS; return BT_SECURITY_ERR_SUCCESS;
}; };
#endif /* !IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL) */ #endif /* IS_HOST_PERIPHERAL */
static void auth_pairing_complete(struct bt_conn *conn, bool bonded) { static void auth_pairing_complete(struct bt_conn *conn, bool bonded) {
struct bt_conn_info info; struct bt_conn_info info;
@ -491,22 +496,22 @@ static void auth_pairing_complete(struct bt_conn *conn, bool bonded) {
return; return;
} }
#if !IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL) #if IS_HOST_PERIPHERAL
if (!zmk_ble_active_profile_is_open()) { if (!zmk_ble_active_profile_is_open()) {
LOG_ERR("Pairing completed but current profile is not open: %s", log_strdup(addr)); LOG_ERR("Pairing completed but current profile is not open: %s", log_strdup(addr));
bt_unpair(BT_ID_DEFAULT, dst); bt_unpair(BT_ID_DEFAULT, dst);
return; return;
} }
#endif /* !IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL) */ #endif /* IS_HOST_PERIPHERAL */
set_profile_address(active_profile, dst); set_profile_address(active_profile, dst);
update_advertising(); update_advertising();
}; };
static struct bt_conn_auth_cb zmk_ble_auth_cb_display = { static struct bt_conn_auth_cb zmk_ble_auth_cb_display = {
#if !IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL) #if IS_HOST_PERIPHERAL
.pairing_accept = auth_pairing_accept, .pairing_accept = auth_pairing_accept,
#endif /* !IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL) */ #endif /* IS_HOST_PERIPHERAL */
.pairing_complete = auth_pairing_complete, .pairing_complete = auth_pairing_complete,
// .passkey_display = auth_passkey_display, // .passkey_display = auth_passkey_display,

Loading…
Cancel
Save