feat(ble): introduce Kconfig option to disable Bluetooth profile advertising

This is useful for dongle mode with only USB output.
This commit is contained in:
Xudong Zheng 2024-03-06 23:25:00 -05:00
parent 354cff9c36
commit daa33dcfca
2 changed files with 11 additions and 0 deletions

View File

@ -210,6 +210,10 @@ config ZMK_BLE_MOUSE_REPORT_QUEUE_SIZE
config ZMK_BLE_CLEAR_BONDS_ON_START
bool "Configuration that clears all bond information from the keyboard on startup."
config ZMK_BLE_PROFILE_ADVERTISING
bool "Advertise on BLE profiles"
default y
# HID GATT notifications sent this way are *not* picked up by Linux, and possibly others.
config BT_GATT_NOTIFY_MULTIPLE
default n

View File

@ -175,6 +175,13 @@ bool zmk_ble_profile_is_connected(uint8_t index) {
advertising_status = ZMK_ADV_CONN;
int update_advertising(void) {
#if IS_ENABLED(CONFIG_ZMK_SPLIT_ROLE_CENTRAL)
#if !IS_ENABLED(CONFIG_ZMK_BLE_PROFILE_ADVERTISING)
LOG_INF("skipping advertising since profile advertising is disabled");
return 0;
#endif
#endif
int err = 0;
bt_addr_le_t *addr;
struct bt_conn *conn;