2021-08-25 16:54:55

by David Lechner

[permalink] [raw]
Subject: [PATCH BlueZ v2 1/2] device: clear eir_uuids list on disconnect

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 <[email protected]>
---
src/device.c | 3 +++
1 file changed, 3 insertions(+)

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

--
2.25.1


2021-08-25 22:14:44

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [PATCH BlueZ v2 1/2] device: clear eir_uuids list on disconnect

Hi David,

On Wed, Aug 25, 2021 at 9:54 AM David Lechner <[email protected]> wrote:
>
> 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 <[email protected]>
> ---
> src/device.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> 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");
>
> --
> 2.25.1

Applied, thanks.


--
Luiz Augusto von Dentz

2021-08-26 04:35:38

by Eisenkolb Thomas

[permalink] [raw]
Subject: AW: [PATCH BlueZ v2 1/2] device: clear eir_uuids list on disconnect

Hello,

I have just found the same problem even if [GATT] Cache = no is set in main.conf.
It is simply the same because the device is held as temporary device.

Additionally the method "dev_property_get_uuids" in device.c only returns UUIDs of
the cached (temporary hold) device because dev->le_state.svc_resolved is not turned
to false on disconnect. So if a disconnected device advertised an new UUID, you never
get notified about it through dbus.

Through DBus device node I would expect to get both UUID lists. The cached ones and
also the advertised ones.
Actually I just merge the two lists and provide the result to DBus device->UUIDs request.

Hope you can change this.

Thanks.

Thomas

-----Ursprüngliche Nachricht-----
Von: Luiz Augusto von Dentz [mailto:[email protected]]
Gesendet: Donnerstag, 26. August 2021 00:13
An: David Lechner <[email protected]>
Cc: [email protected]
Betreff: Re: [PATCH BlueZ v2 1/2] device: clear eir_uuids list on disconnect

Hi David,

On Wed, Aug 25, 2021 at 9:54 AM David Lechner <[email protected]> wrote:
>
> 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 <[email protected]>
> ---
> src/device.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> 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");
>
> --
> 2.25.1

Applied, thanks.


--
Luiz Augusto von Dentz

2021-08-26 16:49:10

by David Lechner

[permalink] [raw]
Subject: Re: AW: [PATCH BlueZ v2 1/2] device: clear eir_uuids list on disconnect

On 8/25/21 11:24 PM, Eisenkolb Thomas wrote:
> Hello,
>
> I have just found the same problem even if [GATT] Cache = no is set in main.conf.
> It is simply the same because the device is held as temporary device.
>
> Additionally the method "dev_property_get_uuids" in device.c only returns UUIDs of
> the cached (temporary hold) device because dev->le_state.svc_resolved is not turned
> to false on disconnect. So if a disconnected device advertised an new UUID, you never
> get notified about it through dbus.
>
> Through DBus device node I would expect to get both UUID lists. The cached ones and
> also the advertised ones.
> Actually I just merge the two lists and provide the result to DBus device->UUIDs request.
>
> Hope you can change this.
>

This series has already been applied, so it can't be changed.

If you are still having problems after this series, can you share some
logs so that we can see exactly the problem?