public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: "Frédéric Danis" <frederic.danis@collabora.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ] tools/btpclient: Fix discovery filter setup
Date: Thu, 15 Jan 2026 15:36:09 +0100	[thread overview]
Message-ID: <20260115143609.12559-1-frederic.danis@collabora.com> (raw)

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


             reply	other threads:[~2026-01-15 14:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-15 14:36 Frédéric Danis [this message]
2026-01-15 15:37 ` [BlueZ] tools/btpclient: Fix discovery filter setup bluez.test.bot
2026-01-15 21:40 ` [PATCH BlueZ] " patchwork-bot+bluetooth

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=20260115143609.12559-1-frederic.danis@collabora.com \
    --to=frederic.danis@collabora.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox