summaryrefslogtreecommitdiffstats
path: root/hcid/main.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2008-05-16 10:19:23 +0000
committerJohan Hedberg <johan.hedberg@nokia.com>2008-05-16 10:19:23 +0000
commit7c67f70b684870920af46c1561eedc475c4ad31f (patch)
tree23c02801402cebdfb875c4570614ee0a96d748a0 /hcid/main.c
parent4de66ff306262950a6da54399cef89a9134247f0 (diff)
Implement support for disabling specific plugins from loading
Diffstat (limited to 'hcid/main.c')
-rw-r--r--hcid/main.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/hcid/main.c b/hcid/main.c
index 980afec2..1afd3475 100644
--- a/hcid/main.c
+++ b/hcid/main.c
@@ -64,6 +64,23 @@ struct device_opts *parser_device;
static struct device_list *device_list = NULL;
static int child_pipe[2];
+static GKeyFile *load_config(const char *file)
+{
+ GError *err = NULL;
+ GKeyFile *keyfile;
+
+ keyfile = g_key_file_new();
+
+ if (!g_key_file_load_from_file(keyfile, file, 0, &err)) {
+ error("Parsing %s failed: %s", file, err->message);
+ g_error_free(err);
+ g_key_file_free(keyfile);
+ return NULL;
+ }
+
+ return keyfile;
+}
+
static inline void init_device_defaults(struct device_opts *device_opts)
{
memset(device_opts, 0, sizeof(*device_opts));
@@ -769,6 +786,7 @@ int main(int argc, char *argv[])
GIOChannel *ctl_io, *child_io;
uint16_t mtu = 0;
int opt, daemonize = 1, debug = 0, sdp = 1, experimental = 0;
+ GKeyFile *config;
/* Default HCId settings */
memset(&hcid, 0, sizeof(hcid));
@@ -871,6 +889,8 @@ int main(int argc, char *argv[])
exit(1);
}
+ config = load_config(CONFIGDIR "/main.conf");
+
if (read_config(hcid.config_file) < 0)
error("Config load failed");
@@ -920,7 +940,7 @@ int main(int argc, char *argv[])
* the plugins might wanna expose some paths on the bus. However the
* best order of how to init various subsystems of the Bluetooth
* daemon needs to be re-worked. */
- plugin_init();
+ plugin_init(config);
/* Start event processor */
g_main_loop_run(event_loop);
@@ -939,6 +959,9 @@ int main(int argc, char *argv[])
g_main_loop_unref(event_loop);
+ if (config)
+ g_key_file_free(config);
+
info("Exit");
stop_logging();