linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ron Shaffer <rshaffer@codeaurora.org>
To: "Gustavo F. Padovan" <gustavo@padovan.org>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 1/1] Bluetooth: Synchronize SCO/eSCO connection requests to ACL state
Date: Tue, 25 May 2010 12:00:24 -0500	[thread overview]
Message-ID: <4BFC0228.8050206@codeaurora.org> (raw)
In-Reply-To: <20100524215202.GA28028@vigoh>

trimmed.

> Hi Ron,
> 
> * Ron Shaffer <rshaffer@codeaurora.org> [2010-05-24 16:11:01 -0500]:
> 
>>
>> Certain headsets such as the Motorola H350 will reject SCO and eSCO
>> connection requests while the ACL is transitioning from sniff mode
>> to active mode. Add synchronization so that SCO and eSCO connection
>> requests will wait until the ACL has fully transitioned to active mode.
>>
>> Signed-off-by: Ron Shaffer <rshaffer@codeaurora.org>

> @@ -117,9 +117,18 @@ void hci_add_sco(struct hci_conn *conn, __u16 handle)
> >  {
> >  	struct hci_dev *hdev = conn->hdev;
> >  	struct hci_cp_add_sco cp;
> > +	struct hci_conn *acl = conn->link;
> >  
> >  	BT_DBG("%p", conn);
> >  
> > +	if (acl->mode == HCI_CM_SNIFF &&
> > +		test_bit(HCI_CONN_MODE_CHANGE_PEND, &acl->pend)) {
> Wrong indentation here. Add a extra tab for test_bit.

> > +		set_bit(HCI_CONN_SCO_PEND, &conn->pend);
> > +		return;
> > +	}
> > +
> > +	clear_bit(HCI_CONN_SCO_PEND, &conn->pend);

> 
> 
> You already clear the bit on hci_mode_change_evt with
> test_and_clear_bit. No need to clear it again here.
> The same happens for hci_setup_sync().
> 

Clearing the bit and clearing it in hci_change_mode_evt are independent
actions for two different scenarios.

Scenario 1:
A SCO/eSCO connection is requested and the ACL is in active mode. 

Scenario 2:
A SCO/eSCO connection is requested and the ACL is transitioning modes.

For scenario 1, I cleared the bit here because I did not want to assume
the bit had been initialized. If it's set, then any future changes to 
the ACL mode (sniff, active) requested by the local side would result
in a request for a SCO or eSCO connection when one already exists.

For scenario 2, the first conditional is TRUE, and the bit gets set.
Later when the mode change event is received, the bit is cleared and
the SCO/eSCO connection is requested.

-- 
Ron Shaffer
Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum

  reply	other threads:[~2010-05-25 17:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-24 21:11 [PATCH 1/1] Bluetooth: Synchronize SCO/eSCO connection requests to ACL state Ron Shaffer
2010-05-24 21:52 ` Gustavo F. Padovan
2010-05-25 17:00   ` Ron Shaffer [this message]
2010-05-25 20:09     ` Gustavo F. Padovan
2010-05-26  8:59 ` Marcel Holtmann
2010-05-26 14:30   ` Ron Shaffer
2010-05-26 15:31     ` Marcel Holtmann
2010-05-26 21:56       ` Ron Shaffer
2010-05-27  3:38         ` Perelet, Oleg
2010-05-27 10:34           ` Marcel Holtmann

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=4BFC0228.8050206@codeaurora.org \
    --to=rshaffer@codeaurora.org \
    --cc=gustavo@padovan.org \
    --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).