diff --git a/app/Kconfig b/app/Kconfig index f23930b4..077748b8 100644 --- a/app/Kconfig +++ b/app/Kconfig @@ -78,6 +78,18 @@ config ZMK_BLE_CLEAR_BONDS_ON_START bool "Configuration that clears all bond information from the keyboard on startup." default n +config BT_PERIPHERAL_PREF_MIN_INT + default 12 + +config BT_PERIPHERAL_PREF_MAX_INT + default 12 + +config BT_PERIPHERAL_PREF_SLAVE_LATENCY + default 30 + +config BT_PERIPHERAL_PREF_TIMEOUT + default 400 + # HID GATT notifications sent this way are *not* picked up by Linux, and possibly others. config BT_GATT_NOTIFY_MULTIPLE default n diff --git a/app/src/ble.c b/app/src/ble.c index a9f2afe9..5df3d06c 100644 --- a/app/src/ble.c +++ b/app/src/ble.c @@ -61,6 +61,7 @@ enum advertising_type { static struct zmk_ble_profile profiles[PROFILE_COUNT]; static uint8_t active_profile; +#define DEVICE_SECURITY_LEVEL BT_SECURITY_L2 #define DEVICE_NAME CONFIG_BT_DEVICE_NAME #define DEVICE_NAME_LEN (sizeof(DEVICE_NAME) - 1) @@ -380,19 +381,15 @@ static void connected(struct bt_conn *conn, uint8_t err) { LOG_DBG("Connected %s", log_strdup(addr)); - err = bt_conn_le_param_update(conn, BT_LE_CONN_PARAM(0x0006, 0x000c, 30, 400)); - if (err) { - LOG_WRN("Failed to update LE parameters (err %d)", err); + uint8_t set_security_err = bt_conn_set_security(conn, DEVICE_SECURITY_LEVEL); + if (set_security_err) { + LOG_ERR("Failed to set security %d", set_security_err); } #if IS_SPLIT_PERIPHERAL bt_conn_le_phy_update(conn, BT_CONN_LE_PHY_PARAM_2M); #endif - if (bt_conn_set_security(conn, BT_SECURITY_L2)) { - LOG_ERR("Failed to set security"); - } - update_advertising(); if (is_conn_active_profile(conn)) {