All of lore.kernel.org
 help / color / mirror / Atom feed
From: Claudio Takahasi <claudio.takahasi@openbossa.org>
To: linux-bluetooth@vger.kernel.org
Cc: Claudio Takahasi <claudio.takahasi@openbossa.org>
Subject: [PATCH BlueZ 11/11] Add automatic connect timeout config option
Date: Mon, 26 Sep 2011 14:48:28 -0300	[thread overview]
Message-ID: <1317059308-20038-12-git-send-email-claudio.takahasi@openbossa.org> (raw)
In-Reply-To: <1317059308-20038-1-git-send-email-claudio.takahasi@openbossa.org>

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


  parent reply	other threads:[~2011-09-26 17:48 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Claudio Takahasi [this message]
2011-10-04 18:32   ` [PATCH Bluez 11/11] Add automatic connect timeout config option 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1317059308-20038-12-git-send-email-claudio.takahasi@openbossa.org \
    --to=claudio.takahasi@openbossa.org \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.