adapter: Mark device temporary state pairing failure
authorYu Liu <yudiliu@google.com>
Mon, 24 Aug 2020 18:19:03 +0000 (11:19 -0700)
committerAyush Garg <ayush.garg@samsung.com>
Mon, 12 Apr 2021 09:00:50 +0000 (14:30 +0530)
This caused the device hanging around as a discovered device forever
even if it is turned off or not in present.

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

index 2e3a80b..d145a32 100644 (file)
@@ -8588,6 +8588,14 @@ void device_bonding_complete(struct btd_device *device, uint8_t bdaddr_type,
 
        if (status) {
                device_cancel_authentication(device, TRUE);
+
+               /* Put the device back to the temporary state so that it will be
+                * treated as a newly discovered device.
+                */
+               if (!device_is_paired(device, bdaddr_type) &&
+                               !device_is_trusted(device))
+                       btd_device_set_temporary(device, true);
+
                device_bonding_failed(device, status);
 #ifdef TIZEN_FEATURE_BLUEZ_MODIFY
                device->legacy_pairing = false;