diff mbox series

[BlueZ,v1] client: Print a warning when setting discoverable without a timeout

Message ID 20240912204458.3037144-1-luiz.dentz@gmail.com
State New
Headers show
Series [BlueZ,v1] client: Print a warning when setting discoverable without a timeout | expand

Commit Message

Luiz Augusto von Dentz Sept. 12, 2024, 8:44 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This makes command discoverable to print a warning if
discoverable-timeout is not set(0):

[bluetooth]# discoverable-timeout 0
[bluetooth]# Changing discoverable-timeout 0 succeeded
[bluetooth]# [CHG] Controller 4C:49:6C:44:F5:E7 DiscoverableTimeout: 0x00000000 (0)
[bluetooth]# discoverable on
Warning: setting discoverable while discoverable-timeout not set(0) is not recommended
---
 client/main.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

bluez.test.bot@gmail.com Sept. 12, 2024, 10:45 p.m. UTC | #1
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=889892

---Test result---

Test Summary:
CheckPatch                    FAIL      26.93 seconds
GitLint                       FAIL      36.52 seconds
BuildEll                      PASS      45.36 seconds
BluezMake                     PASS      1678.48 seconds
MakeCheck                     PASS      13.53 seconds
MakeDistcheck                 PASS      201.91 seconds
CheckValgrind                 PASS      254.43 seconds
CheckSmatch                   PASS      358.21 seconds
bluezmakeextell               PASS      120.68 seconds
IncrementalBuild              PASS      1514.42 seconds
ScanBuild                     PASS      1027.79 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[BlueZ,v1] client: Print a warning when setting discoverable without a timeout
WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#97: 
[bluetooth]# [CHG] Controller 4C:49:6C:44:F5:E7 DiscoverableTimeout: 0x00000000 (0)

/github/workspace/src/src/13802641.patch total: 0 errors, 1 warnings, 25 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/src/13802641.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.


##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[BlueZ,v1] client: Print a warning when setting discoverable without a timeout

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
10: B1 Line exceeds max length (83>80): "[bluetooth]# [CHG] Controller 4C:49:6C:44:F5:E7 DiscoverableTimeout: 0x00000000 (0)"
12: B1 Line exceeds max length (86>80): "Warning: setting discoverable while discoverable-timeout not set(0) is not recommended"


---
Regards,
Linux Bluetooth
patchwork-bot+bluetooth@kernel.org Sept. 13, 2024, 8:20 p.m. UTC | #2
Hello:

This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Thu, 12 Sep 2024 16:44:58 -0400 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> This makes command discoverable to print a warning if
> discoverable-timeout is not set(0):
> 
> [bluetooth]# discoverable-timeout 0
> [bluetooth]# Changing discoverable-timeout 0 succeeded
> [bluetooth]# [CHG] Controller 4C:49:6C:44:F5:E7 DiscoverableTimeout: 0x00000000 (0)
> [bluetooth]# discoverable on
> Warning: setting discoverable while discoverable-timeout not set(0) is not recommended
> 
> [...]

Here is the summary with links:
  - [BlueZ,v1] client: Print a warning when setting discoverable without a timeout
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=41f943630d9a

You are awesome, thank you!
diff mbox series

Patch

diff --git a/client/main.c b/client/main.c
index a96a4263849d..2a5c7527bc6c 100644
--- a/client/main.c
+++ b/client/main.c
@@ -1095,6 +1095,7 @@  static void cmd_pairable(int argc, char *argv[])
 
 static void cmd_discoverable(int argc, char *argv[])
 {
+	DBusMessageIter iter;
 	dbus_bool_t discoverable;
 	char *str;
 
@@ -1104,6 +1105,18 @@  static void cmd_discoverable(int argc, char *argv[])
 	if (check_default_ctrl() == FALSE)
 		return bt_shell_noninteractive_quit(EXIT_FAILURE);
 
+	if (discoverable && g_dbus_proxy_get_property(default_ctrl->proxy,
+					"DiscoverableTimeout", &iter)) {
+		uint32_t value;
+
+		dbus_message_iter_get_basic(&iter, &value);
+
+		if (!value)
+			bt_shell_printf("Warning: setting discoverable while "
+					"discoverable-timeout not set(0) is not"
+					" recommended\n");
+	}
+
 	str = g_strdup_printf("discoverable %s",
 				discoverable == TRUE ? "on" : "off");