From: Archie Pusaka <apusaka@xxxxxxxxxxxx> This is to configure the default behavior of issuing SDP query to update the services upon profile connection. --- Changes in v3: * Add main_opts.refresh_discovery Changes in v2: None src/device.c | 2 +- src/hcid.h | 1 + src/main.c | 8 ++++++++ src/main.conf | 4 ++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/device.c b/src/device.c index 52dfea18f..a91eda027 100644 --- a/src/device.c +++ b/src/device.c @@ -4076,7 +4076,7 @@ static struct btd_device *device_new(struct btd_adapter *adapter, device->db_id = gatt_db_register(device->db, gatt_service_added, gatt_service_removed, device, NULL); - device->refresh_discovery = true; + device->refresh_discovery = main_opts.refresh_discovery; return btd_device_ref(device); } diff --git a/src/hcid.h b/src/hcid.h index 5f249ebf9..3624ba6ea 100644 --- a/src/hcid.h +++ b/src/hcid.h @@ -100,6 +100,7 @@ struct main_opts { gboolean name_resolv; gboolean debug_keys; gboolean fast_conn; + gboolean refresh_discovery; uint16_t did_source; uint16_t did_vendor; diff --git a/src/main.c b/src/main.c index ec7a9fbd7..b205575f6 100644 --- a/src/main.c +++ b/src/main.c @@ -627,6 +627,13 @@ static void parse_config(GKeyFile *config) else main_opts.fast_conn = boolean; + boolean = g_key_file_get_boolean(config, "General", + "RefreshDiscovery", &err); + if (err) + g_clear_error(&err); + else + main_opts.refresh_discovery = boolean; + str = g_key_file_get_string(config, "GATT", "Cache", &err); if (err) { DBG("%s", err->message); @@ -688,6 +695,7 @@ static void init_defaults(void) main_opts.reverse_discovery = TRUE; main_opts.name_resolv = TRUE; main_opts.debug_keys = FALSE; + main_opts.refresh_discovery = TRUE; main_opts.default_params.num_entries = 0; main_opts.default_params.br_page_scan_type = 0xFFFF; diff --git a/src/main.conf b/src/main.conf index f41203b96..42f7e41c5 100644 --- a/src/main.conf +++ b/src/main.conf @@ -82,6 +82,10 @@ # 0 = disable timer, i.e. never keep temporary devices #TemporaryTimeout = 30 +# Enables the device to issue an SDP request to update known services when +# profile is connected. Defaults to true. +#RefreshDiscovery = true + [Controller] # The following values are used to load default adapter parameters. BlueZ loads # the values into the kernel before the adapter is powered if the kernel -- 2.28.0.220.ged08abb693-goog