All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ] client: Avoid scan prompt when discovery is already active
@ 2026-08-08 19:00 z4pdy
  2026-08-08 19:52 ` [BlueZ] " bluez.test.bot
  0 siblings, 1 reply; 3+ messages in thread
From: z4pdy @ 2026-08-08 19:00 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: z4pdy

Check the adapter's Discovering property before prompting the user
to start scanning. This avoids prompting to scan when discovery is
already in progress, which previously resulted
in an org.bluez.Error.InProgress error.
---
 client/main.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/client/main.c b/client/main.c
index b5cad8afc..b8087c449 100644
--- a/client/main.c
+++ b/client/main.c
@@ -2297,8 +2297,20 @@ static void cmd_connect(int argc, char *argv[])
 	proxy = find_proxy_by_address(default_ctrl->devices, argv[1]);
 	if (!proxy) {
 		bt_shell_printf("Device %s not available\n", argv[1]);
-		bt_shell_prompt_input(argv[1], "Scan and connect (yes,no):",
-				      prompt_scan_connect, strdup(argv[1]));
+		dbus_bool_t discovering;
+		DBusMessageIter iter;
+
+		if (g_dbus_proxy_get_property(default_ctrl->proxy,
+					"Discovering", &iter)) {
+			dbus_message_iter_get_basic(&iter, &discovering);
+
+			if (!discovering)
+				bt_shell_prompt_input(argv[1],
+					"Scan and connect (yes,no):",
+					prompt_scan_connect,
+					strdup(argv[1]));
+
+		}
 		return;
 	}
 
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread
* [PATCH BlueZ] client: Avoid scan prompt when discovery is already active
@ 2026-08-08 19:03 z4pdyy
  2026-08-08 19:51 ` [BlueZ] " bluez.test.bot
  0 siblings, 1 reply; 3+ messages in thread
From: z4pdyy @ 2026-08-08 19:03 UTC (permalink / raw)
  To: linux-bluetooth

From: z4pdy <305461556+z4pdy@users.noreply.github.com>

Check the adapter's Discovering property before prompting the user
to start scanning. This avoids prompting to scan when discovery is
already in progress, which previously resulted
in an org.bluez.Error.InProgress error.
---
 client/main.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/client/main.c b/client/main.c
index b5cad8afc..b8087c449 100644
--- a/client/main.c
+++ b/client/main.c
@@ -2297,8 +2297,20 @@ static void cmd_connect(int argc, char *argv[])
 	proxy = find_proxy_by_address(default_ctrl->devices, argv[1]);
 	if (!proxy) {
 		bt_shell_printf("Device %s not available\n", argv[1]);
-		bt_shell_prompt_input(argv[1], "Scan and connect (yes,no):",
-				      prompt_scan_connect, strdup(argv[1]));
+		dbus_bool_t discovering;
+		DBusMessageIter iter;
+
+		if (g_dbus_proxy_get_property(default_ctrl->proxy,
+					"Discovering", &iter)) {
+			dbus_message_iter_get_basic(&iter, &discovering);
+
+			if (!discovering)
+				bt_shell_prompt_input(argv[1],
+					"Scan and connect (yes,no):",
+					prompt_scan_connect,
+					strdup(argv[1]));
+
+		}
 		return;
 	}
 
-- 
2.55.0


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

end of thread, other threads:[~2026-08-08 19:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-08 19:00 [PATCH BlueZ] client: Avoid scan prompt when discovery is already active z4pdy
2026-08-08 19:52 ` [BlueZ] " bluez.test.bot
  -- strict thread matches above, loose matches on Subject: below --
2026-08-08 19:03 [PATCH BlueZ] " z4pdyy
2026-08-08 19:51 ` [BlueZ] " bluez.test.bot

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.