device: Fix not always storing device info
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Wed, 8 Mar 2023 00:47:33 +0000 (16:47 -0800)
committerAyush Garg <ayush.garg@samsung.com>
Fri, 5 Jan 2024 10:21:48 +0000 (15:51 +0530)
When updating the device address check if the device is marked as
temporary before attempting to call store_device_info otherwise it will
have no effect and instead btd_device_set_temporary must be called.

src/device.c

index d8198e0..72b6686 100644 (file)
@@ -6776,7 +6776,10 @@ void device_update_addr(struct btd_device *device, const bdaddr_t *bdaddr,
        bacpy(&device->bdaddr, bdaddr);
        device->bdaddr_type = bdaddr_type;
 
-       store_device_info(device);
+       if (device->temporary)
+               btd_device_set_temporary(device, false);
+       else
+               store_device_info(device);
 
        g_dbus_emit_property_changed(dbus_conn, device->path,
                                                DEVICE_INTERFACE, "Address");