Skip to contentSkip to conversation

device: Fix device_is_connected checking for services being connected

PATCH Applied Luiz Augusto von Dentz 2 participants 2 messages Mar 18, 2024 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/1 device: Fix device_is_connected checking for services being connected

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

Change 44d3f67277f83983e1e9697eda7b9aeb40ca231d since to have introduced quite a few bugs related to device_is_connected return true which prevents proper cleanup of connection.

---
 src/device.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)
src/device.c +12 -10
index aecceb100..b5b574233 100644
@@ -3324,22 +3324,24 @@ void device_add_connection(struct btd_device *dev, uint8_t bdaddr_type,
 								"Connected");
 }
 
+static bool device_service_connected(struct btd_device *dev)
+{
+	if (find_service_with_state(dev->services,
+					BTD_SERVICE_STATE_CONNECTING))
+		return true;
+
+	return find_service_with_state(dev->services,
+					BTD_SERVICE_STATE_CONNECTED);
+}
+
 static bool device_disappeared(gpointer user_data)
 {
 	struct btd_device *dev = user_data;
 
-	if (btd_device_is_connected(dev)) {
-		char addr[18];
-		ba2str(&dev->bdaddr, addr);
-		DBG("Device %s is marked as connected", dev->path);
-		return TRUE;
-	}
-
-	/* If there are services connecting restart the timer to give more time
+	/* If there are services connected restart the timer to give more time
 	 * for the service to either complete the connection or disconnect.
 	 */
-	if (find_service_with_state(dev->services,
-					BTD_SERVICE_STATE_CONNECTING))
+	if (device_service_connected(dev))
 		return TRUE;
 
 	dev->temporary_timer = 0;
Signature · 1 line
2.44.0
#1 lore raw
This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 6 lines · On Mon, 18 Mar 2024 16:08:31 +0000 you wrote:

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

Change 44d3f67277f83983e1e9697eda7b9aeb40ca231d since to have introduced quite a few bugs related to device_is_connected return true which prevents proper cleanup of connection.

Quoted 6 lines

[...]

Here is the summary with links:
- [BlueZ,v1] device: Fix device_is_connected checking for services being connected

    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=8060d1208673

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html