This patch adds support for specifying a main configuration file
different from the default value of /etc/connman/main.conf. This
is valuable during debug to specify alternate debug-only
configurations.
#define DEFAULT_INPUT_REQUEST_TIMEOUT 120 * 1000
#define DEFAULT_BROWSER_LAUNCH_TIMEOUT 300 * 1000
#define DEFAULT_INPUT_REQUEST_TIMEOUT 120 * 1000
#define DEFAULT_BROWSER_LAUNCH_TIMEOUT 300 * 1000
+#define CONFIGMAINFILE CONFIGDIR "/main.conf"
+
static char *default_auto_connect[] = {
"wifi",
"ethernet",
static char *default_auto_connect[] = {
"wifi",
"ethernet",
+static int config_init(const char *file)
+{
+ GKeyFile *config;
+
+ config = load_config(file);
+ parse_config(config);
+ if (config != NULL)
+ g_key_file_free(config);
+
+ return 0;
+}
+
static GMainLoop *main_loop = NULL;
static unsigned int __terminated = 0;
static GMainLoop *main_loop = NULL;
static unsigned int __terminated = 0;
g_main_loop_quit(main_loop);
}
g_main_loop_quit(main_loop);
}
+static gchar *option_config = NULL;
static gchar *option_debug = NULL;
static gchar *option_device = NULL;
static gchar *option_plugin = NULL;
static gchar *option_debug = NULL;
static gchar *option_device = NULL;
static gchar *option_plugin = NULL;
}
static GOptionEntry options[] = {
}
static GOptionEntry options[] = {
+ { "config", 'c', 0, G_OPTION_ARG_STRING, &option_config,
+ "Load the specified configuration file "
+ "instead of " CONFIGMAINFILE, "FILE" },
{ "debug", 'd', G_OPTION_FLAG_OPTIONAL_ARG,
G_OPTION_ARG_CALLBACK, parse_debug,
"Specify debug options to enable", "DEBUG" },
{ "debug", 'd', G_OPTION_FLAG_OPTIONAL_ARG,
G_OPTION_ARG_CALLBACK, parse_debug,
"Specify debug options to enable", "DEBUG" },
GError *error = NULL;
DBusConnection *conn;
DBusError err;
GError *error = NULL;
DBusConnection *conn;
DBusError err;
guint signal;
#ifdef NEED_THREADS
guint signal;
#ifdef NEED_THREADS
__connman_dbus_init(conn);
__connman_dbus_init(conn);
- config = load_config(CONFIGDIR "/main.conf");
- parse_config(config);
- if (config != NULL)
- g_key_file_free(config);
+ if (option_config == NULL)
+ config_init(CONFIGMAINFILE);
+ else
+ config_init(option_config);
__connman_storage_migrate();
__connman_technology_init();
__connman_storage_migrate();
__connman_technology_init();
__connman_wispr_init();
__connman_rfkill_init();
__connman_wispr_init();
__connman_rfkill_init();
g_free(option_device);
g_free(option_plugin);
g_free(option_nodevice);
g_free(option_device);
g_free(option_plugin);
g_free(option_nodevice);