Skip to contentSkip to conversation

client/player: Make endpoint.show print all endpoint with no argument

PATCH Applied Luiz Augusto von Dentz 3 participants 4 messages Sep 27, 2024 – Sep 30, 2024 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/2 client/player: Make endpoint.show print all endpoint with no argument

From: Luiz Augusto von Dentz <[email protected]>

This makes endpoint.show arguments optional and in case none is given print all (local and remote) endpoints:

[bluetooth]# endpoint.show
Endpoint /local/endpoint/a2dp_src/sbc

	UUID 0000110a-0000-1000-8000-00805f9b34fb
	Codec 0x00 (0)
	Media Codec: SBC
	Channel Modes: Mono DualChannel Stereo JointStereo
	Frequencies: 16Khz 32Khz 44.1Khz 48Khz
	Subbands: 4 8
	Blocks: 4 8 12 16
	Bitpool Range: 2-64
Endpoint /local/endpoint/a2dp_snk/sbc
	UUID 0000110b-0000-1000-8000-00805f9b34fb
	Codec 0x00 (0)
	Media Codec: SBC
	Channel Modes: Mono DualChannel Stereo JointStereo
	Frequencies: 16Khz 32Khz 44.1Khz 48Khz
	Subbands: 4 8
	Blocks: 4 8 12 16
	Bitpool Range: 2-64
---
 client/player.c | 46 ++++++++++++++++++++++++++++++++++------------
 1 file changed, 34 insertions(+), 12 deletions(-)
client/player.c +34 -12
index 31d6f95c292b..39c14a9434cb 100644
@@ -2828,10 +2828,42 @@ static void print_local_endpoint(struct endpoint *ep)
 				ep->context);
 }
 
+static void print_endpoint_properties(GDBusProxy *proxy)
+{
+	bt_shell_printf("Endpoint %s\n", g_dbus_proxy_get_path(proxy));
+
+	print_property(proxy, "UUID");
+	print_property(proxy, "Codec");
+	print_capabilities(proxy);
+	print_property(proxy, "Device");
+	print_property(proxy, "DelayReporting");
+	print_property(proxy, "Locations");
+	print_property(proxy, "SupportedContext");
+	print_property(proxy, "Context");
+	print_property(proxy, "QoS");
+}
+
+static void print_endpoints(void *data, void *user_data)
+{
+	print_endpoint_properties(data);
+}
+
+static void print_local_endpoints(void *data, void *user_data)
+{
+	print_local_endpoint(data);
+}
+
 static void cmd_show_endpoint(int argc, char *argv[])
 {
 	GDBusProxy *proxy;
 
+	/* Show all endpoints if no argument is given */
+	if (argc != 2) {
+		g_list_foreach(endpoints, print_endpoints, NULL);
+		g_list_foreach(local_endpoints, print_local_endpoints, NULL);
+		return bt_shell_noninteractive_quit(EXIT_SUCCESS);
+	}
+
 	proxy = g_dbus_proxy_lookup(endpoints, NULL, argv[1],
 						BLUEZ_MEDIA_ENDPOINT_INTERFACE);
 	if (!proxy) {
@@ -2845,17 +2877,7 @@ static void cmd_show_endpoint(int argc, char *argv[])
 		return bt_shell_noninteractive_quit(EXIT_SUCCESS);
 	}
 
-	bt_shell_printf("Endpoint %s\n", g_dbus_proxy_get_path(proxy));
-
-	print_property(proxy, "UUID");
-	print_property(proxy, "Codec");
-	print_capabilities(proxy);
-	print_property(proxy, "Device");
-	print_property(proxy, "DelayReporting");
-	print_property(proxy, "Locations");
-	print_property(proxy, "SupportedContext");
-	print_property(proxy, "Context");
-	print_property(proxy, "QoS");
+	print_endpoint_properties(proxy);
 
 	return bt_shell_noninteractive_quit(EXIT_SUCCESS);
 }
