diff mbox series

[BlueZ,v2,1/2] device: clear eir_uuids list on disconnect

Message ID 20210825165125.2675544-2-david@lechnology.com
State New
Headers show
Series device: fix advertising data UUIDs ignored when Cache = yes | expand

Commit Message

David Lechner Aug. 25, 2021, 4:51 p.m. UTC
The eir_uuids list contains GATT service UUIDs from advertising data.
The device may advertise different UUIDs each time it is scanned and
connected, so the list needs to be cleared when the device disconnects.

This partially fixes an issue where the UUIDs D-Bus property is empty
after scanning, connecting, disconnecting and scanning again when
[GATT] Cache = yes is set in main.conf.

Issue: https://github.com/bluez/bluez/issues/192
Signed-off-by: David Lechner <david@lechnology.com>
---
 src/device.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/src/device.c b/src/device.c
index 807106812..53ef3e9a1 100644
--- a/src/device.c
+++ b/src/device.c
@@ -3129,6 +3129,9 @@  void device_remove_connection(struct btd_device *device, uint8_t bdaddr_type)
 
 	device_update_last_seen(device, bdaddr_type);
 
+	g_slist_free_full(device->eir_uuids, g_free);
+	device->eir_uuids = NULL;
+
 	g_dbus_emit_property_changed(dbus_conn, device->path,
 						DEVICE_INTERFACE, "Connected");