From: Marcel Holtmann Date: Wed, 20 May 2009 22:17:40 +0000 (-0700) Subject: Add option for selecting WiFi/Supplicant driver from command line X-Git-Tag: maemo-0.19~42 X-Git-Url: http://git.maemo.org/git/?p=connman;a=commitdiff_plain;h=7aabc6d00645abd107d0571ca121cfdbbc043e4b Add option for selecting WiFi/Supplicant driver from command line --- diff --git a/include/Makefile.am b/include/Makefile.am index dce9b36..86845ac 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -7,7 +7,7 @@ include_HEADERS = types.h log.h plugin.h security.h notifier.h \ nodist_include_HEADERS = version.h noinst_HEADERS = driver.h element.h property.h ipv4.h rtnl.h dbus.h \ - resolver.h ipconfig.h service.h + resolver.h ipconfig.h service.h option.h MAINTAINERCLEANFILES = Makefile.in diff --git a/include/option.h b/include/option.h new file mode 100644 index 0000000..b80c8c9 --- /dev/null +++ b/include/option.h @@ -0,0 +1,35 @@ +/* + * + * Connection Manager + * + * Copyright (C) 2007-2009 Intel Corporation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef __CONNMAN_OPTION_H +#define __CONNMAN_OPTION_H + +#ifdef __cplusplus +extern "C" { +#endif + +extern const char *connman_option_get_string(const char *key); + +#ifdef __cplusplus +} +#endif + +#endif /* __CONNMAN_OPTION_H */ diff --git a/plugins/supplicant.c b/plugins/supplicant.c index 43d667a..70af60a 100644 --- a/plugins/supplicant.c +++ b/plugins/supplicant.c @@ -33,6 +33,7 @@ #define CONNMAN_API_SUBJECT_TO_CHANGE #include +#include #include #include @@ -260,7 +261,7 @@ done: static int add_interface(struct supplicant_task *task) { - const char *driver = "wext"; + const char *driver = connman_option_get_string("wifi"); DBusMessage *message; DBusMessageIter array, dict; DBusPendingCall *call; diff --git a/src/connman.h b/src/connman.h index 5f1b1bd..b2522a1 100644 --- a/src/connman.h +++ b/src/connman.h @@ -72,6 +72,8 @@ void __connman_log_cleanup(void); void __connman_toggle_debug(void); gboolean __connman_debug_enabled(void); +#include + #include int __connman_plugin_init(const char *pattern, const char *exclude); diff --git a/src/main.c b/src/main.c index 56537e1..df0309a 100644 --- a/src/main.c +++ b/src/main.c @@ -59,6 +59,7 @@ static gchar *option_device = NULL; static gchar *option_plugin = NULL; static gchar *option_nodevice = NULL; static gchar *option_noplugin = NULL; +static gchar *option_wifi = NULL; static gboolean option_detach = TRUE; static gboolean option_compat = FALSE; static gboolean option_debug = FALSE; @@ -74,6 +75,8 @@ static GOptionEntry options[] = { "Specify plugins to load", "NAME" }, { "noplugin", 'P', 0, G_OPTION_ARG_STRING, &option_noplugin, "Specify plugins not to load", "NAME" }, + { "wifi", 'W', 0, G_OPTION_ARG_STRING, &option_wifi, + "Specify driver for WiFi/Supplicant", "NAME" }, { "nodaemon", 'n', G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &option_detach, "Don't fork daemon to background" }, @@ -88,6 +91,18 @@ static GOptionEntry options[] = { { NULL }, }; +const char *connman_option_get_string(const char *key) +{ + if (g_strcmp0(key, "wifi") == 0) { + if (option_wifi == NULL) + return "nl80211,wext"; + else + return option_wifi; + } + + return NULL; +} + int main(int argc, char *argv[]) { GOptionContext *context;