@@ -4320,7 +4342,7 @@ static const struct bt_shell_menu endpoint_menu = {
 	.entries = {
 	{ "list",         "[local]",    cmd_list_endpoints,
 						"List available endpoints" },
-	{ "show",         "<endpoint>", cmd_show_endpoint,
+	{ "show",         "[endpoint]", cmd_show_endpoint,
 						"Endpoint information",
 						endpoint_generator },
 	{ "register",     "<UUID> <codec[:company]> [capabilities...]",
Signature · 1 line
2.46.1
author maintainer
#1 lore raw

PATCH 2/2 client/player: Make transport.show print all transports with no argument

From: Luiz Augusto von Dentz <[email protected]>

This makes transport.show arguments optional and in case none is given print all configured transports:

[bluetooth]# transport.show
Transport /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/sep4/fd0

	UUID: Audio Source              (0000110a-0000-1000-8000-00805f9b34fb)
	Codec: 0x02 (2)
	Media Codec: MPEG24
	Object Types: MPEG-2 AAC LC
	Frequencies: 48kHz
	Channels: 2
	Bitrate: 320000
	VBR: Yes
	Device: /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX
	State: active
	Delay: 0x06a4 (1700)
	Volume: 0x0059 (89)
	Endpoint: /org/bluez/hci0/dev_94_XX_XX_XX_XX_XX/sep4
---
 client/player.c | 38 +++++++++++++++++++++++++++-----------
 1 file changed, 27 insertions(+), 11 deletions(-)
client/player.c +27 -11
index 39c14a9434cb..df22465169d5 100644
@@ -5048,17 +5048,8 @@ static void print_configuration(GDBusProxy *proxy)
 	print_lc3_meta(data, len);
 }
 
-static void cmd_show_transport(int argc, char *argv[])
+static void print_transport_properties(GDBusProxy *proxy)
 {
-	GDBusProxy *proxy;
-
-	proxy = g_dbus_proxy_lookup(transports, NULL, argv[1],
-					BLUEZ_MEDIA_TRANSPORT_INTERFACE);
-	if (!proxy) {
-		bt_shell_printf("Transport %s not found\n", argv[1]);
-		return bt_shell_noninteractive_quit(EXIT_FAILURE);
-	}
-
 	bt_shell_printf("Transport %s\n", g_dbus_proxy_get_path(proxy));
 
 	print_property(proxy, "UUID");
@@ -5072,6 +5063,31 @@ static void cmd_show_transport(int argc, char *argv[])
 	print_property(proxy, "QoS");
 	print_property(proxy, "Location");
 	print_property(proxy, "Links");
+}
+
+static void print_transports(void *data, void *user_data)
+{
+	print_transport_properties(data);
+}
+
+static void cmd_show_transport(int argc, char *argv[])
+{
+	GDBusProxy *proxy;
+
+	/* Show all transports if no argument is given */
+	if (argc != 2) {
+		g_list_foreach(transports, print_transports, NULL);
+		return bt_shell_noninteractive_quit(EXIT_SUCCESS);
+	}
+
+	proxy = g_dbus_proxy_lookup(transports, NULL, argv[1],
+					BLUEZ_MEDIA_TRANSPORT_INTERFACE);
+	if (!proxy) {
+		bt_shell_printf("Transport %s not found\n", argv[1]);
+		return bt_shell_noninteractive_quit(EXIT_FAILURE);
+	}
+
+	print_transport_properties(proxy);
 
 	return bt_shell_noninteractive_quit(EXIT_SUCCESS);
 }
@@ -5641,7 +5657,7 @@ static const struct bt_shell_menu transport_menu = {
 	.entries = {
 	{ "list",         NULL,    cmd_list_transport,
 						"List available transports" },
-	{ "show",        "<transport>", cmd_show_transport,
+	{ "show",        "[transport]", cmd_show_transport,
 						"Transport information",
 						transport_generator },
 	{ "acquire",     "<transport> [transport1...]", cmd_acquire_transport,
Signature · 1 line
2.46.1
#2 lore raw
In reply to Luiz Augusto von Dentz

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=893563

---Test result---

Test Summary:

CheckPatch                    PASS      0.62 seconds
GitLint                       FAIL      0.69 seconds
BuildEll                      PASS      24.15 seconds
BluezMake                     PASS      1594.08 seconds
MakeCheck                     PASS      13.20 seconds
MakeDistcheck                 PASS      179.98 seconds
CheckValgrind                 PASS      252.34 seconds
CheckSmatch                   PASS      356.04 seconds
bluezmakeextell               PASS      119.47 seconds
IncrementalBuild              PASS      2854.97 seconds
ScanBuild                     WARNING   1035.22 seconds

Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[BlueZ,v1,1/2] client/player: Make endpoint.show print all endpoint with no argument

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
1: T1 Title exceeds max length (84>80): "[BlueZ,v1,1/2] client/player: Make endpoint.show print all endpoint with no argument"
10: B3 Line contains hard tab characters (\t): " UUID 0000110a-0000-1000-8000-00805f9b34fb"
11: B3 Line contains hard tab characters (\t): " Codec 0x00 (0)"
12: B3 Line contains hard tab characters (\t): " Media Codec: SBC"
13: B3 Line contains hard tab characters (\t): " Channel Modes: Mono DualChannel Stereo JointStereo"
14: B3 Line contains hard tab characters (\t): " Frequencies: 16Khz 32Khz 44.1Khz 48Khz"
15: B3 Line contains hard tab characters (\t): " Subbands: 4 8"
16: B3 Line contains hard tab characters (\t): " Blocks: 4 8 12 16"
17: B3 Line contains hard tab characters (\t): " Bitpool Range: 2-64"
19: B3 Line contains hard tab characters (\t): " UUID 0000110b-0000-1000-8000-00805f9b34fb"
20: B3 Line contains hard tab characters (\t): " Codec 0x00 (0)"
21: B3 Line contains hard tab characters (\t): " Media Codec: SBC"
22: B3 Line contains hard tab characters (\t): " Channel Modes: Mono DualChannel Stereo JointStereo"
23: B3 Line contains hard tab characters (\t): " Frequencies: 16Khz 32Khz 44.1Khz 48Khz"
24: B3 Line contains hard tab characters (\t): " Subbands: 4 8"
25: B3 Line contains hard tab characters (\t): " Blocks: 4 8 12 16"
26: B3 Line contains hard tab characters (\t): " Bitpool Range: 2-64"
[BlueZ,v1,2/2] client/player: Make transport.show print all transports with no argument

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
1: T1 Title exceeds max length (87>80): "[BlueZ,v1,2/2] client/player: Make transport.show print all transports with no argument"
10: B3 Line contains hard tab characters (\t): " UUID: Audio Source (0000110a-0000-1000-8000-00805f9b34fb)"
11: B3 Line contains hard tab characters (\t): " Codec: 0x02 (2)"
12: B3 Line contains hard tab characters (\t): " Media Codec: MPEG24"
13: B3 Line contains hard tab characters (\t): " Object Types: MPEG-2 AAC LC"
14: B3 Line contains hard tab characters (\t): " Frequencies: 48kHz"
15: B3 Line contains hard tab characters (\t): " Channels: 2"
16: B3 Line contains hard tab characters (\t): " Bitrate: 320000"
17: B3 Line contains hard tab characters (\t): " VBR: Yes"
18: B3 Line contains hard tab characters (\t): " Device: /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX"
19: B3 Line contains hard tab characters (\t): " State: active"
20: B3 Line contains hard tab characters (\t): " Delay: 0x06a4 (1700)"
21: B3 Line contains hard tab characters (\t): " Volume: 0x0059 (89)"
22: B3 Line contains hard tab characters (\t): " Endpoint: /org/bluez/hci0/dev_94_XX_XX_XX_XX_XX/sep4"
##############################
Test: ScanBuild - WARNING
Desc: Run Scan Build
Output:
client/player.c:2206:8: warning: Null pointer passed to 2nd parameter expecting 'nonnull'

                if (!strcmp(ep->path, pattern))
                     ^~~~~~~~~~~~~~~~~~~~~~~~~
client/player.c:3476:16: warning: Null pointer passed to 1st parameter expecting 'nonnull'
        codec->name = strdup(name);
                      ^~~~~~~~~~~~

2 warnings generated.

---
Regards,
Linux Bluetooth

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

Hello:

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

Quoted 25 lines · On Fri, 27 Sep 2024 15:54:15 -0400 you wrote:

From: Luiz Augusto von Dentz <[email protected]>

This makes endpoint.show arguments optional and in case none is given print all (local and remote) endpoints:

[bluetooth]# endpoint.show
Endpoint /local/endpoint/a2dp_src/sbc

	UUID 0000110a-0000-1000-8000-00805f9b34fb
	Codec 0x00 (0)
	Media Codec: SBC
	Channel Modes: Mono DualChannel Stereo JointStereo
	Frequencies: 16Khz 32Khz 44.1Khz 48Khz
	Subbands: 4 8
	Blocks: 4 8 12 16
	Bitpool Range: 2-64
Endpoint /local/endpoint/a2dp_snk/sbc
	UUID 0000110b-0000-1000-8000-00805f9b34fb
	Codec 0x00 (0)
	Media Codec: SBC
	Channel Modes: Mono DualChannel Stereo JointStereo
	Frequencies: 16Khz 32Khz 44.1Khz 48Khz
	Subbands: 4 8
	Blocks: 4 8 12 16
	Bitpool Range: 2-64
Quoted 1 line

[...]

Here is the summary with links:
- [BlueZ,v1,1/2] client/player: Make endpoint.show print all endpoint with no argument

    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=95c15d2ca02a
  - [BlueZ,v1,2/2] client/player: Make transport.show print all transports with no argument
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=eda123dc6d8e

You are awesome, thank you!

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