All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ 00/11] Re-connections triggered by platform event
@ 2011-09-26 17:48 Claudio Takahasi
  2011-09-26 17:48 ` [PATCH BlueZ 01/11] Remove timer to trigger connection attempts Claudio Takahasi
                   ` (12 more replies)
  0 siblings, 13 replies; 25+ messages in thread
From: Claudio Takahasi @ 2011-09-26 17:48 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

Proposal to enable re-connection(for ATT) started by platform/user
actions. eg: Screen unlocked.

Use case: When the user unlocks the screen, automatic re-connections for
bonded devices will start. It will remain active for a short period of
time(default 1 min).

Anderson Briglia (2):
  Add display lock watcher on maemo6 plugin
  Enable re-connection if reason is Timeout

Claudio Takahasi (9):
  Remove timer to trigger connection attempts
  Add set auto connect in device
  Add continuous connection attempt
  Add checking if profiles are requesting connection
  Fix repeated connection attempt to the same remote
  Disable automatic connections after 60 seconds
  Set auto connect from maemo6 plugin
  Add an interval between connection attempts
  Add automatic connect timeout config option

 plugins/maemo6.c |   32 +++++++++++++++
 src/adapter.c    |   40 +++++++++++++++++++
 src/adapter.h    |    1 +
 src/device.c     |  113 ++++++++++++++++++++++++++++++++++++++++--------------
 src/device.h     |    1 +
 src/hcid.h       |    1 +
 src/main.c       |   12 ++++++
 src/main.conf    |    6 +++
 8 files changed, 177 insertions(+), 29 deletions(-)

-- 
1.7.6.1


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

* [PATCH BlueZ 01/11] Remove timer to trigger connection attempts
  2011-09-26 17:48 [PATCH BlueZ 00/11] Re-connections triggered by platform event Claudio Takahasi
@ 2011-09-26 17:48 ` Claudio Takahasi
  2011-10-04 18:30   ` [PATCH Bluez " Claudio Takahasi
  2011-09-26 17:48 ` [PATCH BlueZ 02/11] Add set auto connect in device Claudio Takahasi
                   ` (11 subsequent siblings)
  12 siblings, 1 reply; 25+ messages in thread
From: Claudio Takahasi @ 2011-09-26 17:48 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

Removes continuous timer for ATTIO connection attempts. A new approach
is being implemented managing scanning and connection attempts driven
by platform/user actions. eg: screen unlocked.
---
 src/device.c |   35 +++++------------------------------
 1 files changed, 5 insertions(+), 30 deletions(-)

diff --git a/src/device.c b/src/device.c
index 800deb8..07409af 100644
--- a/src/device.c
+++ b/src/device.c
@@ -65,7 +65,6 @@
 
 #define DISCONNECT_TIMER	2
 #define DISCOVERY_TIMER		2
-#define AUTOCONNECT_INTERVAL	45
 
 /* When all services should trust a remote device */
 #define GLOBAL_TRUST "[all]"
@@ -140,7 +139,6 @@ struct btd_device {
 	GSList		*attios;
 	GSList		*attios_offline;
 	guint		attachid;		/* Attrib server attach */
-	guint		attioid;
 
 	gboolean	connected;
 
@@ -237,9 +235,6 @@ static void device_free(gpointer user_data)
 	if (device->discov_timer)
 		g_source_remove(device->discov_timer);
 
-	if (device->attioid)
-		g_source_remove(device->attioid);
-
 	DBG("%p", device);
 
 	g_free(device->authr);
@@ -1614,19 +1609,12 @@ static void attio_disconnected(gpointer data, gpointer user_data)
 		attio->dcfunc(attio->user_data);
 }
 
-static gboolean att_auto_connect(gpointer user_data);
-
 static void attrib_disconnected(gpointer user_data)
 {
 	struct btd_device *device = user_data;
 
 	g_slist_foreach(device->attios, attio_disconnected, NULL);
 
-	if ((device->attios || device->attios_offline) && device->attioid == 0)
-		device->attioid = g_timeout_add_seconds(AUTOCONNECT_INTERVAL,
-							att_auto_connect,
-							device);
-
 	attrib_channel_detach(device->attachid);
 	g_attrib_unref(device->attrib);
 	device->attrib = NULL;
@@ -1707,11 +1695,6 @@ static void att_connect_cb(GIOChannel *io, GError *gerr, gpointer user_data)
 		return;
 	}
 
-	if (device->attioid) {
-		g_source_remove(device->attioid);
-		device->attioid = 0;
-	}
-
 	attrib = g_attrib_new(io);
 	device->attachid = attrib_channel_attach(attrib, TRUE);
 	if (device->attachid == 0)
@@ -1729,7 +1712,7 @@ static void att_connect_cb(GIOChannel *io, GError *gerr, gpointer user_data)
 	}
 }
 
