Linux bluetooth development
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 4/4] android/avrcp: Add support to set volume command
Date: Fri,  7 Mar 2014 14:15:43 +0200	[thread overview]
Message-ID: <1394194543-3095-4-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1394194543-3095-1-git-send-email-luiz.dentz@gmail.com>

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

---
 android/avrcp.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/android/avrcp.c b/android/avrcp.c
index 978e6c0..11a2614 100644
--- a/android/avrcp.c
+++ b/android/avrcp.c
@@ -332,10 +332,35 @@ done:
 
 static void handle_set_volume(const void *buf, uint16_t len)
 {
+	struct hal_cmd_avrcp_set_volume *cmd = (void *) buf;
+	struct avrcp_device *dev;
+	uint8_t status;
+	int ret;
+
 	DBG("");
 
+	if (!devices) {
+		error("AVRCP: No device found to set volume");
+		status = HAL_STATUS_FAILED;
+		goto done;
+	}
+
+	/* Peek the first device since the HAL cannot really address a specific
+	 * device it might mean there could only be one connected.
+	 */
+	dev = devices->data;
+
+	ret = avrcp_set_volume(dev->session, cmd->value & 0x7f, NULL, NULL);
+	if (ret < 0) {
+		status = HAL_STATUS_FAILED;
+		goto done;
+	}
+
+	status = HAL_STATUS_SUCCESS;
+
+done:
 	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_AVRCP, HAL_OP_AVRCP_SET_VOLUME,
-							HAL_STATUS_FAILED);
+								status);
 }
 
 static const struct ipc_handler cmd_handlers[] = {
-- 
1.8.5.3


  parent reply	other threads:[~2014-03-07 12:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-07 12:15 [PATCH BlueZ 1/4] android/avrcp-lib: Add avrcp_register_notification function Luiz Augusto von Dentz
2014-03-07 12:15 ` [PATCH BlueZ 2/4] android/avrcp: Add support to receive volume changed notifications Luiz Augusto von Dentz
2014-03-07 12:15 ` [PATCH BlueZ 3/4] android/avrcp-lib: Add avrcp_set_volume function Luiz Augusto von Dentz
2014-03-07 12:15 ` Luiz Augusto von Dentz [this message]
2014-03-07 12:22 ` [PATCH BlueZ 1/4] android/avrcp-lib: Add avrcp_register_notification function Andrei Emeltchenko
2014-03-07 13:00   ` Luiz Augusto von Dentz
2014-03-07 13:09     ` Andrei Emeltchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1394194543-3095-4-git-send-email-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox