[PATCH 1/2] device: don't auto-connect on disc-cb attio callback registration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If a device is already connected, don't auto-connect if we register
a disconnect-only attio callback. This will obviously fail.
---
 src/device.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/device.c b/src/device.c
index dfc8e59..b339ac1 100644
--- a/src/device.c
+++ b/src/device.c
@@ -2942,10 +2942,15 @@ guint btd_device_add_attio_callback(struct btd_device *device,
 	attio->dcfunc = dcfunc;
 	attio->user_data = user_data;
 
-	if (device->attrib && cfunc) {
-		device->attios_offline = g_slist_append(device->attios_offline,
-									attio);
-		g_idle_add(notify_attios, device);
+	if (device->attrib) {
+		if (cfunc) {
+			device->attios_offline =
+				g_slist_append(device->attios_offline, attio);
+
+			g_idle_add(notify_attios, device);
+		} else {
+			device->attios = g_slist_append(device->attios, attio);
+		}
 	} else {
 		device->auto_id = g_idle_add_full(G_PRIORITY_DEFAULT_IDLE,
 						att_connect, device,
-- 
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux