Open Source Telephony
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH 3/6] handsfree-audio: Add support for detecting Transparent SCO support
Date: Mon, 19 Aug 2013 12:55:00 -0500	[thread overview]
Message-ID: <52125BF4.8000200@gmail.com> (raw)
In-Reply-To: <1376619969-15080-4-git-send-email-vcgomes@gmail.com>

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

Hi Vinicius,

On 08/15/2013 09:26 PM, Vinicius Costa Gomes wrote:
> ---
>   include/handsfree-audio.h |  2 +-
>   plugins/hfp_hf_bluez5.c   |  2 +-
>   src/handsfree-audio.c     | 23 +++++++++++++++++------
>   3 files changed, 19 insertions(+), 8 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;

This seems fine, however we should probably not be enabling the plugin 
if defer_setup is missing.

>
>   	DBG("Registering External Profile handler ...");
> diff --git a/src/handsfree-audio.c b/src/handsfree-audio.c
> index 0caa458..c83086f 100644
> --- a/src/handsfree-audio.c
> +++ b/src/handsfree-audio.c
> @@ -66,7 +66,7 @@ static GSList *card_list = 0;
>   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)
>   {
> @@ -178,7 +178,9 @@ static int sco_init(void)
>   {
>   	GIOChannel *sco_io;
>   	struct sockaddr_sco saddr;
> -	int sk;
> +	struct bt_voice voice;
> +	int defer_setup, sk;
> +	socklen_t len;
>
>   	sk = socket(PF_BLUETOOTH, SOCK_SEQPACKET | O_NONBLOCK | SOCK_CLOEXEC,
>   								BTPROTO_SCO);
> @@ -195,6 +197,8 @@ static int sco_init(void)
>   		return -errno;
>   	}
>
> +	defer_setup = 1;
> +
>   	if (setsockopt(sk, SOL_BLUETOOTH, BT_DEFER_SETUP,
>   				&defer_setup, sizeof(defer_setup)) < 0) {
>   		defer_setup = 0;
> @@ -202,6 +206,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;
> @@ -585,9 +596,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)
> @@ -707,12 +718,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) {
>

Regards,
-Denis

  reply	other threads:[~2013-08-19 17:55 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-16  2:26 [PATCH 0/6] hfp_hf_bluez5: Add support for Transparent SCO Vinicius Costa Gomes
2013-08-16  2:26 ` [PATCH 1/6] bluetooth: Add define for SCO voice settings Vinicius Costa Gomes
2013-08-19 17:59   ` Denis Kenzior
2013-08-16  2:26 ` [PATCH 2/6] handsfree-audio: Add setting SCO air mode Vinicius Costa Gomes
2013-08-19 17:49   ` Denis Kenzior
2013-08-19 18:42     ` Vinicius Costa Gomes
2013-08-16  2:26 ` [PATCH 3/6] handsfree-audio: Add support for detecting Transparent SCO support Vinicius Costa Gomes
2013-08-19 17:55   ` Denis Kenzior [this message]
2013-08-19 19:36     ` Vinicius Costa Gomes
2013-08-16  2:26 ` [PATCH 4/6] handsfree-audio: Set the voice setting for outgoing connections Vinicius Costa Gomes
2013-08-19 17:56   ` Denis Kenzior
2013-08-16  2:26 ` [PATCH 5/6] hfp_hf_bluez5: Handle org.bluez.Profile1.Cancel() Vinicius Costa Gomes
2013-08-16  2:26 ` [PATCH 6/6] hfp_hf_bluez5: Handle org.bluez.Profile1.Release() Vinicius Costa Gomes
2013-08-19 17:57   ` Denis Kenzior
2013-08-19 18:47     ` Vinicius Costa Gomes
2013-08-20 13:51       ` Luiz Augusto von Dentz
2013-08-20 15:41         ` Denis Kenzior
2013-08-21 10:29           ` Luiz Augusto von Dentz
2013-08-21 15:21             ` Denis Kenzior
2013-08-22 14:41               ` Luiz Augusto von Dentz

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=52125BF4.8000200@gmail.com \
    --to=denkenz@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