From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ] core/device: Fix not connecting services properly
Date: Fri, 12 Aug 2016 11:26:29 +0300 [thread overview]
Message-ID: <1470990389-9434-1-git-send-email-luiz.dentz@gmail.com> (raw)
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Device.Connect shall check if the service discovery is pending or no
service have been connected yet before switching to LE otherwise these
services may never be connected.
---
src/device.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/device.c b/src/device.c
index 6c6be92..c103bb2 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1779,9 +1779,18 @@ static DBusMessage *dev_connect(DBusConnection *conn, DBusMessage *msg,
struct btd_device *dev = user_data;
uint8_t bdaddr_type;
- if (dev->bredr_state.connected)
- bdaddr_type = dev->bdaddr_type;
- else if (dev->le_state.connected && dev->bredr)
+ if (dev->bredr_state.connected) {
+ /*
+ * Check if services have been resolved and there is at list
+ * one connected before switching to connect LE.
+ */
+ if (dev->bredr_state.svc_resolved &&
+ find_service_with_state(dev->services,
+ BTD_SERVICE_STATE_CONNECTED))
+ bdaddr_type = dev->bdaddr_type;
+ else
+ bdaddr_type = BDADDR_BREDR;
+ } else if (dev->le_state.connected && dev->bredr)
bdaddr_type = BDADDR_BREDR;
else
bdaddr_type = select_conn_bearer(dev);
--
2.7.4
next reply other threads:[~2016-08-12 8:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-12 8:26 Luiz Augusto von Dentz [this message]
2016-08-15 10:13 ` [PATCH BlueZ] core/device: Fix not connecting services properly Luiz Augusto von Dentz
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=1470990389-9434-1-git-send-email-luiz.dentz@gmail.com \
--to=luiz.dentz@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).