summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Kondik <shade@chemlab.org>2012-12-20 20:39:18 -0800
committerSteve Kondik <steve@cyngn.com>2015-10-26 15:49:35 -0700
commit88ea21bab1bd4e89819d62cbee7954120f458dcf (patch)
treee02ef49fe9f4adaf71441782164e7ad2ffdf8fcd
parent12374d726faeb2aaa87d4e22a6558ca24d0c8695 (diff)
downloadhardware_libhardware_legacy-88ea21bab1bd4e89819d62cbee7954120f458dcf.zip
hardware_libhardware_legacy-88ea21bab1bd4e89819d62cbee7954120f458dcf.tar.gz
hardware_libhardware_legacy-88ea21bab1bd4e89819d62cbee7954120f458dcf.tar.bz2
wifi: Add support for AP module args
* Needed for Samsung's goofy handling of AP mode Change-Id: I5ec65460b7c9f8ef34170473cf1bdaa36587767b
-rw-r--r--include/hardware_legacy/wifi.h5
-rw-r--r--wifi/Android.mk3
-rw-r--r--wifi/wifi.c18
3 files changed, 26 insertions, 0 deletions
diff --git a/include/hardware_legacy/wifi.h b/include/hardware_legacy/wifi.h
index e4aa93c..8e05397 100644
--- a/include/hardware_legacy/wifi.h
+++ b/include/hardware_legacy/wifi.h
@@ -159,6 +159,11 @@ const char *wifi_get_fw_path(int fw_type);
int wifi_change_fw_path(const char *fwpath);
/**
+ * Set the wifi mode (0 = normal, 1 = ap)
+ */
+int wifi_set_mode(int mode);
+
+/**
* Check and create if necessary initial entropy file
*/
#define WIFI_ENTROPY_FILE "/data/misc/wifi/entropy.bin"
diff --git a/wifi/Android.mk b/wifi/Android.mk
index 32e0e32..c06a39c 100644
--- a/wifi/Android.mk
+++ b/wifi/Android.mk
@@ -6,6 +6,9 @@ endif
ifdef WIFI_DRIVER_MODULE_ARG
LOCAL_CFLAGS += -DWIFI_DRIVER_MODULE_ARG=\"$(WIFI_DRIVER_MODULE_ARG)\"
endif
+ifdef WIFI_DRIVER_MODULE_AP_ARG
+LOCAL_CFLAGS += -DWIFI_DRIVER_MODULE_AP_ARG=\"$(WIFI_DRIVER_MODULE_AP_ARG)\"
+endif
ifdef WIFI_DRIVER_MODULE_NAME
LOCAL_CFLAGS += -DWIFI_DRIVER_MODULE_NAME=\"$(WIFI_DRIVER_MODULE_NAME)\"
endif
diff --git a/wifi/wifi.c b/wifi/wifi.c
index 7418fb1..fc1b400 100644
--- a/wifi/wifi.c
+++ b/wifi/wifi.c
@@ -81,6 +81,7 @@ static struct wpa_ctrl *monitor_conn;
/* socket pair used to exit from a blocking read */
static int exit_sockets[2];
+static int wifi_mode = 0;
static char primary_iface[PROPERTY_VALUE_MAX];
// TODO: use new ANDROID_SOCKET mechanism, once support for multiple
@@ -96,6 +97,9 @@ struct genl_family *nl80211;
#ifndef WIFI_DRIVER_MODULE_ARG
#define WIFI_DRIVER_MODULE_ARG ""
#endif
+#ifndef WIFI_DRIVER_MODULE_AP_ARG
+#define WIFI_DRIVER_MODULE_AP_ARG ""
+#endif
#ifndef WIFI_FIRMWARE_LOADER
#define WIFI_FIRMWARE_LOADER ""
#endif
@@ -123,6 +127,7 @@ static const char DRIVER_MODULE_NAME[] = WIFI_DRIVER_MODULE_NAME;
static const char DRIVER_MODULE_TAG[] = WIFI_DRIVER_MODULE_NAME " ";
static const char DRIVER_MODULE_PATH[] = WIFI_DRIVER_MODULE_PATH;
static const char DRIVER_MODULE_ARG[] = WIFI_DRIVER_MODULE_ARG;
+static const char DRIVER_MODULE_AP_ARG[] = WIFI_DRIVER_MODULE_AP_ARG;
#endif
static const char FIRMWARE_LOADER[] = WIFI_FIRMWARE_LOADER;
static const char DRIVER_PROP_NAME[] = "wlan.driver.status";
@@ -303,8 +308,16 @@ int wifi_load_driver()
char module_arg2[256];
#ifdef SAMSUNG_WIFI
+#ifdef WIFI_DRIVER_MODULE_AP_ARG
+ if (wifi_mode == 1) {
+ snprintf(module_arg2, sizeof(module_arg2), DRIVER_MODULE_AP_ARG);
+ } else {
+ snprintf(module_arg2, sizeof(module_arg2), DRIVER_MODULE_ARG);
+ }
+#else
char* type = get_samsung_wifi_type();
snprintf(module_arg2, sizeof(module_arg2), "%s%s", DRIVER_MODULE_ARG, type == NULL ? "" : type);
+#endif
if (insmod(DRIVER_MODULE_PATH, module_arg2) < 0) {
#else
@@ -1123,3 +1136,8 @@ int wifi_change_fw_path(const char *fwpath)
close(fd);
return ret;
}
+
+int wifi_set_mode(int mode) {
+ wifi_mode = mode;
+ return 0;
+}