public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ] tools/btpclient: Fix discovery filter setup
@ 2026-01-15 14:36 Frédéric Danis
  2026-01-15 15:37 ` [BlueZ] " bluez.test.bot
  2026-01-15 21:40 ` [PATCH BlueZ] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages in thread
From: Frédéric Danis @ 2026-01-15 14:36 UTC (permalink / raw)
  To: linux-bluetooth

Fix transport mode test to use 'auto' only when both BREDR and LE are
set.

Add an empty filter to discover all devices.

This allows to pass GAP/BROB/OBSV/BV-01-C and GAP/BROB/OBSV/BV-02-C
tests with auto-pts.
---
 tools/btpclient.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/tools/btpclient.c b/tools/btpclient.c
index a140253d9..5b531bfbd 100644
--- a/tools/btpclient.c
+++ b/tools/btpclient.c
@@ -1340,15 +1340,17 @@ static void set_discovery_filter_setup(struct l_dbus_message *message,
 	builder = l_dbus_message_builder_new(message);
 
 	l_dbus_message_builder_enter_array(builder, "{sv}");
-	l_dbus_message_builder_enter_dict(builder, "sv");
 
 	/* Be in observer mode or in general mode (default in Bluez) */
 	if (flags & BTP_GAP_DISCOVERY_FLAG_OBSERVATION) {
+		l_dbus_message_builder_enter_dict(builder, "sv");
 		l_dbus_message_builder_append_basic(builder, 's', "Transport");
 		l_dbus_message_builder_enter_variant(builder, "s");
 
-		if (flags & (BTP_GAP_DISCOVERY_FLAG_LE |
-						BTP_GAP_DISCOVERY_FLAG_BREDR))
+		if ((flags & (BTP_GAP_DISCOVERY_FLAG_LE |
+					BTP_GAP_DISCOVERY_FLAG_BREDR)) ==
+				(BTP_GAP_DISCOVERY_FLAG_LE |
+					BTP_GAP_DISCOVERY_FLAG_BREDR))
 			l_dbus_message_builder_append_basic(builder, 's',
 									"auto");
 		else if (flags & BTP_GAP_DISCOVERY_FLAG_LE)
@@ -1358,9 +1360,17 @@ static void set_discovery_filter_setup(struct l_dbus_message *message,
 								"bredr");
 
 		l_dbus_message_builder_leave_variant(builder);
+		l_dbus_message_builder_leave_dict(builder);
+
+		/* Add empty pattern to discover all devices */
+		l_dbus_message_builder_enter_dict(builder, "sv");
+		l_dbus_message_builder_append_basic(builder, 's', "Pattern");
+		l_dbus_message_builder_enter_variant(builder, "s");
+		l_dbus_message_builder_append_basic(builder, 's', "");
+		l_dbus_message_builder_leave_variant(builder);
+		l_dbus_message_builder_leave_dict(builder);
 	}
 
-	l_dbus_message_builder_leave_dict(builder);
 	l_dbus_message_builder_leave_array(builder);
 
 	/* TODO add passive, limited discovery */
-- 
2.43.0


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

end of thread, other threads:[~2026-01-15 21:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-15 14:36 [PATCH BlueZ] tools/btpclient: Fix discovery filter setup Frédéric Danis
2026-01-15 15:37 ` [BlueZ] " bluez.test.bot
2026-01-15 21:40 ` [PATCH BlueZ] " patchwork-bot+bluetooth

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