All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ 1/2] adapter: Fix adding SDP records when operating on LE only mode
@ 2022-03-24 21:36 Luiz Augusto von Dentz
  2022-03-24 21:36 ` [PATCH BlueZ 2/2] a2dp: Don't initialize a2dp_sep->destroy until properly registered Luiz Augusto von Dentz
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2022-03-24 21:36 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

If mode is set to BT_MODE_LE SDP protocol won't be operational so it is
useless to attempt to add records.
---
 src/adapter.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/adapter.c b/src/adapter.c
index 1fcf75ec4..e8b84ccda 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1227,6 +1227,13 @@ int adapter_service_add(struct btd_adapter *adapter, sdp_record_t *rec)
 {
 	int ret;
 
+	/*
+	 * If the controller does not support BR/EDR operation,
+	 * there is no point in trying to add SDP records.
+	 */
+	if (btd_opts.mode == BT_MODE_LE)
+		return -ENOTSUP;
+
 	DBG("%s", adapter->path);
 
 	ret = add_record_to_server(&adapter->bdaddr, rec);
@@ -1240,10 +1247,17 @@ int adapter_service_add(struct btd_adapter *adapter, sdp_record_t *rec)
 
 void adapter_service_remove(struct btd_adapter *adapter, uint32_t handle)
 {
-	sdp_record_t *rec = sdp_record_find(handle);
+	sdp_record_t *rec;
+	/*
+	 * If the controller does not support BR/EDR operation,
+	 * there is no point in trying to remote SDP records.
+	 */
+	if (btd_opts.mode == BT_MODE_LE)
+		return;
 
 	DBG("%s", adapter->path);
 
+	rec = sdp_record_find(handle);
 	if (!rec)
 		return;
 
-- 
2.35.1


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

end of thread, other threads:[~2022-03-28 18:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-24 21:36 [PATCH BlueZ 1/2] adapter: Fix adding SDP records when operating on LE only mode Luiz Augusto von Dentz
2022-03-24 21:36 ` [PATCH BlueZ 2/2] a2dp: Don't initialize a2dp_sep->destroy until properly registered Luiz Augusto von Dentz
2022-03-24 23:25 ` [BlueZ,1/2] adapter: Fix adding SDP records when operating on LE only mode bluez.test.bot
2022-03-28 18:00 ` [PATCH BlueZ 1/2] " patchwork-bot+bluetooth

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.