From 1cd65e52665cfbf939c923baea51748e359abfa5 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Tue, 10 Mar 2015 21:48:25 +0200 Subject: [PATCH] core: Add FastConnectable main.conf setting --- src/adapter.c | 4 ++++ src/hcid.h | 1 + src/main.c | 8 ++++++++ src/main.conf | 6 ++++++ 4 files changed, 19 insertions(+) diff --git a/src/adapter.c b/src/adapter.c index 93de573a6..329e9b415 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -7103,6 +7103,10 @@ static void read_info_complete(uint8_t status, uint16_t length, if (missing_settings & MGMT_SETTING_SECURE_CONN) set_mode(adapter, MGMT_OP_SET_SECURE_CONN, 0x01); + if (main_opts.fast_conn && + (missing_settings & MGMT_SETTING_FAST_CONNECTABLE)) + set_mode(adapter, MGMT_OP_SET_FAST_CONNECTABLE, 0x01); + err = adapter_register(adapter); if (err < 0) { error("Unable to register new adapter"); diff --git a/src/hcid.h b/src/hcid.h index 0c9129267..60e2b0a47 100644 --- a/src/hcid.h +++ b/src/hcid.h @@ -38,6 +38,7 @@ struct main_opts { gboolean reverse_sdp; gboolean name_resolv; gboolean debug_keys; + gboolean fast_conn; uint16_t did_source; uint16_t did_vendor; diff --git a/src/main.c b/src/main.c index f571479bc..0562b4460 100644 --- a/src/main.c +++ b/src/main.c @@ -328,6 +328,14 @@ static void parse_config(GKeyFile *config) g_free(str); } + + boolean = g_key_file_get_boolean(config, "General", + "FastConnectable", &err); + if (err) + g_clear_error(&err); + else + main_opts.fast_conn = boolean; + } static void init_defaults(void) diff --git a/src/main.conf b/src/main.conf index 9be90af03..9b41f8cc6 100644 --- a/src/main.conf +++ b/src/main.conf @@ -59,6 +59,12 @@ # Possible values: "off", "single", "multiple" #MultiProfile = off +# Permanently enables the Fast Connectable setting for adapters that +# support it. When enabled other devices can connect faster to us, +# however the tradeoff is increased power consumptions. Defaults to +# 'false'. +#FastConnectable = false + #[Policy] # # The ReconnectUUIDs defines the set of remote services that should try -- 2.47.3