summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRicardo Cerqueira <cyanogenmod@cerqueira.org>2013-11-01 20:35:09 +0000
committerSteve Kondik <steve@cyngn.com>2015-10-26 15:49:35 -0700
commit12374d726faeb2aaa87d4e22a6558ca24d0c8695 (patch)
tree180b5373da62deb71a2d411f7bf4145892ded828
parent1726a291a0f27e2df7fd7fdb9be8cdcd5ea9bdb3 (diff)
downloadhardware_libhardware_legacy-12374d726faeb2aaa87d4e22a6558ca24d0c8695.zip
hardware_libhardware_legacy-12374d726faeb2aaa87d4e22a6558ca24d0c8695.tar.gz
hardware_libhardware_legacy-12374d726faeb2aaa87d4e22a6558ca24d0c8695.tar.bz2
wifi: Choose correct nvram file on samsung hardware
Change-Id: I9d428ae61c1ce80d97e6ea513839ed64e8f61440
-rw-r--r--wifi/Android.mk5
-rw-r--r--wifi/wifi.c42
2 files changed, 43 insertions, 4 deletions
diff --git a/wifi/Android.mk b/wifi/Android.mk
index 6421b4a..32e0e32 100644
--- a/wifi/Android.mk
+++ b/wifi/Android.mk
@@ -51,4 +51,9 @@ ifdef WPA_SUPPLICANT_VERSION
LOCAL_CFLAGS += -DLIBWPA_CLIENT_EXISTS
LOCAL_SHARED_LIBRARIES += libwpa_client
endif
+
+ifeq ($(BOARD_HAVE_SAMSUNG_WIFI),true)
+LOCAL_CFLAGS += -DSAMSUNG_WIFI
+endif
+
LOCAL_SHARED_LIBRARIES += libnetutils
diff --git a/wifi/wifi.c b/wifi/wifi.c
index cc76d21..7418fb1 100644
--- a/wifi/wifi.c
+++ b/wifi/wifi.c
@@ -151,6 +151,31 @@ static char supplicant_name[PROPERTY_VALUE_MAX];
/* Is either SUPP_PROP_NAME or P2P_PROP_NAME */
static char supplicant_prop_name[PROPERTY_KEY_MAX];
+#ifdef SAMSUNG_WIFI
+char* get_samsung_wifi_type()
+{
+ char buf[10];
+ int fd = open("/data/.cid.info", O_RDONLY);
+ if (fd < 0)
+ return NULL;
+
+ if (read(fd, buf, sizeof(buf)) < 0) {
+ close(fd);
+ return NULL;
+ }
+
+ close(fd);
+
+ if (strncmp(buf, "murata", 6) == 0)
+ return "_murata";
+
+ if (strncmp(buf, "semcove", 7) == 0)
+ return "_semcove";
+
+ return NULL;
+}
+#endif
+
int insmod(const char *filename, const char *args)
{
void *module;
@@ -275,13 +300,22 @@ int wifi_load_driver()
#ifdef WIFI_DRIVER_MODULE_PATH
char driver_status[PROPERTY_VALUE_MAX];
int count = 100; /* wait at most 20 seconds for completion */
+ char module_arg2[256];
- if (is_wifi_driver_loaded()) {
- return 0;
- }
+#ifdef SAMSUNG_WIFI
+ char* type = get_samsung_wifi_type();
+ snprintf(module_arg2, sizeof(module_arg2), "%s%s", DRIVER_MODULE_ARG, type == NULL ? "" : type);
- if (insmod(DRIVER_MODULE_PATH, DRIVER_MODULE_ARG) < 0)
+ if (insmod(DRIVER_MODULE_PATH, module_arg2) < 0) {
+#else
+ if (insmod(DRIVER_MODULE_PATH, DRIVER_MODULE_ARG) < 0) {
+#endif
+
+#ifdef WIFI_EXT_MODULE_NAME
+ rmmod(EXT_MODULE_NAME);
+#endif
return -1;
+ }
if (strcmp(FIRMWARE_LOADER,"") == 0) {
/* usleep(WIFI_DRIVER_LOADER_DELAY); */