diff mbox series

[BlueZ,v1] client/print: Add decoding for UUID properties

Message ID 20240918192707.686174-1-luiz.dentz@gmail.com (mailing list archive)
State Accepted
Commit b22859e3cc0b31959f76ec4f1682613f102e256b
Headers show
Series [BlueZ,v1] client/print: Add decoding for UUID properties | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch warning WARNING:PREFER_FALLTHROUGH: Prefer 'fallthrough;' over fallthrough comment #182: FILE: client/print.c:124: + /* fall through */ /github/workspace/src/src/13807128.patch total: 0 errors, 1 warnings, 103 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/13807128.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.
tedd_an/GitLint fail 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: B3 Line contains hard tab characters (\t): " UUID: Audio Source (0000110a-0000-1000-8000-00805f9b34fb)"
tedd_an/BuildEll success Build ELL PASS
tedd_an/BluezMake success Bluez Make PASS
tedd_an/MakeCheck success Bluez Make Check PASS
tedd_an/MakeDistcheck success Make Distcheck PASS
tedd_an/CheckValgrind success Check Valgrind PASS
tedd_an/CheckSmatch success CheckSparse PASS
tedd_an/bluezmakeextell success Make External ELL PASS
tedd_an/IncrementalBuild success Incremental Build PASS
tedd_an/ScanBuild success Scan Build PASS

Commit Message

Luiz Augusto von Dentz Sept. 18, 2024, 7:27 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This adds proper decoding for UUID properties with usage of
bt_uuidstr_to_str so it can print the 'friendly' name as bellow:

bluetoothctl# transport.show /org/bluez/hci0/dev_94_DB_56_F7_F2_88/sep4/fd0
Transport /org/bluez/hci0/dev_94_DB_56_F7_F2_88/sep4/fd0
	UUID: Audio Source              (0000110a-0000-1000-8000-00805f9b34fb)
...
---
 client/main.c  | 33 +++------------------------------
 client/print.c | 33 +++++++++++++++++++++++++++++++++
 client/print.h |  1 +
 3 files changed, 37 insertions(+), 30 deletions(-)

Comments

bluez.test.bot@gmail.com Sept. 18, 2024, 9:02 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=891253

---Test result---

Test Summary:
CheckPatch                    FAIL      0.69 seconds
GitLint                       FAIL      0.53 seconds
BuildEll                      PASS      24.06 seconds
BluezMake                     PASS      1598.31 seconds
MakeCheck                     PASS      13.09 seconds
MakeDistcheck                 PASS      176.33 seconds
CheckValgrind                 PASS      247.69 seconds
CheckSmatch                   PASS      349.49 seconds
bluezmakeextell               PASS      118.02 seconds
IncrementalBuild              PASS      1475.52 seconds
ScanBuild                     PASS      1010.27 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[BlueZ,v1] client/print: Add decoding for UUID properties
WARNING:PREFER_FALLTHROUGH: Prefer 'fallthrough;' over fallthrough comment
#182: FILE: client/print.c:124:
+		/* fall through */

/github/workspace/src/src/13807128.patch total: 0 errors, 1 warnings, 103 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/13807128.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: Add decoding for UUID properties

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: B3 Line contains hard tab characters (\t): "	UUID: Audio Source              (0000110a-0000-1000-8000-00805f9b34fb)"


---
Regards,
Linux Bluetooth
patchwork-bot+bluetooth@kernel.org Sept. 19, 2024, 5 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 Wed, 18 Sep 2024 15:27:07 -0400 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> This adds proper decoding for UUID properties with usage of
> bt_uuidstr_to_str so it can print the 'friendly' name as bellow:
> 
> bluetoothctl# transport.show /org/bluez/hci0/dev_94_DB_56_F7_F2_88/sep4/fd0
> Transport /org/bluez/hci0/dev_94_DB_56_F7_F2_88/sep4/fd0
> 	UUID: Audio Source              (0000110a-0000-1000-8000-00805f9b34fb)
> ...
> 
> [...]

Here is the summary with links:
  - [BlueZ,v1] client/print: Add decoding for UUID properties
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=b22859e3cc0b

You are awesome, thank you!
diff mbox series

Patch

diff --git a/client/main.c b/client/main.c
index a6217e03327b..50aa3e7a6cbe 100644
--- a/client/main.c
+++ b/client/main.c
@@ -221,33 +221,6 @@  done:
 					address, name);
 }
 
