Skip to contentSkip to conversation

doc/device-api: Document behavior of Disconnect method with LE

PATCH Applied Luiz Augusto von Dentz 2 participants 4 messages Nov 20, 2017 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/2 doc/device-api: Document behavior of Disconnect method with LE

From: Luiz Augusto von Dentz <[email protected]>

If and LE device is disconnected using device.Device method it won't be able to reconnect by itself.

---
 doc/device-api.txt | 4 ++++
 1 file changed, 4 insertions(+)
doc/device-api.txt +4 -0
index 13b28818e..ac5604f9c 100644
@@ -52,6 +52,10 @@ Methods		void Connect()
 			This method can be also used to cancel a preceding
 			Connect call before a reply to it has been received.
 
+			When connected over LE bearer calling this method will
+			prevent incoming connections until Connect method is
+			called again.
+
 			Possible errors: org.bluez.Error.NotConnected
 
 		void ConnectProfile(string uuid)
Signature · 1 line
2.13.6
author maintainer
#1 lore raw

PATCH 2/2 device: Don't disable auto-connect for trusted devices

From: Luiz Augusto von Dentz <[email protected]>

Trusted shall indicate if the device is allowed connect in any circumstance, even if the user has called device.Disconnect.

---
 doc/device-api.txt | 6 +++---
 src/device.c       | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)
doc/device-api.txt +3 -3
index ac5604f9c..8b69c2ef3 100644
@@ -52,9 +52,9 @@ Methods		void Connect()
 			This method can be also used to cancel a preceding
 			Connect call before a reply to it has been received.
 
-			When connected over LE bearer calling this method will
-			prevent incoming connections until Connect method is
-			called again.
+			For non-trusted devices connected over LE bearer calling
+			this method will disable incoming connections until
+			Connect method is called again.
 
 			Possible errors: org.bluez.Error.NotConnected
 
src/device.c +3 -3
index e8118112e..a753d2140 100644
@@ -1483,10 +1483,10 @@ static DBusMessage *dev_disconnect(DBusConnection *conn, DBusMessage *msg,
 	struct btd_device *device = user_data;
 
 	/*
-	 * Disable connections through passive scanning until
-	 * Device1.Connect is called
+	 * If device is not trusted disable connections through passive
+	 * scanning until Device1.Connect is called
 	 */
-	if (device->auto_connect) {
+	if (device->auto_connect && !device->trusted) {
 		device->disable_auto_connect = TRUE;
 		device_set_auto_connect(device, FALSE);
 	}
Signature · 1 line
2.13.6
#2 lore raw

Re: [PATCH BlueZ 2/2] device: Don't disable auto-connect for trusted devices

Quoted 4 lines · Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

Trusted shall indicate if the device is allowed connect in any circumstance, even if the user has called device.Disconnect.

This fixes my Bluetooth LE mouse not being able to reconnect to the computer at all after it was disconnected through a toggle switch, requiring removing the pairing on the computer, and pairing it again.

But as the device is still able to disconnect, and the mouse just considers the disconnect a transient transport problem, it will reconnect straight away.

I might make some changes to the UI to make it clearer that we did manage to disconnect, and that the device reconnected, otherwise it looks like the switch didn't work.

So, +1 from me!

author maintainer Applied
#3 lore raw
In reply to Luiz Augusto von Dentz

Hi,

Quoted 24 lines · Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

If and LE device is disconnected using device.Device method it won't be able to reconnect by itself.

---
 doc/device-api.txt | 4 ++++
 1 file changed, 4 insertions(+)
doc/device-api.txt +4 -1
index 13b28818e..ac5604f9c 100644
@@ -52,6 +52,10 @@ Methods              void Connect()
                        This method can be also used to cancel a preceding
                        Connect call before a reply to it has been received.
 
+                       When connected over LE bearer calling this method will
+                       prevent incoming connections until Connect method is
+                       called again.
+
                        Possible errors: org.bluez.Error.NotConnected
 
                void ConnectProfile(string uuid)
--
Quoted 1 line

2.13.6

Applied.

Signature · 1 line
Luiz Augusto von Dentz