Disable auto-connect on device remove
authorManish Mandlik <mmandlik@google.com>
Wed, 9 Sep 2020 19:40:01 +0000 (12:40 -0700)
committerAyush Garg <ayush.garg@samsung.com>
Fri, 11 Mar 2022 13:38:32 +0000 (19:08 +0530)
Auto-connect is not disabled when a device is removed. So in case the
pairing is cancelled, the device is removed, but it stays in the kernel
auto-connect list. This causes future advertisement from that device to
trigger a pairing even if the user has already cancelled the pairing.

This patch disables auto-connect on device remove.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
src/device.c

index 9ebbe35..2f8a291 100644 (file)
@@ -7175,6 +7175,11 @@ void device_remove(struct btd_device *device, gboolean remove_stored)
 {
        DBG("Removing device %s", device->path);
 
+       if (device->auto_connect) {
+               device->disable_auto_connect = TRUE;
+               device_set_auto_connect(device, FALSE);
+       }
+
        if (device->bonding) {
                uint8_t status;