Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH BlueZ] device: fix advertising data UUIDs ignored when Cache = yes
@ 2021-08-24 18:29 David Lechner
  2021-08-24 19:30 ` [BlueZ] " bluez.test.bot
  2021-08-24 22:36 ` [PATCH BlueZ] " Luiz Augusto von Dentz
  0 siblings, 2 replies; 3+ messages in thread
From: David Lechner @ 2021-08-24 18:29 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: David Lechner

When [GATT] Cache = yes is set in configuration BlueZ does not use
cached UUIDs for the list of service UUIDs. However, it doesn't clear
the in-memory list of UUIDs received from advertising data, so when
a device is scanned, connected and disconnected, the internal state
still reflects that the UUIDs from the advertising data have already
been handled. device_add_eir_uuids() ignored the UUIDs from the
advertising data because both dev->le_state.svc_resolved == true and
dev->eir_uuids still contains the UUIDs from the previous scan session.

This fixes the issue by resetting both le_state.svc_resolved and
eir_uuids when the device is disconnected.

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

diff --git a/src/device.c b/src/device.c
index 807106812..48b9bd8d6 100644
--- a/src/device.c
+++ b/src/device.c
@@ -3129,6 +3129,12 @@ void device_remove_connection(struct btd_device *device, uint8_t bdaddr_type)
 
 	device_update_last_seen(device, bdaddr_type);
 
+	if (!gatt_cache_is_enabled(device)) {
+		device->le_state.svc_resolved = false;
+		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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [BlueZ] device: fix advertising data UUIDs ignored when Cache = yes
  2021-08-24 18:29 [PATCH BlueZ] device: fix advertising data UUIDs ignored when Cache = yes David Lechner
@ 2021-08-24 19:30 ` bluez.test.bot
  2021-08-24 22:36 ` [PATCH BlueZ] " Luiz Augusto von Dentz
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2021-08-24 19:30 UTC (permalink / raw)
  To: linux-bluetooth, david

[-- Attachment #1: Type: text/plain, Size: 1953 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=536697

---Test result---

Test Summary:
CheckPatch                    PASS      0.40 seconds
GitLint                       PASS      0.11 seconds
Prep - Setup ELL              PASS      40.29 seconds
Build - Prep                  PASS      0.10 seconds
Build - Configure             PASS      7.06 seconds
Build - Make                  PASS      176.14 seconds
Make Check                    PASS      8.49 seconds
Make Distcheck                PASS      206.82 seconds
Build w/ext ELL - Configure   PASS      7.13 seconds
Build w/ext ELL - Make        PASS      165.68 seconds

Details
##############################
Test: CheckPatch - PASS
Desc: Run checkpatch.pl script with rule in .checkpatch.conf

##############################
Test: GitLint - PASS
Desc: Run gitlint with rule in .gitlint

##############################
Test: Prep - Setup ELL - PASS
Desc: Clone, build, and install ELL

##############################
Test: Build - Prep - PASS
Desc: Prepare environment for build

##############################
Test: Build - Configure - PASS
Desc: Configure the BlueZ source tree

##############################
Test: Build - Make - PASS
Desc: Build the BlueZ source tree

##############################
Test: Make Check - PASS
Desc: Run 'make check'

##############################
Test: Make Distcheck - PASS
Desc: Run distcheck to check the distribution

##############################
Test: Build w/ext ELL - Configure - PASS
Desc: Configure BlueZ source with '--enable-external-ell' configuration

##############################
Test: Build w/ext ELL - Make - PASS
Desc: Build BlueZ source with '--enable-external-ell' configuration



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH BlueZ] device: fix advertising data UUIDs ignored when Cache = yes
  2021-08-24 18:29 [PATCH BlueZ] device: fix advertising data UUIDs ignored when Cache = yes David Lechner
  2021-08-24 19:30 ` [BlueZ] " bluez.test.bot
@ 2021-08-24 22:36 ` Luiz Augusto von Dentz
  1 sibling, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2021-08-24 22:36 UTC (permalink / raw)
  To: David Lechner; +Cc: linux-bluetooth@vger.kernel.org

Hi David,

On Tue, Aug 24, 2021 at 12:00 PM David Lechner <david@lechnology.com> wrote:
>
> When [GATT] Cache = yes is set in configuration BlueZ does not use
> cached UUIDs for the list of service UUIDs. However, it doesn't clear
> the in-memory list of UUIDs received from advertising data, so when
> a device is scanned, connected and disconnected, the internal state
> still reflects that the UUIDs from the advertising data have already
> been handled. device_add_eir_uuids() ignored the UUIDs from the
> advertising data because both dev->le_state.svc_resolved == true and
> dev->eir_uuids still contains the UUIDs from the previous scan session.
>
> This fixes the issue by resetting both le_state.svc_resolved and
> eir_uuids when the device is disconnected.
>
> Issue: https://github.com/bluez/bluez/issues/192
> Signed-off-by: David Lechner <david@lechnology.com>
> ---
>  src/device.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/src/device.c b/src/device.c
> index 807106812..48b9bd8d6 100644
> --- a/src/device.c
> +++ b/src/device.c
> @@ -3129,6 +3129,12 @@ void device_remove_connection(struct btd_device *device, uint8_t bdaddr_type)
>
>         device_update_last_seen(device, bdaddr_type);
>
> +       if (!gatt_cache_is_enabled(device)) {
> +               device->le_state.svc_resolved = false;
> +               g_slist_free_full(device->eir_uuids, g_free);
> +               device->eir_uuids = NULL;
> +       }

We might want to cleanup the eir_uuid regardless of the cache being
enabled, since the next time the device advertise it may have
completely different UUIDs, as for resetting the svc_resolved Id guess
it would be better placed at gatt_cache_cleanup since that is clearing
the db it means should be cache left with should also set svc_resolved
= false.

>         g_dbus_emit_property_changed(dbus_conn, device->path,
>                                                 DEVICE_INTERFACE, "Connected");
>
> --
> 2.25.1
>


-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-24 22:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-24 18:29 [PATCH BlueZ] device: fix advertising data UUIDs ignored when Cache = yes David Lechner
2021-08-24 19:30 ` [BlueZ] " bluez.test.bot
2021-08-24 22:36 ` [PATCH BlueZ] " Luiz Augusto von Dentz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox