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>
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;