diff options
-rw-r--r-- | wifi/Android.mk | 5 | ||||
-rw-r--r-- | wifi/wifi.c | 42 |
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); */ |