From: Marcel Holtmann <marcel@holtmann.org>
To: Ron Shaffer <rshaffer@codeaurora.org>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 3/3] Bluetooth: Synchronize SCO/eSCO connection requests to ACL state
Date: Mon, 12 Jul 2010 19:07:57 -0300 [thread overview]
Message-ID: <1278972477.6282.10.camel@localhost.localdomain> (raw)
In-Reply-To: <1278968772-29446-1-git-send-email-rshaffer@codeaurora.org>
[-- Attachment #1: Type: text/plain, Size: 824 bytes --]
Hi Ron,
> 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.
I find your patch actually highly complicated. So I tried to capture
your intend the in the attached patch (only compiled test) and it would
be good if you can try that.
So in general it makes no difference which mode we are in. If a mode
change is pending, then we have to delay the SCO setup. And once we are
done we the mode change we just setup the SCO link. So in theory that
should be enough. Not sure if that is true. I could have overlooked
something since I don't really have tested the patch at all ;)
Regards
Marcel
[-- Attachment #2: patch --]
[-- Type: text/x-patch, Size: 1555 bytes --]
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 600372d..f508d2b 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -256,6 +256,7 @@ enum {
HCI_CONN_ENCRYPT_PEND,
HCI_CONN_RSWITCH_PEND,
HCI_CONN_MODE_CHANGE_PEND,
+ HCI_CONN_SCO_SETUP_PEND,
};
static inline void hci_conn_hash_init(struct hci_dev *hdev)
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index e9fef83..38c86f6 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -385,6 +385,12 @@ struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8
acl->power_save = 1;
hci_conn_enter_active_mode(acl);
+ if (test_bit(HCI_CONN_MODE_CHANGE_PEND, &acl->pend)) {
+ /* defer SCO setup until mode change completed */
+ set_bit(HCI_CONN_SCO_SETUP_PEND, &acl->pend);
+ return sco;
+ }
+
if (lmp_esco_capable(hdev))
hci_setup_sync(sco, acl->handle);
else
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index a969800..3500fe8 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -1481,6 +1481,15 @@ static inline void hci_mode_change_evt(struct hci_dev *hdev, struct sk_buff *skb
else
conn->power_save = 0;
}
+
+ if (test_and_clear_bit(HCI_CONN_SCO_SETUP_PEND, &conn->pend)) {
+ struct hci_conn *sco = conn->link;
+
+ if (lmp_esco_capable(hdev))
+ hci_setup_sync(sco, conn->handle);
+ else
+ hci_add_sco(sco, conn->handle);
+ }
}
hci_dev_unlock(hdev);
next prev parent reply other threads:[~2010-07-12 22:07 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-28 15:53 [PATCH v3 0/3] Don't send SCO/eSCO request during a mode change from sniff to active Ron Shaffer
2010-05-28 15:53 ` [PATCH 1/3] Bluetooth: Remove extraneous white space Ron Shaffer
2010-07-08 21:49 ` Marcel Holtmann
2010-05-28 15:53 ` [PATCH 2/3] Bluetooth: Reassigned copyright to Code Aurora Forum Ron Shaffer
2010-07-08 21:49 ` Marcel Holtmann
2010-05-28 15:53 ` [PATCH 3/3] Bluetooth: Synchronize SCO/eSCO connection requests to ACL state Ron Shaffer
2010-07-08 21:49 ` Marcel Holtmann
2010-07-12 21:06 ` Ron Shaffer
2010-07-12 22:07 ` Marcel Holtmann [this message]
2010-07-14 19:20 ` Perelet, Oleg
2010-07-14 19:30 ` Marcel Holtmann
2010-07-14 20:55 ` Matthew Wilson
2010-07-14 20:59 ` Matt Wilson
2010-07-15 3:07 ` Perelet, Oleg
2010-07-15 6:16 ` Marcel Holtmann
2010-07-15 17:23 ` Perelet, Oleg
2010-07-15 6:13 ` Marcel Holtmann
2010-07-19 22:07 ` Matt Wilson
2010-07-15 21:38 ` Ron Shaffer
2010-07-16 16:32 ` Marcel Holtmann
2010-06-03 20:00 ` [PATCH v3 0/3] Don't send SCO/eSCO request during a mode change from sniff to active Ron Shaffer
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=1278972477.6282.10.camel@localhost.localdomain \
--to=marcel@holtmann.org \
--cc=linux-bluetooth@vger.kernel.org \
--cc=rshaffer@codeaurora.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).