Skip to contentSkip to conversation

client: Avoid scan prompt when discovery is already active

PATCH Applied [email protected] 3 participants 3 messages Aug 8 – Aug 11 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 client: Avoid scan prompt when discovery is already active

From: z4pdy <[email protected]>

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.

Changes in v2:
- Move variable declarations to the beginning of cmd_connect() to fix the ISO C90 build failure.

---
 client/main.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
client/main.c +14 -2
index b5cad8afc..069e20485 100644
@@ -2290,6 +2290,8 @@ static void cmd_connect(int argc, char *argv[])
 	const char *method = "Connect";
 	char profile[128] = "";
 	GDBusProxy *proxy;
+	dbus_bool_t discovering;
+	DBusMessageIter iter;
 
 	if (check_default_ctrl() == FALSE)
 		return bt_shell_noninteractive_quit(EXIT_FAILURE);
@@ -2297,8 +2299,18 @@ 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]));
+
+		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;
 	}
 
Signature · 1 line
2.55.0
#1 lore raw

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=1142780

---Test result---

Test Summary:

CheckPatch                    PASS      0.39 seconds
GitLint                       PASS      0.26 seconds
BuildEll                      PASS      18.13 seconds
BluezMake                     PASS      657.32 seconds
CheckSmatch                   PASS      271.96 seconds
bluezmakeextell               PASS      94.34 seconds
IncrementalBuild              PASS      651.69 seconds
ScanBuild                     PASS      881.35 seconds

https://github.com/bluez/bluez/pull/2392

---
Regards,
Linux Bluetooth

#2 lore raw
In reply to [email protected]
This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 8 lines · On Sat, 8 Aug 2026 22:05:17 +0200 you wrote:

From: z4pdy <[email protected]>

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.

[...]

Here is the summary with links:
- [BlueZ,v2] client: Avoid scan prompt when discovery is already active

    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=ea77a7229c76

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html