device: Fix pairing has failed due to the error of Already Paired (0x13)
authorwangyouwan <wangyouwan@uniontech.com>
Tue, 10 May 2022 01:27:35 +0000 (09:27 +0800)
committerAyush Garg <ayush.garg@samsung.com>
Mon, 15 May 2023 09:25:54 +0000 (14:55 +0530)
After connect the Bluetooth mouse, open two Bluetoothctl at the same time,
when remove the mouse, quickly go to power off,
try to paired the mouse again when I was power on,
found that the error 0x13 was always reported.
try to connect directly,can connect successfully.
but use the info command to query the information of the mouse
and find that the pairing status of the mouse is No.
so I try to delete the paired information in the kernel
through the "* cancel_pairing()" interface.

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
src/device.c

index d0c4254..d582e4c 100644 (file)
@@ -3872,8 +3872,11 @@ static DBusMessage *cancel_pairing(DBusConnection *conn, DBusMessage *msg,
 
        DBG("");
 
-       if (!req)
+       if (!req) {
+               btd_adapter_remove_bonding(device->adapter, &device->bdaddr,
+                                               device->bdaddr_type);
                return btd_error_does_not_exist(msg);
+       }
 
        device_cancel_bonding(device, MGMT_STATUS_CANCELLED);