From: Vinicius Costa Gomes <vcgomes@gmail.com>
To: ofono@ofono.org
Subject: [PATCH 2/7] handsfree-audio: Add support for detecting Transparent SCO support
Date: Tue, 10 Sep 2013 21:09:41 -0300 [thread overview]
Message-ID: <1378858186-683-2-git-send-email-vcgomes@gmail.com> (raw)
In-Reply-To: <1378858186-683-1-git-send-email-vcgomes@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3168 bytes --]
---
include/handsfree-audio.h | 2 +-
plugins/hfp_hf_bluez5.c | 2 +-
src/handsfree-audio.c | 18 ++++++++++++++----
3 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/include/handsfree-audio.h b/include/handsfree-audio.h
index 846a032..03e3b38 100644
--- a/include/handsfree-audio.h
+++ b/include/handsfree-audio.h
@@ -53,7 +53,7 @@ ofono_bool_t ofono_handsfree_card_set_codec(struct ofono_handsfree_card *card,
ofono_bool_t ofono_handsfree_audio_has_wideband(void);
-ofono_bool_t ofono_handsfree_audio_has_defer_setup(void);
+ofono_bool_t ofono_handsfree_audio_has_transparent_sco(void);
void ofono_handsfree_card_set_data(struct ofono_handsfree_card *card,
void *data);
diff --git a/plugins/hfp_hf_bluez5.c b/plugins/hfp_hf_bluez5.c
index 40d8ce0..f08bf53 100644
--- a/plugins/hfp_hf_bluez5.c
+++ b/plugins/hfp_hf_bluez5.c
@@ -645,7 +645,7 @@ static void connect_handler(DBusConnection *conn, void *user_data)
* Assuming that if defer_setup is supported, then SCO transparent
* mode is also supported
*/
- if (ofono_handsfree_audio_has_defer_setup())
+ if (ofono_handsfree_audio_has_transparent_sco())
features |= HFP_SDP_HF_FEATURE_WIDEBAND_SPEECH;
DBG("Registering External Profile handler ...");
diff --git a/src/handsfree-audio.c b/src/handsfree-audio.c
index c311b04..52d111a 100644
--- a/src/handsfree-audio.c
+++ b/src/handsfree-audio.c
@@ -67,6 +67,7 @@ static guint sco_watch = 0;
static GSList *drivers = 0;
static ofono_bool_t has_wideband = FALSE;
static int defer_setup = 1;
+static ofono_bool_t transparent_sco = FALSE;
static uint16_t codec2setting(uint8_t codec)
{
@@ -192,7 +193,9 @@ static int sco_init(void)
{
GIOChannel *sco_io;
struct sockaddr_sco saddr;
+ struct bt_voice voice;
int sk;
+ socklen_t len;
sk = socket(PF_BLUETOOTH, SOCK_SEQPACKET | O_NONBLOCK | SOCK_CLOEXEC,
BTPROTO_SCO);
@@ -216,6 +219,13 @@ static int sco_init(void)
strerror(errno), errno);
}
+ memset(&voice, 0, sizeof(voice));
+ len = sizeof(voice);
+
+ if (defer_setup && getsockopt(sk, SOL_BLUETOOTH, BT_VOICE,
+ &voice, &len) == 0)
+ transparent_sco = TRUE;
+
if (listen(sk, 5) < 0) {
close(sk);
return -errno;
@@ -599,9 +609,9 @@ ofono_bool_t ofono_handsfree_audio_has_wideband(void)
return has_wideband;
}
-ofono_bool_t ofono_handsfree_audio_has_defer_setup(void)
+ofono_bool_t ofono_handsfree_audio_has_transparent_sco(void)
{
- return defer_setup == 1;
+ return transparent_sco;
}
static void agent_free(struct agent *agent)
@@ -721,12 +731,12 @@ static DBusMessage *am_agent_register(DBusConnection *conn,
DBG("Agent %s registered with the CODECs:%s%s", sender,
has_cvsd ? " CVSD" : "", has_msbc ? " mSBC" : "");
- if (has_msbc && defer_setup == 1)
+ if (has_msbc && transparent_sco)
has_wideband = TRUE;
else {
has_wideband = FALSE;
DBG("Wideband speech disabled: %s", has_msbc ?
- "no SCO defer setup support" : "no mSBC support");
+ "no Transparent SCO support" : "no mSBC support");
}
if (has_cvsd == FALSE) {
--
1.8.4
next prev parent reply other threads:[~2013-09-11 0:09 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-11 0:09 [PATCH 1/7] handsfree-audio: Add setting SCO air mode Vinicius Costa Gomes
2013-09-11 0:09 ` Vinicius Costa Gomes [this message]
2013-09-12 18:20 ` [PATCH 2/7] handsfree-audio: Add support for detecting Transparent SCO support Denis Kenzior
2013-09-11 0:09 ` [PATCH 3/7] handsfree-audio: Set the voice setting for outgoing connections Vinicius Costa Gomes
2013-09-11 0:09 ` [PATCH 4/7] handsfree-audio: Do not allow cards to be registered if no defer_setup Vinicius Costa Gomes
2013-09-11 0:09 ` [PATCH 5/7] handsfree-audio: Fix keeping the socket open without defer_setup Vinicius Costa Gomes
2013-09-11 0:09 ` [PATCH 6/7] hfp_hf_bluez5: Handle org.bluez.Profile1.Cancel() Vinicius Costa Gomes
2013-09-12 18:21 ` Denis Kenzior
2013-09-11 0:09 ` [PATCH 7/7] hfp_hf_bluez5: Handle org.bluez.Profile1.Release() Vinicius Costa Gomes
2013-09-12 18:21 ` Denis Kenzior
2013-09-12 18:19 ` [PATCH 1/7] handsfree-audio: Add setting SCO air mode Denis Kenzior
2013-09-12 20:09 ` =?unknown-8bit?q?Vin=C3=ADcius?= Costa Gomes
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=1378858186-683-2-git-send-email-vcgomes@gmail.com \
--to=vcgomes@gmail.com \
--cc=ofono@ofono.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