summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFrédéric Danis <frederic.danis@linux.intel.com>2012-10-24 16:34:08 +0200
committerJohan Hedberg <johan.hedberg@intel.com>2012-10-25 12:34:49 +0300
commita1098f655f041f361d7020e35c35df8215131280 (patch)
tree18e7046c5960976fe95bedd66ddd0ebf95b14b59 /src
parent5a49021eb173cfcdbb8adbdccdae74c16db09e41 (diff)
adapter: Read pairable timeout in storage at init
Diffstat (limited to 'src')
-rw-r--r--src/adapter.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/adapter.c b/src/adapter.c
index d0a8404f..918991cc 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2107,16 +2107,6 @@ static int get_discoverable_timeout(const char *src)
return main_opts.discovto;
}
-static int get_pairable_timeout(const char *src)
-{
- int timeout;
-
- if (read_pairable_timeout(src, &timeout) == 0)
- return timeout;
-
- return main_opts.pairto;
-}
-
static void set_auto_connect(gpointer data, gpointer user_data)
{
struct btd_device *device = data;
@@ -2243,7 +2233,6 @@ void btd_adapter_start(struct btd_adapter *adapter)
adapter->off_requested = FALSE;
adapter->up = TRUE;
adapter->discov_timeout = get_discoverable_timeout(address);
- adapter->pairable_timeout = get_pairable_timeout(address);
adapter->off_timer = 0;
if (adapter->scan_mode & SCAN_INQUIRY)
@@ -2490,6 +2479,10 @@ void btd_adapter_unref(struct btd_adapter *adapter)
static void load_config(struct btd_adapter *adapter)
{
char name[MAX_NAME_LENGTH + 1];
+ char address[18];
+ int timeout;
+
+ ba2str(&adapter->bdaddr, address);
/* Get name */
if (read_local_name(&adapter->bdaddr, name) < 0)
@@ -2503,6 +2496,12 @@ static void load_config(struct btd_adapter *adapter)
/* Get pairable mode */
if (read_device_pairable(&adapter->bdaddr, &adapter->pairable) < 0)
adapter->pairable = TRUE;
+
+ /* Get pairable timeout */
+ if (read_pairable_timeout(address, &timeout) < 0)
+ adapter->pairable_timeout = main_opts.pairto;
+ else
+ adapter->pairable_timeout = timeout;
}
gboolean adapter_init(struct btd_adapter *adapter, gboolean up)