From 86f4b55232de3c8c1be87f22ad3a404316afb110 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 15 May 2014 10:56:41 +0300 Subject: [PATCH] core: Add API to get access to main.conf --- src/hcid.h | 2 ++ src/main.c | 15 ++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/hcid.h b/src/hcid.h index ea67cc259..6040c71d2 100644 --- a/src/hcid.h +++ b/src/hcid.h @@ -47,4 +47,6 @@ void plugin_cleanup(void); void rfkill_init(void); void rfkill_exit(void); +GKeyFile *btd_get_main_conf(void); + void btd_exit(void); diff --git a/src/main.c b/src/main.c index b3136fc3a..be757d749 100644 --- a/src/main.c +++ b/src/main.c @@ -66,6 +66,7 @@ #define SHUTDOWN_GRACE_SECONDS 10 struct main_opts main_opts; +GKeyFile *main_conf; static const char * const supported_options[] = { "Name", @@ -79,6 +80,11 @@ static const char * const supported_options[] = { "DebugKeys", }; +GKeyFile *btd_get_main_conf(void) +{ + return main_conf; +} + static GKeyFile *load_config(const char *file) { GError *err = NULL; @@ -488,7 +494,6 @@ int main(int argc, char *argv[]) uint16_t sdp_mtu = 0; uint32_t sdp_flags = 0; int gdbus_flags = 0; - GKeyFile *config; guint signal, watchdog; const char *watchdog_usec; @@ -523,9 +528,9 @@ int main(int argc, char *argv[]) sd_notify(0, "STATUS=Starting up"); - config = load_config(CONFIGDIR "/main.conf"); + main_conf = load_config(CONFIGDIR "/main.conf"); - parse_config(config); + parse_config(main_conf); if (connect_dbus() < 0) { error("Unable to get on D-Bus"); @@ -609,8 +614,8 @@ int main(int argc, char *argv[]) g_main_loop_unref(event_loop); - if (config) - g_key_file_free(config); + if (main_conf) + g_key_file_free(main_conf); disconnect_dbus(); -- 2.47.3