From: Luiz Augusto von Dentz <[email protected]>
This adds transport.volume command:
Get/Set transport volume
Usage:
volume <transport> [value]
---
client/player.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 52 insertions(+), 2 deletions(-)
diff --git a/client/player.c b/client/player.c
index 127b55c1f..315cde712 100644
--- a/client/player.c
+++ b/client/player.c
@@ -572,11 +572,13 @@ static void print_iter(const char *label, const char *name,
break;
case DBUS_TYPE_UINT32:
dbus_message_iter_get_basic(iter, &valu32);
- bt_shell_printf("%s%s: 0x%06x\n", label, name, valu32);
+ bt_shell_printf("%s%s: 0x%08x (%u)\n", label, name, valu32,
+ valu32);
break;
case DBUS_TYPE_UINT16:
dbus_message_iter_get_basic(iter, &valu16);
- bt_shell_printf("%s%s: 0x%04x\n", label, name, valu16);
+ bt_shell_printf("%s%s: 0x%04x (%u)\n", label, name, valu16,
+ valu16);
break;
case DBUS_TYPE_INT16:
dbus_message_iter_get_basic(iter, &vals16);
@@ -2525,6 +2527,51 @@ static void cmd_send_transport(int argc, char *argv[])
return bt_shell_noninteractive_quit(EXIT_SUCCESS);
}
+static void volume_callback(const DBusError *error, void *user_data)
+{
+ if (dbus_error_is_set(error)) {
+ bt_shell_printf("Failed to set Volume: %s\n", error->name);
+ return bt_shell_noninteractive_quit(EXIT_FAILURE);
+ }
+
+ bt_shell_printf("Changing Volume succeeded\n");
+
+ return bt_shell_noninteractive_quit(EXIT_SUCCESS);
+}
+
+static void cmd_volume_transport(int argc, char *argv[])
+{
+ GDBusProxy *proxy;
+ char *endptr = NULL;
+ int volume;
+
+ 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);
+ }
+
+
+ if (argc == 2) {
+ print_property(proxy, "Volume");
+ return bt_shell_noninteractive_quit(EXIT_FAILURE);
+ }
+
+ volume = strtol(argv[2], &endptr, 0);
+ if (!endptr || *endptr != '\0' || volume > UINT16_MAX) {
+ bt_shell_printf("Invalid argument: %s\n", argv[2]);
+ return bt_shell_noninteractive_quit(EXIT_FAILURE);
+ }
+
+ if (!g_dbus_proxy_set_property_basic(proxy, "Volume", DBUS_TYPE_UINT16,
+ &volume, volume_callback,
+ NULL, NULL)) {
+ bt_shell_printf("Failed release transport\n");
+ return bt_shell_noninteractive_quit(EXIT_FAILURE);
+ }
+}
+
static const struct bt_shell_menu transport_menu = {
.name = "transport",
.desc = "Media Transport Submenu",
@@ -2542,6 +2589,9 @@ static const struct bt_shell_menu transport_menu = {
transport_generator },
{ "send", "<filename>", cmd_send_transport,
"Send contents of a file" },
+ { "volume", "<transport> [value]", cmd_volume_transport,
+ "Get/Set transport volume",
+ transport_generator },
{} },
};
--
2.35.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=634837
---Test result---
Test Summary:
CheckPatch PASS 1.51 seconds
GitLint FAIL 1.02 seconds
Prep - Setup ELL PASS 42.85 seconds
Build - Prep PASS 0.69 seconds
Build - Configure PASS 8.50 seconds
Build - Make PASS 1414.72 seconds
Make Check PASS 12.05 seconds
Make Check w/Valgrind PASS 448.90 seconds
Make Distcheck PASS 240.44 seconds
Build w/ext ELL - Configure PASS 8.64 seconds
Build w/ext ELL - Make PASS 1436.65 seconds
Incremental Build with patchesPASS 0.00 seconds
Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint with rule in .gitlint
Output:
[BlueZ] client/player: Add transport.volume command
9: B3 Line contains hard tab characters (\t): " volume <transport> [value]"
---
Regards,
Linux Bluetooth
Hello:
This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <[email protected]>:
On Fri, 22 Apr 2022 16:02:38 -0700 you wrote:
> From: Luiz Augusto von Dentz <[email protected]>
>
> This adds transport.volume command:
>
> Get/Set transport volume
> Usage:
> volume <transport> [value]
>
> [...]
Here is the summary with links:
- [BlueZ] client/player: Add transport.volume command
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=dd5b66695c2b
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html