-static void print_uuid(const char *label, const char *uuid)
-{
-	const char *text;
-
-	text = bt_uuidstr_to_str(uuid);
-	if (text) {
-		char str[26];
-		unsigned int n;
-
-		str[sizeof(str) - 1] = '\0';
-
-		n = snprintf(str, sizeof(str), "%s", text);
-		if (n > sizeof(str) - 1) {
-			str[sizeof(str) - 2] = '.';
-			str[sizeof(str) - 3] = '.';
-			if (str[sizeof(str) - 4] == ' ')
-				str[sizeof(str) - 4] = '.';
-
-			n = sizeof(str) - 1;
-		}
-
-		bt_shell_printf("\t%s: %s%*c(%s)\n", label, str, 26 - n, ' ',
-									uuid);
-	} else
-		bt_shell_printf("\t%s: %*c(%s)\n", label, 26, ' ', uuid);
-}
-
 static void print_uuids(GDBusProxy *proxy)
 {
 	DBusMessageIter iter, value;
@@ -262,7 +235,7 @@  static void print_uuids(GDBusProxy *proxy)
 
 		dbus_message_iter_get_basic(&value, &uuid);
 
-		print_uuid("UUID", uuid);
+		print_uuid("\t", "UUID", uuid);
 
 		dbus_message_iter_next(&value);
 	}
@@ -283,7 +256,7 @@  static void print_experimental(GDBusProxy *proxy)
 
 		dbus_message_iter_get_basic(&value, &uuid);
 
-		print_uuid("ExperimentalFeatures", uuid);
+		print_uuid("\t", "ExperimentalFeatures", uuid);
 
 		dbus_message_iter_next(&value);
 	}
@@ -1376,7 +1349,7 @@  static void cmd_scan_filter_uuids(int argc, char *argv[])
 		char **uuid;
 
 		for (uuid = filter.uuids; uuid && *uuid; uuid++)
-			print_uuid("UUID", *uuid);
+			print_uuid("\t", "UUID", *uuid);
 
 		return bt_shell_noninteractive_quit(EXIT_SUCCESS);
 	}
diff --git a/client/print.c b/client/print.c
index 8d721e21df4b..39f8567eedd3 100644
--- a/client/print.c
+++ b/client/print.c
@@ -116,6 +116,12 @@  void print_iter(const char *label, const char *name, DBusMessageIter *iter)
 		bt_shell_printf("%s%s is invalid\n", label, name);
 		break;
 	case DBUS_TYPE_STRING:
+		if (!strcasecmp(name, "UUID")) {
+			dbus_message_iter_get_basic(iter, &valstr);
+			print_uuid(label, name, valstr);
+			break;
+		}
+		/* fall through */
 	case DBUS_TYPE_OBJECT_PATH:
 		dbus_message_iter_get_basic(iter, &valstr);
 		bt_shell_printf("%s%s: %s\n", label, name, valstr);
@@ -203,3 +209,30 @@  void print_property(GDBusProxy *proxy, const char *name)
 {
 	print_property_with_label(proxy, name, NULL);
 }
+
+void print_uuid(const char *label, const char *name, const char *uuid)
+{
+	const char *text;
+
+	text = bt_uuidstr_to_str(uuid);
+	if (text) {
+		char str[26];
+		unsigned int n;
+
+		str[sizeof(str) - 1] = '\0';
+
+		n = snprintf(str, sizeof(str), "%s", text);
+		if (n > sizeof(str) - 1) {
+			str[sizeof(str) - 2] = '.';
+			str[sizeof(str) - 3] = '.';
+			if (str[sizeof(str) - 4] == ' ')
+				str[sizeof(str) - 4] = '.';
+
+			n = sizeof(str) - 1;
+		}
+
+		bt_shell_printf("%s%s: %s%*c(%s)\n", label, name, str, 26 - n,
+								' ', uuid);
+	} else
+		bt_shell_printf("%s%s: %*c(%s)\n", label, name, 26, ' ', uuid);
+}
diff --git a/client/print.h b/client/print.h
index c0866d06c504..56bcce16a661 100644
--- a/client/print.h
+++ b/client/print.h
@@ -12,3 +12,4 @@  void print_property(GDBusProxy *proxy, const char *name);
 void print_property_with_label(GDBusProxy *proxy, const char *name,
 					const char *label);
 void print_iter(const char *label, const char *name, DBusMessageIter *iter);
+void print_uuid(const char *label, const char *name, const char *uuid);