From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH v2 7/7] handsfree-audio: Enable wideband speech if defer is enabled
Date: Fri, 12 Apr 2013 18:16:35 -0500 [thread overview]
Message-ID: <516895D3.2080103@gmail.com> (raw)
In-Reply-To: <1365622677-4824-7-git-send-email-vinicius.gomes@openbossa.org>
[-- Attachment #1: Type: text/plain, Size: 1997 bytes --]
Hi Vinicius,
On 04/10/2013 02:37 PM, Vinicius Costa Gomes wrote:
> From: Claudio Takahasi<claudio.takahasi@openbossa.org>
>
> Only enable support for wideband speech codecs, at this point mSBC, if
> the kernel supports defer setup.
> ---
> src/handsfree-audio.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/src/handsfree-audio.c b/src/handsfree-audio.c
> index a332f68..da8e100 100644
> --- a/src/handsfree-audio.c
> +++ b/src/handsfree-audio.c
> @@ -66,6 +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 void send_new_connection(const char *card, int fd, uint8_t codec)
> {
> @@ -159,7 +160,7 @@ static int sco_init(void)
> {
> GIOChannel *sco_io;
> struct sockaddr_sco saddr;
> - int sk, defer_setup = 1;
> + int sk;
>
> sk = socket(PF_BLUETOOTH, SOCK_SEQPACKET | O_NONBLOCK | SOCK_CLOEXEC,
> BTPROTO_SCO);
> @@ -177,9 +178,11 @@ static int sco_init(void)
> }
>
> if (setsockopt(sk, SOL_BLUETOOTH, BT_DEFER_SETUP,
> - &defer_setup, sizeof(defer_setup))< 0)
> + &defer_setup, sizeof(defer_setup))< 0) {
> + defer_setup = 0;
> ofono_warn("Can't enable deferred setup: %s (%d)",
> strerror(errno), errno);
> + }
>
> if (listen(sk, 5)< 0) {
> close(sk);
> @@ -656,6 +659,9 @@ static DBusMessage *am_agent_register(DBusConnection *conn,
> has_cvsd = TRUE;
> else if (codecs[i] != HFP_CODEC_MSBC)
> return __ofono_error_invalid_args(msg);
> +
> + if (defer_setup)
> + has_wideband = TRUE;
This patch seems to have unintended side-effects and is in general hard
to read.
How about something like:
if (has_wideband && !defer_setup)
has_wideband = FALSE;
outside of the for loop. Other ideas welcome as well.
> }
>
> if (has_cvsd == FALSE) {
Regards,
-Denis
next prev parent reply other threads:[~2013-04-12 23:16 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-10 19:37 [PATCH v2 1/7] hfpmodem: Watch for changes in the selected codec Vinicius Costa Gomes
2013-04-10 19:37 ` [PATCH v2 2/7] include: ofono_handsfree_card_select_codec() Vinicius Costa Gomes
2013-04-12 23:12 ` Denis Kenzior
2013-04-13 23:34 ` Vinicius Costa Gomes
2013-04-10 19:37 ` [PATCH v2 3/7] handsfree-audio: Implement ofono_handsfree_card_select_codec() Vinicius Costa Gomes
2013-04-10 19:37 ` [PATCH v2 4/7] hfp_hf_bluez5: Set the audio codec in the card Vinicius Costa Gomes
2013-04-10 19:37 ` [PATCH v2 5/7] handsfree-audio: Send the selected codec Vinicius Costa Gomes
2013-04-10 19:37 ` [PATCH v2 6/7] handsfree-audio: Set CVSD as default in the card Vinicius Costa Gomes
2013-04-12 23:14 ` Denis Kenzior
2013-04-10 19:37 ` [PATCH v2 7/7] handsfree-audio: Enable wideband speech if defer is enabled Vinicius Costa Gomes
2013-04-12 23:16 ` Denis Kenzior [this message]
2013-04-12 23:07 ` [PATCH v2 1/7] hfpmodem: Watch for changes in the selected codec Denis Kenzior
2013-04-12 23:20 ` Vinicius 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=516895D3.2080103@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