summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjerpelea <jerpelea@gmail.com>2011-11-22 09:40:37 +0200
committerSteve Kondik <steve@cyngn.com>2015-10-26 15:49:35 -0700
commit8fc46e5b59bec51c8bc7145a8677abbee3fdd51a (patch)
tree59908a619e627d50e0cfe78ae8bf37d12a408044
parent95e732727996328a0f760d6da7668ba4d55a58b3 (diff)
downloadhardware_libhardware_legacy-8fc46e5b59bec51c8bc7145a8677abbee3fdd51a.zip
hardware_libhardware_legacy-8fc46e5b59bec51c8bc7145a8677abbee3fdd51a.tar.gz
hardware_libhardware_legacy-8fc46e5b59bec51c8bc7145a8677abbee3fdd51a.tar.bz2
wifi: add suport for WIFI_EXT_MODULE
Some wifi modules have dependencies on others (for SDIO, usually). Use WIFI_EXT_MODULE_PATH to specify such dependencies Change-Id: Ie8e746c1e69712be78d420d8e8ae8b015564a03d Conflicts: wifi/wifi.c Change-Id: I3fbc0065f76d91d170fb562159ea326caa4f3345
-rw-r--r--wifi/Android.mk9
-rw-r--r--wifi/wifi.c23
2 files changed, 31 insertions, 1 deletions
diff --git a/wifi/Android.mk b/wifi/Android.mk
index c06a39c..7fa595c 100644
--- a/wifi/Android.mk
+++ b/wifi/Android.mk
@@ -27,6 +27,15 @@ endif
ifdef WIFI_DRIVER_FW_PATH_PARAM
LOCAL_CFLAGS += -DWIFI_DRIVER_FW_PATH_PARAM=\"$(WIFI_DRIVER_FW_PATH_PARAM)\"
endif
+ifdef WIFI_EXT_MODULE_PATH
+LOCAL_CFLAGS += -DWIFI_EXT_MODULE_PATH=\"$(WIFI_EXT_MODULE_PATH)\"
+endif
+ifdef WIFI_EXT_MODULE_ARG
+LOCAL_CFLAGS += -DWIFI_EXT_MODULE_ARG=\"$(WIFI_EXT_MODULE_ARG)\"
+endif
+ifdef WIFI_EXT_MODULE_NAME
+LOCAL_CFLAGS += -DWIFI_EXT_MODULE_NAME=\"$(WIFI_EXT_MODULE_NAME)\"
+endif
ifdef WIFI_DRIVER_STATE_CTRL_PARAM
LOCAL_CFLAGS += -DWIFI_DRIVER_STATE_CTRL_PARAM=\"$(WIFI_DRIVER_STATE_CTRL_PARAM)\"
diff --git a/wifi/wifi.c b/wifi/wifi.c
index fcacfe5..14adf38 100644
--- a/wifi/wifi.c
+++ b/wifi/wifi.c
@@ -115,6 +115,18 @@ struct genl_family *nl80211;
#define WIFI_DRIVER_FW_PATH_P2P NULL
#endif
+#ifdef WIFI_EXT_MODULE_NAME
+static const char EXT_MODULE_NAME[] = WIFI_EXT_MODULE_NAME;
+#ifdef WIFI_EXT_MODULE_ARG
+static const char EXT_MODULE_ARG[] = WIFI_EXT_MODULE_ARG;
+#else
+static const char EXT_MODULE_ARG[] = "";
+#endif
+#endif
+#ifdef WIFI_EXT_MODULE_PATH
+static const char EXT_MODULE_PATH[] = WIFI_EXT_MODULE_PATH;
+#endif
+
#ifndef WIFI_DRIVER_FW_PATH_PARAM
#define WIFI_DRIVER_FW_PATH_PARAM "/sys/module/wlan/parameters/fwpath"
#endif
@@ -309,7 +321,6 @@ int wifi_load_driver()
char driver_status[PROPERTY_VALUE_MAX];
int count = 100; /* wait at most 20 seconds for completion */
char module_arg2[256];
-
#ifdef SAMSUNG_WIFI
char* type = get_samsung_wifi_type();
@@ -321,6 +332,13 @@ int wifi_load_driver()
if (insmod(DRIVER_MODULE_PATH, module_arg2) < 0) {
#else
+
+#ifdef WIFI_EXT_MODULE_PATH
+ if (insmod(EXT_MODULE_PATH, EXT_MODULE_ARG) < 0)
+ return -1;
+ usleep(200000);
+#endif
+
if (insmod(DRIVER_MODULE_PATH, DRIVER_MODULE_ARG) < 0) {
#endif
@@ -382,6 +400,9 @@ int wifi_unload_driver()
}
usleep(500000); /* allow card removal */
if (count) {
+#ifdef WIFI_EXT_MODULE_NAME
+ if (rmmod(EXT_MODULE_NAME) == 0)
+#endif
return 0;
}
return -1;