From b2b2425203bff51b97a0b29d18499f8533eae3a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Kelemen?= Date: Sun, 3 Apr 2022 19:29:03 +0200 Subject: [PATCH] bluetoothctl: add / modify pairing steps (#13818) due to some changes in bluez / bluetoothctl, `pairable on` is required in order to create a `[LinkKey]` section in the configuration file for the connected device. if this section is missing, the device / gamepad will not pair after being disconnect and has to be repaired again. --- bluetooth/drivers/bluetoothctl.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bluetooth/drivers/bluetoothctl.c b/bluetooth/drivers/bluetoothctl.c index f3205c8ee9..31f5a24447 100644 --- a/bluetooth/drivers/bluetoothctl.c +++ b/bluetooth/drivers/bluetoothctl.c @@ -170,8 +170,7 @@ static bool bluetoothctl_connect_device(void *data, unsigned idx) string_list_free(list); snprintf(btctl->command, sizeof(btctl->command), "\ - bluetoothctl -- trust %s", - device); + bluetoothctl -- pairable on"); pclose(popen(btctl->command, "r")); @@ -181,6 +180,12 @@ static bool bluetoothctl_connect_device(void *data, unsigned idx) pclose(popen(btctl->command, "r")); + snprintf(btctl->command, sizeof(btctl->command), "\ + bluetoothctl -- trust %s", + device); + + pclose(popen(btctl->command, "r")); + snprintf(btctl->command, sizeof(btctl->command), "\ bluetoothctl -- connect %s", device);