* [PATCH BlueZ 1/3] core/device: Fix marking auto-connect flag
@ 2016-08-23 10:17 Luiz Augusto von Dentz
2016-08-23 10:17 ` [PATCH BlueZ 2/3] core/device: Prefer bonded bearers when connecting Luiz Augusto von Dentz
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2016-08-23 10:17 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Device auto-connect shall be set only if the profile is able to accept
incoming connections, this fixes the wrong behavior or connecting LE
with dual mode devices immediatelly after probing service as profiles
may have auto-connect flag for outgoing connection (usually BR/EDR only).
---
src/device.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/device.c b/src/device.c
index c103bb2..14de7e8 100644
--- a/src/device.c
+++ b/src/device.c
@@ -4080,7 +4080,10 @@ static struct btd_service *probe_service(struct btd_device *device,
return NULL;
}
- if (profile->auto_connect)
+ /* Only set auto connect if profile has set the flag and can really
+ * accept connections.
+ */
+ if (profile->auto_connect && profile->accept)
device_set_auto_connect(device, TRUE);
return service;
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH BlueZ 2/3] core/device: Prefer bonded bearers when connecting
2016-08-23 10:17 [PATCH BlueZ 1/3] core/device: Fix marking auto-connect flag Luiz Augusto von Dentz
@ 2016-08-23 10:17 ` Luiz Augusto von Dentz
2016-08-23 10:17 ` [PATCH BlueZ 3/3] doc/device-api: Document Connect behavior for dual-mode Luiz Augusto von Dentz
2016-08-25 12:59 ` [PATCH BlueZ 1/3] core/device: Fix marking auto-connect flag Luiz Augusto von Dentz
2 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2016-08-23 10:17 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
When attempting to connect a dual-mode device prefer bonded bearer if
only one has been marked as bonded. This prevents connecting to a
different bearer after pairing is complete and cross transport pairing
is not supported.
---
src/device.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/device.c b/src/device.c
index 14de7e8..fb766d1 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1742,6 +1742,12 @@ static uint8_t select_conn_bearer(struct btd_device *dev)
time_t bredr_last = NVAL_TIME, le_last = NVAL_TIME;
time_t current = time(NULL);
+ /* Prefer bonded bearer in case only one is bonded */
+ if (dev->bredr_state.bonded && !dev->le_state.bonded )
+ return BDADDR_BREDR;
+ else if (!dev->bredr_state.bonded && dev->le_state.bonded)
+ return dev->bdaddr_type;
+
if (dev->bredr_seen) {
bredr_last = current - dev->bredr_seen;
if (bredr_last > SEEN_TRESHHOLD)
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH BlueZ 3/3] doc/device-api: Document Connect behavior for dual-mode
2016-08-23 10:17 [PATCH BlueZ 1/3] core/device: Fix marking auto-connect flag Luiz Augusto von Dentz
2016-08-23 10:17 ` [PATCH BlueZ 2/3] core/device: Prefer bonded bearers when connecting Luiz Augusto von Dentz
@ 2016-08-23 10:17 ` Luiz Augusto von Dentz
2016-08-25 12:59 ` [PATCH BlueZ 1/3] core/device: Fix marking auto-connect flag Luiz Augusto von Dentz
2 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2016-08-23 10:17 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Adds description of how Device1.Connect behave with dual-mode devices.
---
doc/device-api.txt | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/doc/device-api.txt b/doc/device-api.txt
index 087efb9..3938539 100644
--- a/doc/device-api.txt
+++ b/doc/device-api.txt
@@ -21,6 +21,20 @@ Methods void Connect()
If at least one profile was connected successfully this
method will indicate success.
+ For dual-mode devices only one bearer is connected at
+ time, the conditions are in the following order:
+
+ 1. Connect the disconnected bearer if already
+ connected.
+
+ 2. Connect first the bonded bearer. If no
+ bearers are bonded or both both skip and check
+ latest seen bearer.
+
+ 3. Connect last seen bearer, in case the
+ timestamps are the same BR/EDR takes
+ precedence.
+
Possible errors: org.bluez.Error.NotReady
org.bluez.Error.Failed
org.bluez.Error.InProgress
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH BlueZ 1/3] core/device: Fix marking auto-connect flag
2016-08-23 10:17 [PATCH BlueZ 1/3] core/device: Fix marking auto-connect flag Luiz Augusto von Dentz
2016-08-23 10:17 ` [PATCH BlueZ 2/3] core/device: Prefer bonded bearers when connecting Luiz Augusto von Dentz
2016-08-23 10:17 ` [PATCH BlueZ 3/3] doc/device-api: Document Connect behavior for dual-mode Luiz Augusto von Dentz
@ 2016-08-25 12:59 ` Luiz Augusto von Dentz
2 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2016-08-25 12:59 UTC (permalink / raw)
To: linux-bluetooth@vger.kernel.org
Hi,
On Tue, Aug 23, 2016 at 1:17 PM, Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> Device auto-connect shall be set only if the profile is able to accept
> incoming connections, this fixes the wrong behavior or connecting LE
> with dual mode devices immediatelly after probing service as profiles
> may have auto-connect flag for outgoing connection (usually BR/EDR only).
> ---
> src/device.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/src/device.c b/src/device.c
> index c103bb2..14de7e8 100644
> --- a/src/device.c
> +++ b/src/device.c
> @@ -4080,7 +4080,10 @@ static struct btd_service *probe_service(struct btd_device *device,
> return NULL;
> }
>
> - if (profile->auto_connect)
> + /* Only set auto connect if profile has set the flag and can really
> + * accept connections.
> + */
> + if (profile->auto_connect && profile->accept)
> device_set_auto_connect(device, TRUE);
>
> return service;
> --
> 2.7.4
Applied.
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-08-25 12:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-23 10:17 [PATCH BlueZ 1/3] core/device: Fix marking auto-connect flag Luiz Augusto von Dentz
2016-08-23 10:17 ` [PATCH BlueZ 2/3] core/device: Prefer bonded bearers when connecting Luiz Augusto von Dentz
2016-08-23 10:17 ` [PATCH BlueZ 3/3] doc/device-api: Document Connect behavior for dual-mode Luiz Augusto von Dentz
2016-08-25 12:59 ` [PATCH BlueZ 1/3] core/device: Fix marking auto-connect flag Luiz Augusto von Dentz
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).