From cd85a4dbf28852a65143db0074d0a76cdb21459f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Kelemen?= Date: Tue, 18 Feb 2025 17:11:36 +0100 Subject: [PATCH] bluetoothctl: use two calls to disconnect/remove device (#17593) the previous method does not remove the pairing of the selected device, user must remove the pairing manually by modifying filesystem. change tested on real system (Lakka-RPi4.aarch64). --- bluetooth/drivers/bluetoothctl.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bluetooth/drivers/bluetoothctl.c b/bluetooth/drivers/bluetoothctl.c index 20e3919d0e..16d04cc292 100644 --- a/bluetooth/drivers/bluetoothctl.c +++ b/bluetooth/drivers/bluetoothctl.c @@ -225,8 +225,14 @@ static bool bluetoothctl_remove_device(void *data, unsigned idx) string_list_free(list); snprintf(btctl->command, sizeof(btctl->command), "\ - echo -e \"disconnect %s\\nremove %s\\n\" | bluetoothctl", - device, device); + bluetoothctl -- disconnect %s", + device); + + pclose(popen(btctl->command, "r")); + + snprintf(btctl->command, sizeof(btctl->command), "\ + bluetoothctl -- remove %s", + device); pclose(popen(btctl->command, "r"));