-static gboolean att_auto_connect(gpointer user_data)
+static gboolean att_connect(gpointer user_data)
 {
 	struct btd_device *device = user_data;
 	struct btd_adapter *adapter = device->adapter;
@@ -1764,12 +1747,12 @@ static gboolean att_auto_connect(gpointer user_data)
 	if (io == NULL) {
 		error("ATT bt_io_connect(%s): %s", addr, gerr->message);
 		g_error_free(gerr);
-		return TRUE;
+		return FALSE;
 	}
 
 	g_io_channel_unref(io);
 
-	return TRUE;
+	return FALSE;
 }
 
 int device_browse_primary(struct btd_device *device, DBusConnection *conn,
@@ -2677,11 +2660,8 @@ guint btd_device_add_attio_callback(struct btd_device *device,
 		device->attios_offline = g_slist_append(device->attios_offline,
 									attio);
 		g_idle_add(notify_attios, device);
-	} else if (device->attioid == 0) {
-		att_auto_connect(device);
-		device->attioid = g_timeout_add_seconds(AUTOCONNECT_INTERVAL,
-							att_auto_connect,
-							device);
+	} else {
+		g_idle_add(att_connect, device);
 		device->attios = g_slist_append(device->attios, attio);
 	}
 
@@ -2722,11 +2702,6 @@ gboolean btd_device_remove_attio_callback(struct btd_device *device, guint id)
 	if (device->attios != NULL || device->attios_offline != NULL)
 		return TRUE;
 
-	if (device->attioid) {
-		g_source_remove(device->attioid);
-		device->attioid = 0;
-	}
-
 	if (device->attachid) {
 		attrib_channel_detach(device->attachid);
 		device->attachid = 0;
-- 
1.7.6.1


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

* [PATCH BlueZ 02/11] Add set auto connect in device
  2011-09-26 17:48 [PATCH BlueZ 00/11] Re-connections triggered by platform event Claudio Takahasi
  2011-09-26 17:48 ` [PATCH BlueZ 01/11] Remove timer to trigger connection attempts Claudio Takahasi
@ 2011-09-26 17:48 ` Claudio Takahasi
  2011-10-04 18:30   ` [PATCH Bluez " Claudio Takahasi
  2011-09-26 17:48 ` [PATCH BlueZ 03/11] Add continuous connection attempt Claudio Takahasi
                   ` (10 subsequent siblings)
  12 siblings, 1 reply; 25+ messages in thread
From: Claudio Takahasi @ 2011-09-26 17:48 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

Skeleton of automatic connections driven by platform/user event.
Two layers will manage connections: Profiles can request on demand
connections registering ATTIO connection callbacks(one attempt) for
a given device and platform/user action can trigger automatic
connections for devices with ATTIO callbacks registered.
---
 src/adapter.c |   17 +++++++++++++++++
 src/adapter.h |    1 +
 src/device.c  |   15 +++++++++++++++
 src/device.h  |    1 +
 4 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index b3622cb..605a9f2 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -3417,6 +3417,23 @@ int btd_adapter_switch_offline(struct btd_adapter *adapter)
 	return 0;
 }
 
+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)
+{
+	if (!adapter->up)
+		return;
+
+	DBG("Enabling automatic connections");
+
+	g_slist_foreach(adapter->devices, set_auto_connect, NULL);
+}
+
 void btd_adapter_register_pin_cb(struct btd_adapter *adapter,
 							btd_adapter_pin_cb_t cb)
 {
diff --git a/src/adapter.h b/src/adapter.h
index 7ef0af0..d30e82a 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -163,6 +163,7 @@ gboolean adapter_powering_down(struct btd_adapter *adapter);
 int btd_adapter_restore_powered(struct btd_adapter *adapter);
 int btd_adapter_switch_online(struct btd_adapter *adapter);
 int btd_adapter_switch_offline(struct btd_adapter *adapter);
+void btd_adapter_enable_auto_connect(struct btd_adapter *adapter);
 
 typedef ssize_t (*btd_adapter_pin_cb_t) (struct btd_adapter *adapter,
 					struct btd_device *dev, char *out);
diff --git a/src/device.c b/src/device.c
index 07409af..410cf4c 100644
--- a/src/device.c
+++ b/src/device.c
@@ -148,6 +148,7 @@ struct btd_device {
 	gboolean	paired;
 	gboolean	blocked;
 	gboolean	bonded;
+	gboolean	auto_connect;
 
 	gboolean	authorizing;
 	gint		ref;
@@ -1919,6 +1920,20 @@ void device_set_bonded(struct btd_device *device, gboolean bonded)
 	device->bonded = bonded;
 }
 
+void device_set_auto_connect(struct btd_device *device, gboolean enable)
+{
+	char addr[18];
+
+	if (!device)
+		return;
+
+	ba2str(&device->bdaddr, addr);
+
+	DBG("%s auto connect: %d", addr, enable);
+
+	device->auto_connect = enable;
+}
+
 void device_set_type(struct btd_device *device, device_type_t type)
 {
 	if (!device)
diff --git a/src/device.h b/src/device.h
index b6349bc..e38393a 100644
--- a/src/device.h
+++ b/src/device.h
@@ -74,6 +74,7 @@ void device_set_paired(struct btd_device *device, gboolean paired);
 void device_set_temporary(struct btd_device *device, gboolean temporary);
 void device_set_type(struct btd_device *device, device_type_t type);
 void device_set_bonded(struct btd_device *device, gboolean bonded);
+void device_set_auto_connect(struct btd_device *device, gboolean enable);
 gboolean device_is_connected(struct btd_device *device);
 DBusMessage *device_create_bonding(struct btd_device *device,
 				DBusConnection *conn, DBusMessage *msg,
-- 
1.7.6.1


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

* [PATCH BlueZ 03/11] Add continuous connection attempt
  2011-09-26 17:48 [PATCH BlueZ 00/11] Re-connections triggered by platform event Claudio Takahasi
  2011-09-26 17:48 ` [PATCH BlueZ 01/11] Remove timer to trigger connection attempts Claudio Takahasi
  2011-09-26 17:48 ` [PATCH BlueZ 02/11] Add set auto connect in device Claudio Takahasi
@ 2011-09-26 17:48 ` Claudio Takahasi
  2011-10-04 18:30   ` [PATCH Bluez " Claudio Takahasi
  2011-09-26 17:48 ` [PATCH BlueZ 04/11] Add checking if profiles are requesting connection Claudio Takahasi
                   ` (9 subsequent siblings)
  12 siblings, 1 reply; 25+ messages in thread
From: Claudio Takahasi @ 2011-09-26 17:48 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

If auto connect is enabled, queue another connection attempt until
the adapter sets auto connect to FALSE. The behaviour depends on if the
address is found in the advertising cache or not.
---
 src/device.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/src/device.c b/src/device.c
index 410cf4c..ab4792b 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1674,6 +1674,8 @@ done:
 	browse_request_free(req, shutdown);
 }
 
+static gboolean att_connect(gpointer user_data);
+
 static void att_connect_cb(GIOChannel *io, GError *gerr, gpointer user_data)
 {
 	struct btd_device *device = user_data;
@@ -1691,7 +1693,8 @@ static void att_connect_cb(GIOChannel *io, GError *gerr, gpointer user_data)
 
 			device->browse = NULL;
 			browse_request_free(req, TRUE);
-		}
+		} else if (device->auto_connect)
+			g_idle_add(att_connect, device);
 
 		return;
 	}
@@ -1932,6 +1935,13 @@ void device_set_auto_connect(struct btd_device *device, gboolean enable)
 	DBG("%s auto connect: %d", addr, enable);
 
 	device->auto_connect = enable;
+
+	if (device->attrib) {
+		DBG("Already connected");
+		return;
+	}
+
+	g_idle_add(att_connect, device);
 }
 
 void device_set_type(struct btd_device *device, device_type_t type)
-- 
1.7.6.1


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

* [PATCH BlueZ 04/11] Add checking if profiles are requesting connection
  2011-09-26 17:48 [PATCH BlueZ 00/11] Re-connections triggered by platform event Claudio Takahasi
                   ` (2 preceding siblings ...)
  2011-09-26 17:48 ` [PATCH BlueZ 03/11] Add continuous connection attempt Claudio Takahasi
@ 2011-09-26 17:48 ` Claudio Takahasi
  2011-10-04 18:31   ` [PATCH Bluez " Claudio Takahasi
  2011-09-26 17:48 ` [PATCH BlueZ 05/11] Fix repeated connection attempt to the same remote Claudio Takahasi
                   ` (8 subsequent siblings)
  12 siblings, 1 reply; 25+ messages in thread
From: Claudio Takahasi @ 2011-09-26 17:48 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

Before triggering automatic ATTIO connections driven by platform event,
the device needs to check if there is at least one entry in the ATTIO
connection callback, meaning that there is profile requesting connection
and the state is auto connection.
---
 src/device.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/device.c b/src/device.c
index ab4792b..b88aee4 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1941,6 +1941,9 @@ void device_set_auto_connect(struct btd_device *device, gboolean enable)
 		return;
 	}
 
+	if (device->attios == NULL && device->attios_offline == NULL)
+		return;
+
 	g_idle_add(att_connect, device);
 }
 
-- 
1.7.6.1


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

* [PATCH BlueZ 05/11] Fix repeated connection attempt to the same remote
  2011-09-26 17:48 [PATCH BlueZ 00/11] Re-connections triggered by platform event Claudio Takahasi
                   ` (3 preceding siblings ...)
  2011-09-26 17:48 ` [PATCH BlueZ 04/11] Add checking if profiles are requesting connection Claudio Takahasi
@ 2011-09-26 17:48 ` Claudio Takahasi
  2011-10-04 18:31   ` [PATCH Bluez " Claudio Takahasi
  2011-09-26 17:48 ` [PATCH BlueZ 06/11] Disable automatic connections after 60 seconds Claudio Takahasi
                   ` (7 subsequent siblings)
  12 siblings, 1 reply; 25+ messages in thread
From: Claudio Takahasi @ 2011-09-26 17:48 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

Avoids queue dupplicated requests connects for the same device. Sources
can be triggered by auto connect or on demand connection request when a
given profile registers ATTIO connection callbacks.
---
 src/device.c |   28 +++++++++++++++++++++++++---
 1 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/src/device.c b/src/device.c
index b88aee4..35121b5 100644
--- a/src/device.c
+++ b/src/device.c
@@ -139,6 +139,7 @@ struct btd_device {
 	GSList		*attios;
 	GSList		*attios_offline;
 	guint		attachid;		/* Attrib server attach */
+	guint		auto_id;		/* Auto connect source id */
 
 	gboolean	connected;
 
@@ -236,6 +237,9 @@ static void device_free(gpointer user_data)
 	if (device->discov_timer)
 		g_source_remove(device->discov_timer);
 
+	if (device->auto_id)
+		g_source_remove(device->auto_id);
+
 	DBG("%p", device);
 
 	g_free(device->authr);
@@ -1610,6 +1614,13 @@ static void attio_disconnected(gpointer data, gpointer user_data)
 		attio->dcfunc(attio->user_data);
 }
 
+static void att_connect_dispatched(gpointer user_data)
+{
+	struct btd_device *device = user_data;
+
+	device->auto_id = 0;
+}
+
 static void attrib_disconnected(gpointer user_data)
 {
 	struct btd_device *device = user_data;
@@ -1694,7 +1705,10 @@ static void att_connect_cb(GIOChannel *io, GError *gerr, gpointer user_data)
 			device->browse = NULL;
 			browse_request_free(req, TRUE);
 		} else if (device->auto_connect)
-			g_idle_add(att_connect, device);
+			device->auto_id = g_idle_add_full(
+						G_PRIORITY_DEFAULT_IDLE,
+						att_connect, device,
+						att_connect_dispatched);
 
 		return;
 	}
@@ -1936,6 +1950,9 @@ void device_set_auto_connect(struct btd_device *device, gboolean enable)
 
 	device->auto_connect = enable;
 
+	if (device->auto_id != 0)
+		return;
+
 	if (device->attrib) {
 		DBG("Already connected");
 		return;
@@ -1944,7 +1961,9 @@ void device_set_auto_connect(struct btd_device *device, gboolean enable)
 	if (device->attios == NULL && device->attios_offline == NULL)
 		return;
 
-	g_idle_add(att_connect, device);
+	device->auto_id = g_idle_add_full(G_PRIORITY_DEFAULT_IDLE,
+						att_connect, device,
+						att_connect_dispatched);
 }
 
 void device_set_type(struct btd_device *device, device_type_t type)
@@ -2689,7 +2708,10 @@ guint btd_device_add_attio_callback(struct btd_device *device,
 									attio);
 		g_idle_add(notify_attios, device);
 	} else {
-		g_idle_add(att_connect, device);
+		device->auto_id = g_idle_add_full(G_PRIORITY_DEFAULT_IDLE,
+						att_connect, device,
+						att_connect_dispatched);
+
 		device->attios = g_slist_append(device->attios, attio);
 	}
 
-- 
1.7.6.1


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

* [PATCH BlueZ 06/11] Disable automatic connections after 60 seconds
  2011-09-26 17:48 [PATCH BlueZ 00/11] Re-connections triggered by platform event Claudio Takahasi
                   ` (4 preceding siblings ...)
  2011-09-26 17:48 ` [PATCH BlueZ 05/11] Fix repeated connection attempt to the same remote Claudio Takahasi
@ 2011-09-26 17:48 ` Claudio Takahasi
  2011-10-04 18:31   ` [PATCH Bluez " Claudio Takahasi
  2011-09-26 17:48 ` [PATCH BlueZ 07/11] Add display lock watcher on maemo6 plugin Claudio Takahasi
                   ` (6 subsequent siblings)
  12 siblings, 1 reply; 25+ messages in thread
From: Claudio Takahasi @ 2011-09-26 17:48 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

---
 src/adapter.c |   24 ++++++++++++++++++++++++
 src/device.c  |    8 ++++++++
 2 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index 605a9f2..8ff4e3d 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -78,6 +78,7 @@
 #define check_address(address) bachk(address)
 
 #define OFF_TIMER 3
+#define AUTO_TIMER	60
 
 static DBusConnection *connection = NULL;
 static GSList *adapter_drivers = NULL;
@@ -134,6 +135,7 @@ struct btd_adapter {
 	GSList *mode_sessions;		/* Request Mode sessions */
 	GSList *disc_sessions;		/* Discovery sessions */
 	guint scheduler_id;		/* Scheduler handle */
+	guint auto_timeout_id;		/* Automatic connections timeout */
 	sdp_list_t *services;		/* Services associated to adapter */
 
 	gboolean pairable;		/* pairable state */
@@ -3417,6 +3419,22 @@ int btd_adapter_switch_offline(struct btd_adapter *adapter)
 	return 0;
 }
 
+static gboolean disable_auto(gpointer user_data)
+{
+	struct btd_adapter *adapter = user_data;
+	GSList *l;
+
+	for (l = adapter->devices; l; l = l->next) {
+		struct btd_device *device = l->data;
+
+		device_set_auto_connect(device, FALSE);
+	}
+
+	adapter->auto_timeout_id = 0;
+
+	return FALSE;
+}
+
 static void set_auto_connect(gpointer data, gpointer user_data)
 {
 	struct btd_device *device = data;
@@ -3431,7 +3449,13 @@ void btd_adapter_enable_auto_connect(struct btd_adapter *adapter)
 
 	DBG("Enabling automatic connections");
 
+	if (adapter->auto_timeout_id)
+		return;
+
 	g_slist_foreach(adapter->devices, set_auto_connect, NULL);
+
+	adapter->auto_timeout_id = g_timeout_add_seconds(AUTO_TIMER,
+						disable_auto, adapter);
 }
 
 void btd_adapter_register_pin_cb(struct btd_adapter *adapter,
diff --git a/src/device.c b/src/device.c
index 35121b5..f56d57f 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1950,6 +1950,14 @@ void device_set_auto_connect(struct btd_device *device, gboolean enable)
 
 	device->auto_connect = enable;
 
+	/* Disabling auto connect */
+	if (enable == FALSE) {
+		if (device->auto_id)
+			g_source_remove(device->auto_id);
+		return;
+	}
+
+	/* Enabling auto connect */
 	if (device->auto_id != 0)
 		return;
 
-- 
1.7.6.1


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

* [PATCH BlueZ 07/11] Add display lock watcher on maemo6 plugin
  2011-09-26 17:48 [PATCH BlueZ 00/11] Re-connections triggered by platform event Claudio Takahasi
                   ` (5 preceding siblings ...)
  2011-09-26 17:48 ` [PATCH BlueZ 06/11] Disable automatic connections after 60 seconds Claudio Takahasi
@ 2011-09-26 17:48 ` Claudio Takahasi
  2011-10-04 18:31   ` [PATCH Bluez " Claudio Takahasi
  2011-09-26 17:48 ` [PATCH BlueZ 08/11] Set auto connect from " Claudio Takahasi
                   ` (5 subsequent siblings)
  12 siblings, 1 reply; 25+ messages in thread
From: Claudio Takahasi @ 2011-09-26 17:48 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Briglia

From: Anderson Briglia <anderson.briglia@openbossa.org>

Implements display status signal watcher in maemo6 plugin.
---
 plugins/maemo6.c |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/plugins/maemo6.c b/plugins/maemo6.c
index 00fb3fa..e380acd 100644
--- a/plugins/maemo6.c
+++ b/plugins/maemo6.c
@@ -46,12 +46,33 @@
 #define MCE_RADIO_STATES_CHANGE_REQ	"req_radio_states_change"
 #define MCE_RADIO_STATES_GET		"get_radio_states"
 #define MCE_RADIO_STATES_SIG		"radio_states_ind"
+#define MCE_TKLOCK_MODE_SIG		"tklock_mode_ind"
 
 static guint watch_id;
+static guint tklock_watch_id;
 static DBusConnection *conn = NULL;
 static gboolean mce_bt_set = FALSE;
 static gboolean mce_bt_on = FALSE;
 
+static gboolean mce_tklock_mode_cb(DBusConnection *connection,
+					DBusMessage *message, void *user_data)
+{
+	DBusMessageIter args;
+	const char *sigvalue;
+
+	if (!dbus_message_iter_init(message, &args)) {
+		error("message has no arguments");
+	} else if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_STRING) {
+		error("argument is not string");
+	} else {
+
+		dbus_message_iter_get_basic(&args, &sigvalue);
+		DBG("got signal with value %s", sigvalue);
+	}
+
+	return TRUE;
+}
+
 static gboolean mce_signal_callback(DBusConnection *connection,
 					DBusMessage *message, void *user_data)
 {
@@ -204,6 +225,10 @@ static int mce_probe(struct btd_adapter *adapter)
 					MCE_SIGNAL_IF, MCE_RADIO_STATES_SIG,
 					mce_signal_callback, adapter, NULL);
 
+	tklock_watch_id = g_dbus_add_signal_watch(conn, NULL, MCE_SIGNAL_PATH,
+					MCE_SIGNAL_IF, MCE_TKLOCK_MODE_SIG,
+					mce_tklock_mode_cb, adapter, NULL);
+
 	btd_adapter_register_powered_callback(adapter, adapter_powered);
 
 	return 0;
@@ -216,6 +241,9 @@ static void mce_remove(struct btd_adapter *adapter)
 	if (watch_id > 0)
 		g_dbus_remove_watch(conn, watch_id);
 
+	if (tklock_watch_id > 0)
+		g_dbus_remove_watch(conn, tklock_watch_id);
+
 	btd_adapter_unregister_powered_callback(adapter, adapter_powered);
 }
 
-- 
1.7.6.1


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

* [PATCH BlueZ 08/11] Set auto connect from maemo6 plugin
  2011-09-26 17:48 [PATCH BlueZ 00/11] Re-connections triggered by platform event Claudio Takahasi
                   ` (6 preceding siblings ...)
  2011-09-26 17:48 ` [PATCH BlueZ 07/11] Add display lock watcher on maemo6 plugin Claudio Takahasi
@ 2011-09-26 17:48 ` Claudio Takahasi
  2011-10-04 18:31   ` [PATCH Bluez " Claudio Takahasi
  2011-09-26 17:48 ` [PATCH BlueZ 09/11] Add an interval between connection attempts Claudio Takahasi
                   ` (4 subsequent siblings)
  12 siblings, 1 reply; 25+ messages in thread
From: Claudio Takahasi @ 2011-09-26 17:48 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

Inform the adapter that the system has been unlocked when the MCE
sends the tklock_mode_ind signal. This signal will trigger the
automatic re-connections for the devices selected by the profiles.
Profiles register ATTIO callbacks to indicate that ATT connection
is required.
---
 plugins/maemo6.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/plugins/maemo6.c b/plugins/maemo6.c
index e380acd..6c34116 100644
--- a/plugins/maemo6.c
+++ b/plugins/maemo6.c
@@ -57,6 +57,7 @@ static gboolean mce_bt_on = FALSE;
 static gboolean mce_tklock_mode_cb(DBusConnection *connection,
 					DBusMessage *message, void *user_data)
 {
+	struct btd_adapter *adapter = user_data;
 	DBusMessageIter args;
 	const char *sigvalue;
 
@@ -68,6 +69,9 @@ static gboolean mce_tklock_mode_cb(DBusConnection *connection,
 
 		dbus_message_iter_get_basic(&args, &sigvalue);
 		DBG("got signal with value %s", sigvalue);
+
+		if (g_strcmp0("unlocked", sigvalue) == 0 && mce_bt_on)
+			btd_adapter_enable_auto_connect(adapter);
 	}
 
 	return TRUE;
-- 
1.7.6.1


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

* [PATCH BlueZ 09/11] Add an interval between connection attempts
  2011-09-26 17:48 [PATCH BlueZ 00/11] Re-connections triggered by platform event Claudio Takahasi
                   ` (7 preceding siblings ...)
  2011-09-26 17:48 ` [PATCH BlueZ 08/11] Set auto connect from " Claudio Takahasi
@ 2011-09-26 17:48 ` Claudio Takahasi
  2011-10-04 18:32   ` [PATCH Bluez " Claudio Takahasi
  2011-09-26 17:48 ` [PATCH BlueZ 10/11] Enable re-connection if reason is Timeout Claudio Takahasi
                   ` (3 subsequent siblings)
  12 siblings, 1 reply; 25+ messages in thread
From: Claudio Takahasi @ 2011-09-26 17:48 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

For connection attempts to the same remote device, add 5 seconds
interval until the next connect attempt. At the moment, the behaviour
depends on if address is found in the advertising kernel cache only.

Passive scanning kernel patches are not upstream yet. LE scanning will
be executed in background during a short period of time until it finds
the address or EHOSTDOWN is returned to the connection attempt.
---
 src/device.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/device.c b/src/device.c
index f56d57f..3407dc3 100644
--- a/src/device.c
+++ b/src/device.c
@@ -66,6 +66,8 @@
 #define DISCONNECT_TIMER	2
 #define DISCOVERY_TIMER		2
 
+#define AUTO_CONNECTION_INTERVAL	5 /* Next connection attempt */
+
 /* When all services should trust a remote device */
 #define GLOBAL_TRUST "[all]"
 
@@ -1705,8 +1707,9 @@ static void att_connect_cb(GIOChannel *io, GError *gerr, gpointer user_data)
 			device->browse = NULL;
 			browse_request_free(req, TRUE);
 		} else if (device->auto_connect)
-			device->auto_id = g_idle_add_full(
+			device->auto_id = g_timeout_add_seconds_full(
 						G_PRIORITY_DEFAULT_IDLE,
+						AUTO_CONNECTION_INTERVAL,
 						att_connect, device,
 						att_connect_dispatched);
 
-- 
1.7.6.1


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

* [PATCH BlueZ 10/11] Enable re-connection if reason is Timeout
  2011-09-26 17:48 [PATCH BlueZ 00/11] Re-connections triggered by platform event Claudio Takahasi
                   ` (8 preceding siblings ...)
  2011-09-26 17:48 ` [PATCH BlueZ 09/11] Add an interval between connection attempts Claudio Takahasi
@ 2011-09-26 17:48 ` Claudio Takahasi
  2011-10-04 18:32   ` [PATCH Bluez " Claudio Takahasi
  2011-09-26 17:48 ` [PATCH BlueZ 11/11] Add automatic connect timeout config option Claudio Takahasi
                   ` (2 subsequent siblings)
  12 siblings, 1 reply; 25+ messages in thread
From: Claudio Takahasi @ 2011-09-26 17:48 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Briglia

From: Anderson Briglia <anderson.briglia@openbossa.org>

The re-connection timer must be added just when the disconnection reason
was "Connection timeout" for GATT based profiles.
---
 src/device.c |   23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/src/device.c b/src/device.c
index 3407dc3..29db509 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1623,15 +1623,36 @@ static void att_connect_dispatched(gpointer user_data)
 	device->auto_id = 0;
 }
 
+static gboolean att_connect(gpointer user_data);
+
 static void attrib_disconnected(gpointer user_data)
 {
 	struct btd_device *device = user_data;
+	GIOChannel *io;
+	int sock, err = 0;
+	socklen_t len;
+
+	io = g_attrib_get_channel(device->attrib);
+	sock = g_io_channel_unix_get_fd(io);
+	len = sizeof(err);
+	getsockopt(sock, SOL_SOCKET, SO_ERROR, &err, &len);
 
 	g_slist_foreach(device->attios, attio_disconnected, NULL);
 
 	attrib_channel_detach(device->attachid);
 	g_attrib_unref(device->attrib);
 	device->attrib = NULL;
+
+	if (device->auto_connect == FALSE)
+		return;
+
+	if (err != ETIMEDOUT)
+		return;
+
+	device->auto_id = g_timeout_add_seconds_full(G_PRIORITY_DEFAULT_IDLE,
+						AUTO_CONNECTION_INTERVAL,
+						att_connect, device,
+						att_connect_dispatched);
 }
 
 static void primary_cb(GSList *services, guint8 status, gpointer user_data)
@@ -1687,8 +1708,6 @@ done:
 	browse_request_free(req, shutdown);
 }
 
-static gboolean att_connect(gpointer user_data);
-
 static void att_connect_cb(GIOChannel *io, GError *gerr, gpointer user_data)
 {
 	struct btd_device *device = user_data;
-- 
1.7.6.1


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

* [PATCH BlueZ 11/11] Add automatic connect timeout config option
  2011-09-26 17:48 [PATCH BlueZ 00/11] Re-connections triggered by platform event Claudio Takahasi
                   ` (9 preceding siblings ...)
  2011-09-26 17:48 ` [PATCH BlueZ 10/11] Enable re-connection if reason is Timeout Claudio Takahasi
@ 2011-09-26 17:48 ` Claudio Takahasi
  2011-10-04 18:32   ` [PATCH Bluez " Claudio Takahasi
  2011-10-04 18:30 ` [PATCH Bluez 00/11] Re-connections triggered by platform event Claudio Takahasi
  2011-10-05 15:05 ` [PATCH BlueZ " Johan Hedberg
  12 siblings, 1 reply; 25+ messages in thread
From: Claudio Takahasi @ 2011-09-26 17:48 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

Add new option in main.conf allowing change the default automatic
connection timer. This value defines how many seconds re-connection
for bonded devices will be active when a platform/user event triggers
the automatic re-connections.
---
 src/adapter.c |    3 +--
 src/hcid.h    |    1 +
 src/main.c    |   12 ++++++++++++
 src/main.conf |    6 ++++++
 4 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index 8ff4e3d..28063ad 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -78,7 +78,6 @@
 #define check_address(address) bachk(address)
 
 #define OFF_TIMER 3
-#define AUTO_TIMER	60
 
 static DBusConnection *connection = NULL;
 static GSList *adapter_drivers = NULL;
@@ -3454,7 +3453,7 @@ void btd_adapter_enable_auto_connect(struct btd_adapter *adapter)
 
 	g_slist_foreach(adapter->devices, set_auto_connect, NULL);
 
-	adapter->auto_timeout_id = g_timeout_add_seconds(AUTO_TIMER,
+	adapter->auto_timeout_id = g_timeout_add_seconds(main_opts.autoto,
 						disable_auto, adapter);
 }
 
diff --git a/src/hcid.h b/src/hcid.h
index ef25c79..e993a16 100644
--- a/src/hcid.h
+++ b/src/hcid.h
@@ -29,6 +29,7 @@ struct main_opts {
 	char		*name;
 	uint32_t	class;
 	uint16_t	pageto;
+	uint16_t	autoto;
 	uint32_t	discovto;
 	uint32_t	pairto;
 	uint16_t	link_mode;
diff --git a/src/main.c b/src/main.c
index 06becfe..5a953c3 100644
--- a/src/main.c
+++ b/src/main.c
@@ -63,6 +63,7 @@
 #define LAST_ADAPTER_EXIT_TIMEOUT 30
 
 #define DEFAULT_DISCOVERABLE_TIMEOUT 180 /* 3 minutes */
+#define DEFAULT_AUTO_CONNECT_TIMEOUT  60 /* 60 seconds */
 
 struct main_opts main_opts;
 
@@ -128,6 +129,16 @@ static void parse_config(GKeyFile *config)
 		main_opts.flags |= 1 << HCID_SET_PAGETO;
 	}
 
+	val = g_key_file_get_integer(config, "General", "AutoConnectTimeout",
+									&err);
+	if (err) {
+		DBG("%s", err->message);
+		g_clear_error(&err);
+	} else {
+		DBG("auto_to=%d", val);
+		main_opts.autoto = val;
+	}
+
 	str = g_key_file_get_string(config, "General", "Name", &err);
 	if (err) {
 		DBG("%s", err->message);
@@ -230,6 +241,7 @@ static void init_defaults(void)
 	main_opts.mode	= MODE_CONNECTABLE;
 	main_opts.name	= g_strdup("BlueZ");
 	main_opts.discovto	= DEFAULT_DISCOVERABLE_TIMEOUT;
+	main_opts.autoto = DEFAULT_AUTO_CONNECT_TIMEOUT;
 	main_opts.remember_powered = TRUE;
 	main_opts.reverse_sdp = TRUE;
 	main_opts.name_resolv = TRUE;
diff --git a/src/main.conf b/src/main.conf
index a9e2060..321f622 100644
--- a/src/main.conf
+++ b/src/main.conf
@@ -30,6 +30,12 @@ PageTimeout = 8192
 # The value is in seconds. Defaults is 30.
 DiscoverSchedulerInterval = 30
 
+# Automatic connection for bonded devices driven by platform/user events.
+# If a platform plugin uses this mechanism, automatic connections will be
+# enabled during the interval defined below. Initially, this feature
+# intends to be used to establish connections to ATT channels.
+AutoConnectTimeout = 60
+
 # What value should be assumed for the adapter Powered property when
 # SetProperty(Powered, ...) hasn't been called yet. Defaults to true
 InitiallyPowered = true
-- 
1.7.6.1


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

* [PATCH Bluez 00/11] Re-connections triggered by platform event
  2011-09-26 17:48 [PATCH BlueZ 00/11] Re-connections triggered by platform event Claudio Takahasi
                   ` (10 preceding siblings ...)
  2011-09-26 17:48 ` [PATCH BlueZ 11/11] Add automatic connect timeout config option Claudio Takahasi
@ 2011-10-04 18:30 ` Claudio Takahasi
  2011-10-05 15:05 ` [PATCH BlueZ " Johan Hedberg
  12 siblings, 0 replies; 25+ messages in thread
From: Claudio Takahasi @ 2011-10-04 18:30 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

Patch series rebased. No changes from previous version.

Proposal to enable re-connection(for ATT) started by platform/user
actions. eg: Screen unlocked.

Use case: When the user unlocks the screen, automatic re-connections for
bonded devices will start. It will remain active for a short period of
time(default 1 min).

Anderson Briglia (2):
  Add display lock watcher on maemo6 plugin
  Enable re-connection if reason is Timeout

Claudio Takahasi (9):
  Remove timer to trigger connection attempts
  Add set auto connect in device
  Add continuous connection attempt
  Add checking if profiles are requesting connection
  Fix repeated connection attempt to the same remote
  Disable automatic connections after 60 seconds
  Set auto connect from maemo6 plugin
  Add an interval between connection attempts
  Add automatic connect timeout config option

 plugins/maemo6.c |   32 +++++++++++++++
 src/adapter.c    |   40 +++++++++++++++++++
 src/adapter.h    |    1 +
 src/device.c     |  113 ++++++++++++++++++++++++++++++++++++++++--------------
 src/device.h     |    1 +
 src/hcid.h       |    1 +
 src/main.c       |   12 ++++++
 src/main.conf    |    6 +++
 8 files changed, 177 insertions(+), 29 deletions(-)

-- 
1.7.7


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

* [PATCH Bluez 01/11] Remove timer to trigger connection attempts
  2011-09-26 17:48 ` [PATCH BlueZ 01/11] Remove timer to trigger connection attempts Claudio Takahasi
@ 2011-10-04 18:30   ` Claudio Takahasi
  0 siblings, 0 replies; 25+ messages in thread
From: Claudio Takahasi @ 2011-10-04 18:30 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

Removes continuous timer for ATTIO connection attempts. A new approach
is being implemented managing scanning and connection attempts driven
by platform/user actions. eg: screen unlocked.
---
 src/device.c |   35 +++++------------------------------
 1 files changed, 5 insertions(+), 30 deletions(-)

diff --git a/src/device.c b/src/device.c
index 45c4a6a..393d276 100644
--- a/src/device.c
+++ b/src/device.c
@@ -65,7 +65,6 @@
 
 #define DISCONNECT_TIMER	2
 #define DISCOVERY_TIMER		2
-#define AUTOCONNECT_INTERVAL	45
 
 /* When all services should trust a remote device */
 #define GLOBAL_TRUST "[all]"
@@ -143,7 +142,6 @@ struct btd_device {
 	GSList		*attios;
 	GSList		*attios_offline;
 	guint		attachid;		/* Attrib server attach */
-	guint		attioid;
 
 	gboolean	connected;
 
@@ -240,9 +238,6 @@ static void device_free(gpointer user_data)
 	if (device->discov_timer)
 		g_source_remove(device->discov_timer);
 
-	if (device->attioid)
-		g_source_remove(device->attioid);
-
 	DBG("%p", device);
 
 	g_free(device->authr);
@@ -1700,19 +1695,12 @@ static void attio_disconnected(gpointer data, gpointer user_data)
 		attio->dcfunc(attio->user_data);
 }
 
-static gboolean att_auto_connect(gpointer user_data);
-
 static void attrib_disconnected(gpointer user_data)
 {
 	struct btd_device *device = user_data;
 
 	g_slist_foreach(device->attios, attio_disconnected, NULL);
 
-	if ((device->attios || device->attios_offline) && device->attioid == 0)
-		device->attioid = g_timeout_add_seconds(AUTOCONNECT_INTERVAL,
-							att_auto_connect,
-							device);
-
 	attrib_channel_detach(device->attachid);
 	g_attrib_unref(device->attrib);
 	device->attrib = NULL;
@@ -1793,11 +1781,6 @@ static void att_connect_cb(GIOChannel *io, GError *gerr, gpointer user_data)
 		return;
 	}
 
-	if (device->attioid) {
-		g_source_remove(device->attioid);
-		device->attioid = 0;
-	}
-
 	attrib = g_attrib_new(io);
 	device->attachid = attrib_channel_attach(attrib, TRUE);
 	if (device->attachid == 0)
@@ -1815,7 +1798,7 @@ static void att_connect_cb(GIOChannel *io, GError *gerr, gpointer user_data)
 	}
 }
 
-static gboolean att_auto_connect(gpointer user_data)
+static gboolean att_connect(gpointer user_data)
 {
 	struct btd_device *device = user_data;
 	struct btd_adapter *adapter = device->adapter;
@@ -1850,12 +1833,12 @@ static gboolean att_auto_connect(gpointer user_data)
 	if (io == NULL) {
 		error("ATT bt_io_connect(%s): %s", addr, gerr->message);
 		g_error_free(gerr);
-		return TRUE;
+		return FALSE;
 	}
 
 	g_io_channel_unref(io);
 
-	return TRUE;
+	return FALSE;
 }
 
 int device_browse_primary(struct btd_device *device, DBusConnection *conn,
@@ -2763,11 +2746,8 @@ guint btd_device_add_attio_callback(struct btd_device *device,
 		device->attios_offline = g_slist_append(device->attios_offline,
 									attio);
 		g_idle_add(notify_attios, device);
-	} else if (device->attioid == 0) {
-		att_auto_connect(device);
-		device->attioid = g_timeout_add_seconds(AUTOCONNECT_INTERVAL,
-							att_auto_connect,
-							device);
+	} else {
+		g_idle_add(att_connect, device);
 		device->attios = g_slist_append(device->attios, attio);
 	}
 
@@ -2808,11 +2788,6 @@ gboolean btd_device_remove_attio_callback(struct btd_device *device, guint id)
 	if (device->attios != NULL || device->attios_offline != NULL)
 		return TRUE;
 
-	if (device->attioid) {
-		g_source_remove(device->attioid);
-		device->attioid = 0;
-	}
-
 	if (device->attachid) {
 		attrib_channel_detach(device->attachid);
 		device->attachid = 0;
-- 
1.7.7


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

* [PATCH Bluez 02/11] Add set auto connect in device
  2011-09-26 17:48 ` [PATCH BlueZ 02/11] Add set auto connect in device Claudio Takahasi
@ 2011-10-04 18:30   ` Claudio Takahasi
  0 siblings, 0 replies; 25+ messages in thread
From: Claudio Takahasi @ 2011-10-04 18:30 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

Skeleton of automatic connections driven by platform/user event.
Two layers will manage connections: Profiles can request on demand
connections registering ATTIO connection callbacks(one attempt) for
a given device and platform/user action can trigger automatic
connections for devices with ATTIO callbacks registered.
---
 src/adapter.c |   17 +++++++++++++++++
 src/adapter.h |    1 +
 src/device.c  |   15 +++++++++++++++
 src/device.h  |    1 +
 4 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index b3622cb..605a9f2 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -3417,6 +3417,23 @@ int btd_adapter_switch_offline(struct btd_adapter *adapter)
 	return 0;
 }
 
+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)
+{
+	if (!adapter->up)
+		return;
+
+	DBG("Enabling automatic connections");
+
+	g_slist_foreach(adapter->devices, set_auto_connect, NULL);
+}
+
 void btd_adapter_register_pin_cb(struct btd_adapter *adapter,
 							btd_adapter_pin_cb_t cb)
 {
diff --git a/src/adapter.h b/src/adapter.h
index 7ef0af0..d30e82a 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -163,6 +163,7 @@ gboolean adapter_powering_down(struct btd_adapter *adapter);
 int btd_adapter_restore_powered(struct btd_adapter *adapter);
 int btd_adapter_switch_online(struct btd_adapter *adapter);
 int btd_adapter_switch_offline(struct btd_adapter *adapter);
+void btd_adapter_enable_auto_connect(struct btd_adapter *adapter);
 
 typedef ssize_t (*btd_adapter_pin_cb_t) (struct btd_adapter *adapter,
 					struct btd_device *dev, char *out);
diff --git a/src/device.c b/src/device.c
index 393d276..5243797 100644
--- a/src/device.c
+++ b/src/device.c
@@ -151,6 +151,7 @@ struct btd_device {
 	gboolean	paired;
 	gboolean	blocked;
 	gboolean	bonded;
+	gboolean	auto_connect;
 
 	gboolean	authorizing;
 	gint		ref;
@@ -2005,6 +2006,20 @@ void device_set_bonded(struct btd_device *device, gboolean bonded)
 	device->bonded = bonded;
 }
 
+void device_set_auto_connect(struct btd_device *device, gboolean enable)
+{
+	char addr[18];
+
+	if (!device)
+		return;
+
+	ba2str(&device->bdaddr, addr);
+
+	DBG("%s auto connect: %d", addr, enable);
+
+	device->auto_connect = enable;
+}
+
 void device_set_type(struct btd_device *device, device_type_t type)
 {
 	if (!device)
diff --git a/src/device.h b/src/device.h
index 2e17a83..1ea5ce4 100644
--- a/src/device.h
+++ b/src/device.h
@@ -77,6 +77,7 @@ void device_set_paired(struct btd_device *device, gboolean paired);
 void device_set_temporary(struct btd_device *device, gboolean temporary);
 void device_set_type(struct btd_device *device, device_type_t type);
 void device_set_bonded(struct btd_device *device, gboolean bonded);
+void device_set_auto_connect(struct btd_device *device, gboolean enable);
 gboolean device_is_connected(struct btd_device *device);
 DBusMessage *device_create_bonding(struct btd_device *device,
 				DBusConnection *conn, DBusMessage *msg,
-- 
1.7.7


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

* [PATCH Bluez 03/11] Add continuous connection attempt
  2011-09-26 17:48 ` [PATCH BlueZ 03/11] Add continuous connection attempt Claudio Takahasi
@ 2011-10-04 18:30   ` Claudio Takahasi
  0 siblings, 0 replies; 25+ messages in thread
From: Claudio Takahasi @ 2011-10-04 18:30 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

If auto connect is enabled, queue another connection attempt until
the adapter sets auto connect to FALSE. The behaviour depends on if the
address is found in the advertising cache or not.
---
 src/device.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/src/device.c b/src/device.c
index 5243797..c3eaf45 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1760,6 +1760,8 @@ done:
 	browse_request_free(req, shutdown);
 }
 
+static gboolean att_connect(gpointer user_data);
+
 static void att_connect_cb(GIOChannel *io, GError *gerr, gpointer user_data)
 {
 	struct btd_device *device = user_data;
@@ -1777,7 +1779,8 @@ static void att_connect_cb(GIOChannel *io, GError *gerr, gpointer user_data)
 
 			device->browse = NULL;
 			browse_request_free(req, TRUE);
-		}
+		} else if (device->auto_connect)
+			g_idle_add(att_connect, device);
 
 		return;
 	}
@@ -2018,6 +2021,13 @@ void device_set_auto_connect(struct btd_device *device, gboolean enable)
 	DBG("%s auto connect: %d", addr, enable);
 
 	device->auto_connect = enable;
+
+	if (device->attrib) {
+		DBG("Already connected");
+		return;
+	}
+
+	g_idle_add(att_connect, device);
 }
 
 void device_set_type(struct btd_device *device, device_type_t type)
-- 
1.7.7


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

* [PATCH Bluez 04/11] Add checking if profiles are requesting connection
  2011-09-26 17:48 ` [PATCH BlueZ 04/11] Add checking if profiles are requesting connection Claudio Takahasi
@ 2011-10-04 18:31   ` Claudio Takahasi
  0 siblings, 0 replies; 25+ messages in thread
From: Claudio Takahasi @ 2011-10-04 18:31 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

Before triggering automatic ATTIO connections driven by platform event,
the device needs to check if there is at least one entry in the ATTIO
connection callback, meaning that there is profile requesting connection
and the state is auto connection.
---
 src/device.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/device.c b/src/device.c
index c3eaf45..78a925c 100644
--- a/src/device.c
+++ b/src/device.c
@@ -2027,6 +2027,9 @@ void device_set_auto_connect(struct btd_device *device, gboolean enable)
 		return;
 	}
 
+	if (device->attios == NULL && device->attios_offline == NULL)
+		return;
+
 	g_idle_add(att_connect, device);
 }
 
-- 
1.7.7


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

* [PATCH Bluez 05/11] Fix repeated connection attempt to the same remote
  2011-09-26 17:48 ` [PATCH BlueZ 05/11] Fix repeated connection attempt to the same remote Claudio Takahasi
@ 2011-10-04 18:31   ` Claudio Takahasi
  0 siblings, 0 replies; 25+ messages in thread
From: Claudio Takahasi @ 2011-10-04 18:31 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

Avoids queue dupplicated requests connects for the same device. Sources
can be triggered by auto connect or on demand connection request when a
given profile registers ATTIO connection callbacks.
---
 src/device.c |   28 +++++++++++++++++++++++++---
 1 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/src/device.c b/src/device.c
index 78a925c..cde2db3 100644
--- a/src/device.c
+++ b/src/device.c
@@ -142,6 +142,7 @@ struct btd_device {
 	GSList		*attios;
 	GSList		*attios_offline;
 	guint		attachid;		/* Attrib server attach */
+	guint		auto_id;		/* Auto connect source id */
 
 	gboolean	connected;
 
@@ -239,6 +240,9 @@ static void device_free(gpointer user_data)
 	if (device->discov_timer)
 		g_source_remove(device->discov_timer);
 
+	if (device->auto_id)
+		g_source_remove(device->auto_id);
+
 	DBG("%p", device);
 
 	g_free(device->authr);
@@ -1696,6 +1700,13 @@ static void attio_disconnected(gpointer data, gpointer user_data)
 		attio->dcfunc(attio->user_data);
 }
 
+static void att_connect_dispatched(gpointer user_data)
+{
+	struct btd_device *device = user_data;
+
+	device->auto_id = 0;
+}
+
 static void attrib_disconnected(gpointer user_data)
 {
 	struct btd_device *device = user_data;
@@ -1780,7 +1791,10 @@ static void att_connect_cb(GIOChannel *io, GError *gerr, gpointer user_data)
 			device->browse = NULL;
 			browse_request_free(req, TRUE);
 		} else if (device->auto_connect)
-			g_idle_add(att_connect, device);
+			device->auto_id = g_idle_add_full(
+						G_PRIORITY_DEFAULT_IDLE,
+						att_connect, device,
+						att_connect_dispatched);
 
 		return;
 	}
@@ -2022,6 +2036,9 @@ void device_set_auto_connect(struct btd_device *device, gboolean enable)
 
 	device->auto_connect = enable;
 
+	if (device->auto_id != 0)
+		return;
+
 	if (device->attrib) {
 		DBG("Already connected");
 		return;
@@ -2030,7 +2047,9 @@ void device_set_auto_connect(struct btd_device *device, gboolean enable)
 	if (device->attios == NULL && device->attios_offline == NULL)
 		return;
 
-	g_idle_add(att_connect, device);
+	device->auto_id = g_idle_add_full(G_PRIORITY_DEFAULT_IDLE,
+						att_connect, device,
+						att_connect_dispatched);
 }
 
 void device_set_type(struct btd_device *device, device_type_t type)
@@ -2775,7 +2794,10 @@ guint btd_device_add_attio_callback(struct btd_device *device,
 									attio);
 		g_idle_add(notify_attios, device);
 	} else {
-		g_idle_add(att_connect, device);
+		device->auto_id = g_idle_add_full(G_PRIORITY_DEFAULT_IDLE,
+						att_connect, device,
+						att_connect_dispatched);
+
 		device->attios = g_slist_append(device->attios, attio);
 	}
 
-- 
1.7.7


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

* [PATCH Bluez 06/11] Disable automatic connections after 60 seconds
  2011-09-26 17:48 ` [PATCH BlueZ 06/11] Disable automatic connections after 60 seconds Claudio Takahasi
@ 2011-10-04 18:31   ` Claudio Takahasi
  0 siblings, 0 replies; 25+ messages in thread
From: Claudio Takahasi @ 2011-10-04 18:31 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

---
 src/adapter.c |   24 ++++++++++++++++++++++++
 src/device.c  |    8 ++++++++
 2 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index 605a9f2..8ff4e3d 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -78,6 +78,7 @@
 #define check_address(address) bachk(address)
 
 #define OFF_TIMER 3
+#define AUTO_TIMER	60
 
 static DBusConnection *connection = NULL;
 static GSList *adapter_drivers = NULL;
@@ -134,6 +135,7 @@ struct btd_adapter {
 	GSList *mode_sessions;		/* Request Mode sessions */
 	GSList *disc_sessions;		/* Discovery sessions */
 	guint scheduler_id;		/* Scheduler handle */
+	guint auto_timeout_id;		/* Automatic connections timeout */
 	sdp_list_t *services;		/* Services associated to adapter */
 
 	gboolean pairable;		/* pairable state */
@@ -3417,6 +3419,22 @@ int btd_adapter_switch_offline(struct btd_adapter *adapter)
 	return 0;
 }
 
+static gboolean disable_auto(gpointer user_data)
+{
+	struct btd_adapter *adapter = user_data;
+	GSList *l;
+
+	for (l = adapter->devices; l; l = l->next) {
+		struct btd_device *device = l->data;
+
+		device_set_auto_connect(device, FALSE);
+	}
+
+	adapter->auto_timeout_id = 0;
+
+	return FALSE;
+}
+
 static void set_auto_connect(gpointer data, gpointer user_data)
 {
 	struct btd_device *device = data;
@@ -3431,7 +3449,13 @@ void btd_adapter_enable_auto_connect(struct btd_adapter *adapter)
 
 	DBG("Enabling automatic connections");
 
+	if (adapter->auto_timeout_id)
+		return;
+
 	g_slist_foreach(adapter->devices, set_auto_connect, NULL);
+
+	adapter->auto_timeout_id = g_timeout_add_seconds(AUTO_TIMER,
+						disable_auto, adapter);
 }
 
 void btd_adapter_register_pin_cb(struct btd_adapter *adapter,
diff --git a/src/device.c b/src/device.c
index cde2db3..4317a33 100644
--- a/src/device.c
+++ b/src/device.c
@@ -2036,6 +2036,14 @@ void device_set_auto_connect(struct btd_device *device, gboolean enable)
 
 	device->auto_connect = enable;
 
+	/* Disabling auto connect */
+	if (enable == FALSE) {
+		if (device->auto_id)
+			g_source_remove(device->auto_id);
+		return;
+	}
+
+	/* Enabling auto connect */
 	if (device->auto_id != 0)
 		return;
 
-- 
1.7.7


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

* [PATCH Bluez 07/11] Add display lock watcher on maemo6 plugin
  2011-09-26 17:48 ` [PATCH BlueZ 07/11] Add display lock watcher on maemo6 plugin Claudio Takahasi
@ 2011-10-04 18:31   ` Claudio Takahasi
  0 siblings, 0 replies; 25+ messages in thread
From: Claudio Takahasi @ 2011-10-04 18:31 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Briglia

From: Anderson Briglia <anderson.briglia@openbossa.org>

Implements display status signal watcher in maemo6 plugin.
---
 plugins/maemo6.c |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/plugins/maemo6.c b/plugins/maemo6.c
index 00fb3fa..e380acd 100644
--- a/plugins/maemo6.c
+++ b/plugins/maemo6.c
@@ -46,12 +46,33 @@
 #define MCE_RADIO_STATES_CHANGE_REQ	"req_radio_states_change"
 #define MCE_RADIO_STATES_GET		"get_radio_states"
 #define MCE_RADIO_STATES_SIG		"radio_states_ind"
+#define MCE_TKLOCK_MODE_SIG		"tklock_mode_ind"
 
 static guint watch_id;
+static guint tklock_watch_id;
 static DBusConnection *conn = NULL;
 static gboolean mce_bt_set = FALSE;
 static gboolean mce_bt_on = FALSE;
 
+static gboolean mce_tklock_mode_cb(DBusConnection *connection,
+					DBusMessage *message, void *user_data)
+{
+	DBusMessageIter args;
+	const char *sigvalue;
+
+	if (!dbus_message_iter_init(message, &args)) {
+		error("message has no arguments");
+	} else if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_STRING) {
+		error("argument is not string");
+	} else {
+
+		dbus_message_iter_get_basic(&args, &sigvalue);
+		DBG("got signal with value %s", sigvalue);
+	}
+
+	return TRUE;
+}
+
 static gboolean mce_signal_callback(DBusConnection *connection,
 					DBusMessage *message, void *user_data)
 {
@@ -204,6 +225,10 @@ static int mce_probe(struct btd_adapter *adapter)
 					MCE_SIGNAL_IF, MCE_RADIO_STATES_SIG,
 					mce_signal_callback, adapter, NULL);
 
+	tklock_watch_id = g_dbus_add_signal_watch(conn, NULL, MCE_SIGNAL_PATH,
+					MCE_SIGNAL_IF, MCE_TKLOCK_MODE_SIG,
+					mce_tklock_mode_cb, adapter, NULL);
+
 	btd_adapter_register_powered_callback(adapter, adapter_powered);
 
 	return 0;
@@ -216,6 +241,9 @@ static void mce_remove(struct btd_adapter *adapter)
 	if (watch_id > 0)
 		g_dbus_remove_watch(conn, watch_id);
 
+	if (tklock_watch_id > 0)
+		g_dbus_remove_watch(conn, tklock_watch_id);
+
 	btd_adapter_unregister_powered_callback(adapter, adapter_powered);
 }
 
-- 
1.7.7


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

* [PATCH Bluez 08/11] Set auto connect from maemo6 plugin
  2011-09-26 17:48 ` [PATCH BlueZ 08/11] Set auto connect from " Claudio Takahasi
@ 2011-10-04 18:31   ` Claudio Takahasi
  0 siblings, 0 replies; 25+ messages in thread
From: Claudio Takahasi @ 2011-10-04 18:31 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

Inform the adapter that the system has been unlocked when the MCE
sends the tklock_mode_ind signal. This signal will trigger the
automatic re-connections for the devices selected by the profiles.
Profiles register ATTIO callbacks to indicate that ATT connection
is required.
---
 plugins/maemo6.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/plugins/maemo6.c b/plugins/maemo6.c
index e380acd..6c34116 100644
--- a/plugins/maemo6.c
+++ b/plugins/maemo6.c
@@ -57,6 +57,7 @@ static gboolean mce_bt_on = FALSE;
 static gboolean mce_tklock_mode_cb(DBusConnection *connection,
 					DBusMessage *message, void *user_data)
 {
+	struct btd_adapter *adapter = user_data;
 	DBusMessageIter args;
 	const char *sigvalue;
 
@@ -68,6 +69,9 @@ static gboolean mce_tklock_mode_cb(DBusConnection *connection,
 
 		dbus_message_iter_get_basic(&args, &sigvalue);
 		DBG("got signal with value %s", sigvalue);
+
+		if (g_strcmp0("unlocked", sigvalue) == 0 && mce_bt_on)
+			btd_adapter_enable_auto_connect(adapter);
 	}
 
 	return TRUE;
-- 
1.7.7


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

* [PATCH Bluez 09/11] Add an interval between connection attempts
  2011-09-26 17:48 ` [PATCH BlueZ 09/11] Add an interval between connection attempts Claudio Takahasi
@ 2011-10-04 18:32   ` Claudio Takahasi
  0 siblings, 0 replies; 25+ messages in thread
From: Claudio Takahasi @ 2011-10-04 18:32 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

For connection attempts to the same remote device, add 5 seconds
interval until the next connect attempt. At the moment, the behaviour
depends on if address is found in the advertising kernel cache only.

Passive scanning kernel patches are not upstream yet. LE scanning will
be executed in background during a short period of time until it finds
the address or EHOSTDOWN is returned to the connection attempt.
---
 src/device.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/device.c b/src/device.c
index 4317a33..0b45880 100644
--- a/src/device.c
+++ b/src/device.c
@@ -66,6 +66,8 @@
 #define DISCONNECT_TIMER	2
 #define DISCOVERY_TIMER		2
 
+#define AUTO_CONNECTION_INTERVAL	5 /* Next connection attempt */
+
 /* When all services should trust a remote device */
 #define GLOBAL_TRUST "[all]"
 
@@ -1791,8 +1793,9 @@ static void att_connect_cb(GIOChannel *io, GError *gerr, gpointer user_data)
 			device->browse = NULL;
 			browse_request_free(req, TRUE);
 		} else if (device->auto_connect)
-			device->auto_id = g_idle_add_full(
+			device->auto_id = g_timeout_add_seconds_full(
 						G_PRIORITY_DEFAULT_IDLE,
+						AUTO_CONNECTION_INTERVAL,
 						att_connect, device,
 						att_connect_dispatched);
 
-- 
1.7.7


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

* [PATCH Bluez 10/11] Enable re-connection if reason is Timeout
  2011-09-26 17:48 ` [PATCH BlueZ 10/11] Enable re-connection if reason is Timeout Claudio Takahasi
@ 2011-10-04 18:32   ` Claudio Takahasi
  0 siblings, 0 replies; 25+ messages in thread
From: Claudio Takahasi @ 2011-10-04 18:32 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Briglia

From: Anderson Briglia <anderson.briglia@openbossa.org>

The re-connection timer must be added just when the disconnection reason
was "Connection timeout" for GATT based profiles.
---
 src/device.c |   23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/src/device.c b/src/device.c
index 0b45880..68d504d 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1709,15 +1709,36 @@ static void att_connect_dispatched(gpointer user_data)
 	device->auto_id = 0;
 }
 
+static gboolean att_connect(gpointer user_data);
+
 static void attrib_disconnected(gpointer user_data)
 {
 	struct btd_device *device = user_data;
+	GIOChannel *io;
+	int sock, err = 0;
+	socklen_t len;
+
+	io = g_attrib_get_channel(device->attrib);
+	sock = g_io_channel_unix_get_fd(io);
+	len = sizeof(err);
+	getsockopt(sock, SOL_SOCKET, SO_ERROR, &err, &len);
 
 	g_slist_foreach(device->attios, attio_disconnected, NULL);
 
 	attrib_channel_detach(device->attachid);
 	g_attrib_unref(device->attrib);
 	device->attrib = NULL;
+
+	if (device->auto_connect == FALSE)
+		return;
+
+	if (err != ETIMEDOUT)
+		return;
+
+	device->auto_id = g_timeout_add_seconds_full(G_PRIORITY_DEFAULT_IDLE,
+						AUTO_CONNECTION_INTERVAL,
+						att_connect, device,
+						att_connect_dispatched);
 }
 
 static void primary_cb(GSList *services, guint8 status, gpointer user_data)
@@ -1773,8 +1794,6 @@ done:
 	browse_request_free(req, shutdown);
 }
 
-static gboolean att_connect(gpointer user_data);
-
 static void att_connect_cb(GIOChannel *io, GError *gerr, gpointer user_data)
 {
 	struct btd_device *device = user_data;
-- 
1.7.7


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

* [PATCH Bluez 11/11] Add automatic connect timeout config option
  2011-09-26 17:48 ` [PATCH BlueZ 11/11] Add automatic connect timeout config option Claudio Takahasi
@ 2011-10-04 18:32   ` Claudio Takahasi
  0 siblings, 0 replies; 25+ messages in thread
From: Claudio Takahasi @ 2011-10-04 18:32 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

Add new option in main.conf allowing change the default automatic
connection timer. This value defines how many seconds re-connection
for bonded devices will be active when a platform/user event triggers
the automatic re-connections.
---
 src/adapter.c |    3 +--
 src/hcid.h    |    1 +
 src/main.c    |   12 ++++++++++++
 src/main.conf |    6 ++++++
 4 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index 8ff4e3d..28063ad 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -78,7 +78,6 @@
 #define check_address(address) bachk(address)
 
 #define OFF_TIMER 3
-#define AUTO_TIMER	60
 
 static DBusConnection *connection = NULL;
 static GSList *adapter_drivers = NULL;
@@ -3454,7 +3453,7 @@ void btd_adapter_enable_auto_connect(struct btd_adapter *adapter)
 
 	g_slist_foreach(adapter->devices, set_auto_connect, NULL);
 
-	adapter->auto_timeout_id = g_timeout_add_seconds(AUTO_TIMER,
+	adapter->auto_timeout_id = g_timeout_add_seconds(main_opts.autoto,
 						disable_auto, adapter);
 }
 
diff --git a/src/hcid.h b/src/hcid.h
index ef25c79..e993a16 100644
--- a/src/hcid.h
+++ b/src/hcid.h
@@ -29,6 +29,7 @@ struct main_opts {
 	char		*name;
 	uint32_t	class;
 	uint16_t	pageto;
+	uint16_t	autoto;
 	uint32_t	discovto;
 	uint32_t	pairto;
 	uint16_t	link_mode;
diff --git a/src/main.c b/src/main.c
index 06becfe..5a953c3 100644
--- a/src/main.c
+++ b/src/main.c
@@ -63,6 +63,7 @@
 #define LAST_ADAPTER_EXIT_TIMEOUT 30
 
 #define DEFAULT_DISCOVERABLE_TIMEOUT 180 /* 3 minutes */
+#define DEFAULT_AUTO_CONNECT_TIMEOUT  60 /* 60 seconds */
 
 struct main_opts main_opts;
 
@@ -128,6 +129,16 @@ static void parse_config(GKeyFile *config)
 		main_opts.flags |= 1 << HCID_SET_PAGETO;
 	}
 
+	val = g_key_file_get_integer(config, "General", "AutoConnectTimeout",
+									&err);
+	if (err) {
+		DBG("%s", err->message);
+		g_clear_error(&err);
+	} else {
+		DBG("auto_to=%d", val);
+		main_opts.autoto = val;
+	}
+
 	str = g_key_file_get_string(config, "General", "Name", &err);
 	if (err) {
 		DBG("%s", err->message);
@@ -230,6 +241,7 @@ static void init_defaults(void)
 	main_opts.mode	= MODE_CONNECTABLE;
 	main_opts.name	= g_strdup("BlueZ");
 	main_opts.discovto	= DEFAULT_DISCOVERABLE_TIMEOUT;
+	main_opts.autoto = DEFAULT_AUTO_CONNECT_TIMEOUT;
 	main_opts.remember_powered = TRUE;
 	main_opts.reverse_sdp = TRUE;
 	main_opts.name_resolv = TRUE;
diff --git a/src/main.conf b/src/main.conf
index a9e2060..321f622 100644
--- a/src/main.conf
+++ b/src/main.conf
@@ -30,6 +30,12 @@ PageTimeout = 8192
 # The value is in seconds. Defaults is 30.
 DiscoverSchedulerInterval = 30
 
+# Automatic connection for bonded devices driven by platform/user events.
+# If a platform plugin uses this mechanism, automatic connections will be
+# enabled during the interval defined below. Initially, this feature
+# intends to be used to establish connections to ATT channels.
+AutoConnectTimeout = 60
+
 # What value should be assumed for the adapter Powered property when
 # SetProperty(Powered, ...) hasn't been called yet. Defaults to true
 InitiallyPowered = true
-- 
1.7.7


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

* Re: [PATCH BlueZ 00/11] Re-connections triggered by platform event
  2011-09-26 17:48 [PATCH BlueZ 00/11] Re-connections triggered by platform event Claudio Takahasi
                   ` (11 preceding siblings ...)
  2011-10-04 18:30 ` [PATCH Bluez 00/11] Re-connections triggered by platform event Claudio Takahasi
@ 2011-10-05 15:05 ` Johan Hedberg
  12 siblings, 0 replies; 25+ messages in thread
From: Johan Hedberg @ 2011-10-05 15:05 UTC (permalink / raw)
  To: Claudio Takahasi; +Cc: linux-bluetooth

Hi Claudio,

On Mon, Sep 26, 2011, Claudio Takahasi wrote:
> Proposal to enable re-connection(for ATT) started by platform/user
> actions. eg: Screen unlocked.
> 
> Use case: When the user unlocks the screen, automatic re-connections for
> bonded devices will start. It will remain active for a short period of
> time(default 1 min).
> 
> Anderson Briglia (2):
>   Add display lock watcher on maemo6 plugin
>   Enable re-connection if reason is Timeout
> 
> Claudio Takahasi (9):
>   Remove timer to trigger connection attempts
>   Add set auto connect in device
>   Add continuous connection attempt
>   Add checking if profiles are requesting connection
>   Fix repeated connection attempt to the same remote
>   Disable automatic connections after 60 seconds
>   Set auto connect from maemo6 plugin
>   Add an interval between connection attempts
>   Add automatic connect timeout config option
> 
>  plugins/maemo6.c |   32 +++++++++++++++
>  src/adapter.c    |   40 +++++++++++++++++++
>  src/adapter.h    |    1 +
>  src/device.c     |  113 ++++++++++++++++++++++++++++++++++++++++--------------
>  src/device.h     |    1 +
>  src/hcid.h       |    1 +
>  src/main.c       |   12 ++++++
>  src/main.conf    |    6 +++
>  8 files changed, 177 insertions(+), 29 deletions(-)

All patches have been applied. Thanks.

Johan

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

end of thread, other threads:[~2011-10-05 15:05 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-26 17:48 [PATCH BlueZ 00/11] Re-connections triggered by platform event Claudio Takahasi
2011-09-26 17:48 ` [PATCH BlueZ 01/11] Remove timer to trigger connection attempts Claudio Takahasi
2011-10-04 18:30   ` [PATCH Bluez " Claudio Takahasi
2011-09-26 17:48 ` [PATCH BlueZ 02/11] Add set auto connect in device Claudio Takahasi
2011-10-04 18:30   ` [PATCH Bluez " Claudio Takahasi
2011-09-26 17:48 ` [PATCH BlueZ 03/11] Add continuous connection attempt Claudio Takahasi
2011-10-04 18:30   ` [PATCH Bluez " Claudio Takahasi
2011-09-26 17:48 ` [PATCH BlueZ 04/11] Add checking if profiles are requesting connection Claudio Takahasi
2011-10-04 18:31   ` [PATCH Bluez " Claudio Takahasi
2011-09-26 17:48 ` [PATCH BlueZ 05/11] Fix repeated connection attempt to the same remote Claudio Takahasi
2011-10-04 18:31   ` [PATCH Bluez " Claudio Takahasi
2011-09-26 17:48 ` [PATCH BlueZ 06/11] Disable automatic connections after 60 seconds Claudio Takahasi
2011-10-04 18:31   ` [PATCH Bluez " Claudio Takahasi
2011-09-26 17:48 ` [PATCH BlueZ 07/11] Add display lock watcher on maemo6 plugin Claudio Takahasi
2011-10-04 18:31   ` [PATCH Bluez " Claudio Takahasi
2011-09-26 17:48 ` [PATCH BlueZ 08/11] Set auto connect from " Claudio Takahasi
2011-10-04 18:31   ` [PATCH Bluez " Claudio Takahasi
2011-09-26 17:48 ` [PATCH BlueZ 09/11] Add an interval between connection attempts Claudio Takahasi
2011-10-04 18:32   ` [PATCH Bluez " Claudio Takahasi
2011-09-26 17:48 ` [PATCH BlueZ 10/11] Enable re-connection if reason is Timeout Claudio Takahasi
2011-10-04 18:32   ` [PATCH Bluez " Claudio Takahasi
2011-09-26 17:48 ` [PATCH BlueZ 11/11] Add automatic connect timeout config option Claudio Takahasi
2011-10-04 18:32   ` [PATCH Bluez " Claudio Takahasi
2011-10-04 18:30 ` [PATCH Bluez 00/11] Re-connections triggered by platform event Claudio Takahasi
2011-10-05 15:05 ` [PATCH BlueZ " Johan Hedberg

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.