Linux bluetooth development
 help / color / mirror / Atom feed
From: Kevin Dewald <kevin@simpleble.org>
To: linux-bluetooth@vger.kernel.org
Cc: Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
	Kevin Dewald <kevin@simpleble.org>
Subject: [PATCH BlueZ v2 6/6] client: Print discoverable broadcasters in red
Date: Thu,  1 Oct 2026 22:46:17 -0700	[thread overview]
Message-ID: <20261002054618.30994-7-kevin@simpleble.org> (raw)
In-Reply-To: <20261002054618.30994-1-kevin@simpleble.org>

This prints devices in red when they set the discoverable flags but are
not connectable, to warn the user they cannot be connected to despite
being discoverable.
---
 client/main.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/client/main.c b/client/main.c
index 35cd427..ad2c3cb 100644
--- a/client/main.c
+++ b/client/main.c
@@ -183,6 +183,19 @@ static struct set_discovery_filter_args {
 	.set = true,
 };
 
+static bool device_is_broadcaster(GDBusProxy *proxy)
+{
+	DBusMessageIter iter;
+	dbus_bool_t connectable;
+
+	if (!g_dbus_proxy_get_property(proxy, "Connectable", &iter))
+		return false;
+
+	dbus_message_iter_get_basic(&iter, &connectable);
+
+	return !connectable;
+}
+
 static void print_device(GDBusProxy *proxy, const char *description)
 {
 	DBusMessageIter iter;
@@ -227,6 +240,20 @@ static void print_device(GDBusProxy *proxy, const char *description)
 		return;
 	}
 
+	/* Print discoverable broadcasters in red to warn the user they cannot
+	 * be connected to despite being discoverable.
+	 */
+	if (device_is_broadcaster(proxy)) {
+		bt_shell_printf("%s%s%s" COLOR_RED "Device %s %s"
+					COLOR_OFF "\n",
+					description ? "[" : "",
+					description ? : "",
+					description ? "] " : "",
+					address, name);
+
+		return;
+	}
+
 done:
 	bt_shell_printf("%s%s%sDevice %s %s\n",
 					description ? "[" : "",
-- 
2.54.0 (Apple Git-157)


  parent reply	other threads:[~2026-10-02  5:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-02  5:46 [PATCH BlueZ v2 0/6] Add Connectable property to org.bluez.Device Kevin Dewald
2026-10-02  5:46 ` [PATCH BlueZ v2 1/6] org.bluez.Device: Add Connectable property Kevin Dewald
2026-10-02 12:16   ` Add Connectable property to org.bluez.Device bluez.test.bot
2026-10-02  5:46 ` [PATCH BlueZ v2 2/6] org.bluez.Bearer: Add Connectable property Kevin Dewald
2026-10-02  5:46 ` [PATCH BlueZ v2 3/6] device: " Kevin Dewald
2026-10-02  5:46 ` [PATCH BlueZ v2 4/6] bearer: " Kevin Dewald
2026-10-02  5:46 ` [PATCH BlueZ v2 5/6] client: Print Connectable in info Kevin Dewald
2026-10-02  5:46 ` Kevin Dewald [this message]
2026-10-02 15:00 ` [PATCH BlueZ v2 0/6] Add Connectable property to org.bluez.Device 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=20261002054618.30994-7-kevin@simpleble.org \
    --to=kevin@simpleble.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    /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