linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel Örstadius" <daniel.orstadius@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: Race between SCO disconnection and AVDTP Start
Date: Fri, 28 May 2010 12:58:21 +0300	[thread overview]
Message-ID: <AANLkTikmq2PK9jA_nl9eWto8Ihfn_4PHoeWwhRLIwo1C@mail.gmail.com> (raw)

Hi,

If the audio client closes the SCO connection (by disconnecting the
unix socket to bluetoothd) and then immediately tries to open an A2DP
connection, the kernel might not send the SCO disconnect and AVDTP
Start to the remote in the sequence they were requested by bluetoothd.

Is there a way to preserve the order, so that SCO disc is consistently
sent before AVDTP Start? (some headsets behave better in this case)

Have tried with the sockopt SO_LINGER on the SCO socket, but it didn't
seem to make any difference [1].

/Daniel

[1] Not sure what LINGER really does here. Looking at the code in
sco_sock_shutdown(), it waits for the BT_CLOSED state:

__sco_sock_close(sk);

if (sock_flag(sk, SOCK_LINGER) && sk->sk_lingertime)
        err = bt_sock_wait_state(sk, BT_CLOSED, sk->sk_lingertime);


However the socket state is set to BT_CLOSED in sco_chan_del() which
is called from __sco_sock_close(), so it looks like it's waiting for a
state that's already set (or maybe I'm just missing something here?).

             reply	other threads:[~2010-05-28  9:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-28  9:58 Daniel Örstadius [this message]
2010-05-30 10:44 ` Race between SCO disconnection and AVDTP Start Marcel Holtmann
2010-05-31  8:33   ` Daniel Örstadius

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=AANLkTikmq2PK9jA_nl9eWto8Ihfn_4PHoeWwhRLIwo1C@mail.gmail.com \
    --to=daniel.orstadius@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).