From: Szymon Janc <szymon.janc@tieto.com>
To: linux-bluetooth@vger.kernel.org
Cc: Szymon Janc <szymon.janc@tieto.com>
Subject: [PATCH 2/3] android/handsfree: Add support for configure WBS command
Date: Wed, 17 Dec 2014 15:53:32 +0100 [thread overview]
Message-ID: <1418828013-12385-2-git-send-email-szymon.janc@tieto.com> (raw)
In-Reply-To: <1418828013-12385-1-git-send-email-szymon.janc@tieto.com>
This allows to disable/enable WBS on specific headset.
---
android/handsfree.c | 36 +++++++++++++++++++++++++++++++++++-
1 file changed, 35 insertions(+), 1 deletion(-)
diff --git a/android/handsfree.c b/android/handsfree.c
index da89623..f3ea770 100644
--- a/android/handsfree.c
+++ b/android/handsfree.c
@@ -2499,17 +2499,51 @@ failed:
static void handle_configure_wbs(const void *buf, uint16_t len)
{
const struct hal_cmd_handsfree_configure_wbs *cmd = buf;
+ struct hf_device *dev;
+ bdaddr_t bdaddr;
uint8_t status;
+ if (!(hfp_ag_features & HFP_AG_FEAT_CODEC)) {
+ status = HAL_STATUS_FAILED;
+ goto done;
+ }
+
+ android2bdaddr(cmd->bdaddr, &bdaddr);
+
+ dev = find_device(&bdaddr);
+ if (!dev) {
+ status = HAL_STATUS_FAILED;
+ goto done;
+ }
+
+ if (dev->audio_state != HAL_EV_HANDSFREE_AUDIO_STATE_DISCONNECTED){
+ status = HAL_STATUS_FAILED;
+ goto done;
+ }
+
switch (cmd->config) {
- case HAL_HANDSFREE_WBS_NONE:
case HAL_HANDSFREE_WBS_NO:
+ dev->codecs[MSBC_OFFSET].local_supported = false;
+ break;
case HAL_HANDSFREE_WBS_YES:
+ dev->codecs[MSBC_OFFSET].local_supported = true;
+ break;
+ case HAL_HANDSFREE_WBS_NONE:
+ /* TODO */
default:
status = HAL_STATUS_FAILED;
break;
}
+ /*
+ * cleanup negotiated codec if WBS support was changed, it will be
+ * renegotiated on next audio connection based on currently supported
+ * codecs
+ */
+ dev->negotiated_codec = 0;
+ status = HAL_STATUS_SUCCESS;
+
+done:
ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HANDSFREE,
HAL_OP_HANDSFREE_CONFIGURE_WBS, status);
}
--
1.9.1
next prev parent reply other threads:[~2014-12-17 14:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-17 14:53 [PATCH 1/3] android/handsfree: Add initial support for configure WBS commmand Szymon Janc
2014-12-17 14:53 ` Szymon Janc [this message]
2014-12-17 14:53 ` [PATCH 3/3] android/README: Update implementation status for handsfree Szymon Janc
2014-12-19 13:31 ` [PATCH 1/3] android/handsfree: Add initial support for configure WBS commmand Szymon Janc
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=1418828013-12385-2-git-send-email-szymon.janc@tieto.com \
--to=szymon.janc@tieto.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