All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Lechner <david@lechnology.com>
To: linux-bluetooth@vger.kernel.org
Cc: David Lechner <david@lechnology.com>
Subject: [PATCH BlueZ] device: fix advertising data UUIDs ignored when Cache = yes
Date: Tue, 24 Aug 2021 13:29:16 -0500	[thread overview]
Message-ID: <20210824182916.2569317-1-david@lechnology.com> (raw)

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


             reply	other threads:[~2021-08-24 18:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-24 18:29 David Lechner [this message]
2021-08-24 19:30 ` [BlueZ] device: fix advertising data UUIDs ignored when Cache = yes bluez.test.bot
2021-08-24 22:36 ` [PATCH BlueZ] " Luiz Augusto von Dentz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210824182916.2569317-1-david@lechnology.com \
    --to=david@lechnology.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.