diff options
Diffstat (limited to 'wifi')
-rw-r--r-- | wifi/Android.mk | 3 | ||||
-rw-r--r-- | wifi/wifi.c | 26 |
2 files changed, 29 insertions, 0 deletions
diff --git a/wifi/Android.mk b/wifi/Android.mk index 8455d26..b4a6a7c 100644 --- a/wifi/Android.mk +++ b/wifi/Android.mk @@ -24,6 +24,9 @@ endif ifdef WIFI_DRIVER_FW_PATH_P2P LOCAL_CFLAGS += -DWIFI_DRIVER_FW_PATH_P2P=\"$(WIFI_DRIVER_FW_PATH_P2P)\" endif +ifdef WIFI_DRIVER_FW_PATH_PARAM +LOCAL_CFLAGS += -DWIFI_DRIVER_FW_PATH_PARAM=\"$(WIFI_DRIVER_FW_PATH_PARAM)\" +endif LOCAL_SRC_FILES += wifi/wifi.c diff --git a/wifi/wifi.c b/wifi/wifi.c index 2591a23..fda81be 100644 --- a/wifi/wifi.c +++ b/wifi/wifi.c @@ -67,6 +67,10 @@ static char iface[PROPERTY_VALUE_MAX]; #define WIFI_DRIVER_FW_PATH_P2P NULL #endif +#ifndef WIFI_DRIVER_FW_PATH_PARAM +#define WIFI_DRIVER_FW_PATH_PARAM "/sys/module/wlan/parameters/fwpath" +#endif + #define WIFI_DRIVER_LOADER_DELAY 1000000 static const char IFACE_DIR[] = "/data/system/wpa_supplicant"; @@ -627,3 +631,25 @@ const char *wifi_get_fw_path(int fw_type) } return NULL; } + +int wifi_change_fw_path(const char *fwpath) +{ + int len; + int fd; + int ret = 0; + + if (!fwpath) + return ret; + fd = open(WIFI_DRIVER_FW_PATH_PARAM, O_WRONLY); + if (fd < 0) { + LOGE("Failed to open wlan fw path param (%s)", strerror(errno)); + return -1; + } + len = strlen(fwpath) + 1; + if (write(fd, fwpath, len) != len) { + LOGE("Failed to write wlan fw path param (%s)", strerror(errno)); + ret = -1; + } + close(fd); + return ret; +} |