All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ] client/player: Add transport.volume command
@ 2022-04-22 23:02 Luiz Augusto von Dentz
  2022-04-23  0:46 ` [BlueZ] " bluez.test.bot
  2022-04-25 23:00 ` [PATCH BlueZ] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2022-04-22 23:02 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [BlueZ] client/player: Add transport.volume command
  2022-04-22 23:02 [PATCH BlueZ] client/player: Add transport.volume command Luiz Augusto von Dentz
@ 2022-04-23  0:46 ` bluez.test.bot
  2022-04-25 23:00 ` [PATCH BlueZ] " patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2022-04-23  0:46 UTC (permalink / raw)
  To: linux-bluetooth, luiz.dentz

[-- Attachment #1: Type: text/plain, Size: 1234 bytes --]

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH BlueZ] client/player: Add transport.volume command
  2022-04-22 23:02 [PATCH BlueZ] client/player: Add transport.volume command Luiz Augusto von Dentz
  2022-04-23  0:46 ` [BlueZ] " bluez.test.bot
@ 2022-04-25 23:00 ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2022-04-25 23:00 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hello:

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

On Fri, 22 Apr 2022 16:02:38 -0700 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> 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



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-25 23:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-22 23:02 [PATCH BlueZ] client/player: Add transport.volume command Luiz Augusto von Dentz
2022-04-23  0:46 ` [BlueZ] " bluez.test.bot
2022-04-25 23:00 ` [PATCH BlueZ] " patchwork-bot+bluetooth

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.