linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: Andrei Emeltchenko <andrei.emeltchenko.news@gmail.com>,
	Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
	"linux-bluetooth@vger.kernel.org"
	<linux-bluetooth@vger.kernel.org>
Subject: Re: [PATCH BlueZ] android/handsfree: Fix Connect SCO command
Date: Wed, 14 May 2014 12:55:34 +0300	[thread overview]
Message-ID: <CABBYNZLA89ybWJWjBS36AJ1HMuYJzVozU3TZ2ZeZ_=VEeHPuDQ@mail.gmail.com> (raw)
In-Reply-To: <20140514082120.GC27218@aemeltch-MOBL1>

Hi,

On Wed, May 14, 2014 at 11:21 AM, Andrei Emeltchenko
<andrei.emeltchenko.news@gmail.com> wrote:
> Hi Luiz,
>
> On Tue, May 13, 2014 at 08:22:49PM +0300, Luiz Augusto von Dentz wrote:
>> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>>
>> This command should not trigger SCO connection since there is already a
>> command Connect Audio dedicated to do that.
>
> Do you handle incoming connections?
>
> Best regards
> Andrei Emeltchenko
>
>> ---
>>  android/handsfree.c | 53 ++++++++++++++++++++++++-----------------------------
>>  1 file changed, 24 insertions(+), 29 deletions(-)
>>
>> diff --git a/android/handsfree.c b/android/handsfree.c
>> index cb5e657..7ca0ba8 100644
>> --- a/android/handsfree.c
>> +++ b/android/handsfree.c
>> @@ -861,30 +861,6 @@ done:
>>       hfp_gw_send_info(device.gw, "+BCS: %u", type);
>>  }
>>
>> -static void send_sco_fd(GIOChannel *chan)
>> -{
>> -     if (sco_ipc) {
>> -             int fd = g_io_channel_unix_get_fd(chan);
>> -             GError *err = NULL;
>> -             uint16_t mtu = 48;
>> -             struct sco_rsp_connect rsp;
>> -
>> -             if (!bt_io_get(chan, &err, BT_IO_OPT_MTU, &mtu,
>> -                                                     BT_IO_OPT_INVALID)) {
>> -                     error("Unable to get MTU: %s\n", err->message);
>> -                     g_clear_error(&err);
>> -             }
>> -
>> -             DBG("fd %d mtu %u", fd, mtu);
>> -
>> -             rsp.mtu = mtu;
>> -
>> -             ipc_send_rsp_full(sco_ipc, SCO_SERVICE_ID,
>> -                                     SCO_OP_CONNECT, sizeof(rsp), &rsp,
>> -                                     fd);
>> -     }
>> -}
>> -
>>  static void connect_sco_cb(GIOChannel *chan, GError *err, gpointer user_data)
>>  {
>>       if (err) {
>> @@ -914,7 +890,6 @@ static void connect_sco_cb(GIOChannel *chan, GError *err, gpointer user_data)
>>                                                       sco_watch_cb, NULL);
>>
>>       device_set_audio_state(HAL_EV_HANDSFREE_AUDIO_STATE_CONNECTED);
>> -     send_sco_fd(chan);
>>  }
>>
>>  static bool connect_sco(void)
>> @@ -2592,14 +2567,34 @@ static void disable_sco_server(void)
>>
>>  static void bt_sco_connect(const void *buf, uint16_t len)
>>  {
>> +     int fd;
>> +     GError *err;
>> +     struct sco_rsp_connect rsp;
>> +
>>       DBG("");
>>
>> -     if (device.sco) {
>> -             send_sco_fd(device.sco);
>> -             return;
>> +     if (!device.sco)
>> +             goto failed;
>> +
>> +     err = NULL;
>> +     if (!bt_io_get(device.sco, &err, BT_IO_OPT_MTU, &rsp.mtu,
>> +                                                     BT_IO_OPT_INVALID)) {
>> +             error("Unable to get MTU: %s\n", err->message);
>> +             g_clear_error(&err);
>> +             goto failed;
>>       }
>>
>> -     connect_audio();
>> +     fd = g_io_channel_unix_get_fd(device.sco);
>> +
>> +     DBG("fd %d mtu %u", fd, rsp.mtu);
>> +
>> +     ipc_send_rsp_full(sco_ipc, SCO_SERVICE_ID, SCO_OP_CONNECT,
>> +                                                     sizeof(rsp), &rsp, fd);
>> +
>> +     return;
>> +
>> +failed:
>> +     ipc_send_rsp(sco_ipc, SCO_SERVICE_ID, SCO_OP_STATUS, SCO_STATUS_FAILED);
>>  }
>>
>>  static const struct ipc_handler sco_handlers[] = {
>> --
>> 1.9.0

Pushed.


-- 
Luiz Augusto von Dentz

      reply	other threads:[~2014-05-14  9:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-13 17:22 [PATCH BlueZ] android/handsfree: Fix Connect SCO command Luiz Augusto von Dentz
2014-05-14  8:21 ` Andrei Emeltchenko
2014-05-14  9:55   ` Luiz Augusto von Dentz [this message]

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='CABBYNZLA89ybWJWjBS36AJ1HMuYJzVozU3TZ2ZeZ_=VEeHPuDQ@mail.gmail.com' \
    --to=luiz.dentz@gmail.com \
    --cc=andrei.emeltchenko.news@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;
as well as URLs for NNTP newsgroup(s).