All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ v6 01/11] core: Control connections based on adapter state
@ 2012-09-11 13:32 João Paulo Rechi Vita
  2012-09-11 13:32 ` [PATCH BlueZ v6 02/11] core: Use adapter connect list for LE connections João Paulo Rechi Vita
                   ` (9 more replies)
  0 siblings, 10 replies; 13+ messages in thread
From: João Paulo Rechi Vita @ 2012-09-11 13:32 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

From: Claudio Takahasi <claudio.takahasi@openbossa.org>

This patch disable automatic ATTIO connections when the adapter is
powered down and enable automatic connection when the adapter is powered
on.
---
 src/adapter.c | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index 4b675e8..6b8435e 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2113,6 +2113,14 @@ static int get_pairable_timeout(const char *src)
 	return main_opts.pairto;
 }
 
+static void set_auto_connect(gpointer data, gpointer user_data)
+{
+	struct btd_device *device = data;
+	gboolean *enable = user_data;
+
+	device_set_auto_connect(device, *enable);
+}
+
 static void call_adapter_powered_callbacks(struct btd_adapter *adapter,
 						gboolean powered)
 {
@@ -2122,7 +2130,9 @@ static void call_adapter_powered_callbacks(struct btd_adapter *adapter,
 		btd_adapter_powered_cb cb = l->data;
 
 		cb(adapter, powered);
-       }
+	}
+
+	g_slist_foreach(adapter->devices, set_auto_connect, &powered);
 }
 
 static void emit_device_disappeared(gpointer data, gpointer user_data)
@@ -3401,15 +3411,10 @@ static gboolean disable_auto(gpointer user_data)
 	return FALSE;
 }
 
-static void set_auto_connect(gpointer data, gpointer user_data)
-{
-	struct btd_device *device = data;
-
-	device_set_auto_connect(device, TRUE);
-}
-
 void btd_adapter_enable_auto_connect(struct btd_adapter *adapter)
 {
+	gboolean enable = TRUE;
+
 	if (!adapter->up)
 		return;
 
@@ -3418,7 +3423,7 @@ void btd_adapter_enable_auto_connect(struct btd_adapter *adapter)
 	if (adapter->auto_timeout_id)
 		return;
 
-	g_slist_foreach(adapter->devices, set_auto_connect, NULL);
+	g_slist_foreach(adapter->devices, set_auto_connect, &enable);
 
 	adapter->auto_timeout_id = g_timeout_add_seconds(main_opts.autoto,
 						disable_auto, adapter);
-- 
1.7.11.4


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2012-09-25 17:37 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-11 13:32 [PATCH BlueZ v6 01/11] core: Control connections based on adapter state João Paulo Rechi Vita
2012-09-11 13:32 ` [PATCH BlueZ v6 02/11] core: Use adapter connect list for LE connections João Paulo Rechi Vita
2012-09-11 13:32 ` [PATCH BlueZ v6 03/11] core: Mutually exclude concurrent connections João Paulo Rechi Vita
2012-09-20 11:43   ` Johan Hedberg
2012-09-25 17:37     ` Joao Paulo Rechi Vita
2012-09-11 13:33 ` [PATCH BlueZ v6 04/11] mgmt: Add LE scanning callback João Paulo Rechi Vita
2012-09-11 13:33 ` [PATCH BlueZ v6 05/11] core: Replace interleaved by LE scanning João Paulo Rechi Vita
2012-09-11 13:33 ` [PATCH BlueZ v6 06/11] core: Start LE scanning when a device requests João Paulo Rechi Vita
2012-09-11 13:33 ` [PATCH BlueZ v6 07/11] core: Queue discovery if scanning is active João Paulo Rechi Vita
2012-09-11 13:33 ` [PATCH BlueZ v6 08/11] core: Disable unnecessary auto connections João Paulo Rechi Vita
2012-09-11 13:33 ` [PATCH BlueZ v6 09/11] core: Re-connect for ECONNRESET or ECONNABORTED João Paulo Rechi Vita
2012-09-11 13:33 ` [PATCH BlueZ v6 10/11] mgmt: Add address type to bonding debug message João Paulo Rechi Vita
2012-09-11 13:33 ` [PATCH BlueZ v6 11/11] core: Suspend scanning before connect on pairing João Paulo Rechi Vita

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.