| diff --git a/hardware/libhardware_legacy/wifi/wifi.c b/hardware/libhardware_legacy/wifi/wifi.c |
| old mode 100644 |
| new mode 100755 |
| index 880f6fc..7e9aa80 |
| --- a/hardware/libhardware_legacy/wifi/wifi.c |
| +++ b/hardware/libhardware_legacy/wifi/wifi.c |
| @@ -33,17 +33,17 @@ |
| #include "cutils/log.h" |
| #include "cutils/memory.h" |
| #include "cutils/misc.h" |
| -#include "cutils/properties.h" |
| +//#include "cutils/properties.h" |
| #include "private/android_filesystem_config.h" |
| |
| #define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_ |
| -#include <sys/_system_properties.h> |
| +//#include <sys/_system_properties.h> |
| |
| -extern int do_dhcp(); |
| +//extern int do_dhcp(); |
| extern int ifc_init(); |
| extern void ifc_close(); |
| -extern char *dhcp_lasterror(); |
| -extern void get_dhcp_info(); |
| +//extern char *dhcp_lasterror(); |
| +//extern void get_dhcp_info(); |
| extern int init_module(void *, unsigned long, const char *); |
| extern int delete_module(const char *, unsigned int); |
| void wifi_close_sockets(); |
| @@ -64,6 +64,9 @@ int wpa_ctrl_recv(struct wpa_ctrl *ctrl, char *reply, size_t *reply_len) |
| int wpa_ctrl_get_fd(struct wpa_ctrl *ctrl) { return 0; } |
| #endif |
| |
| +#define PROPERTY_VALUE_MAX 100 |
| +#define PROPERTY_KEY_MAX 100 |
| + |
| static struct wpa_ctrl *ctrl_conn; |
| static struct wpa_ctrl *monitor_conn; |
| |
| @@ -168,6 +171,7 @@ static int rmmod(const char *modname) |
| return ret; |
| } |
| |
| +#if 0 |
| int do_dhcp_request(int *ipaddr, int *gateway, int *mask, |
| int *dns1, int *dns2, int *server, int *lease) { |
| /* For test driver, always report success */ |
| @@ -189,6 +193,7 @@ int do_dhcp_request(int *ipaddr, int *gateway, int *mask, |
| const char *get_dhcp_error_string() { |
| return dhcp_lasterror(); |
| } |
| +#endif |
| |
| #ifdef WIFI_DRIVER_STATE_CTRL_PARAM |
| int wifi_change_driver_state(const char *state) |
| @@ -199,13 +204,13 @@ int wifi_change_driver_state(const char *state) |
| |
| if (!state) |
| return -1; |
| - fd = TEMP_FAILURE_RETRY(open(WIFI_DRIVER_STATE_CTRL_PARAM, O_WRONLY)); |
| + fd = (open(WIFI_DRIVER_STATE_CTRL_PARAM, O_WRONLY); |
| if (fd < 0) { |
| ALOGE("Failed to open driver state control param (%s)", strerror(errno)); |
| return -1; |
| } |
| len = strlen(state) + 1; |
| - if (TEMP_FAILURE_RETRY(write(fd, state, len)) != len) { |
| + if ((write(fd, state, len)) != len) { |
| ALOGE("Failed to write driver state control param (%s)", strerror(errno)); |
| ret = -1; |
| } |
| @@ -221,8 +226,8 @@ int is_wifi_driver_loaded() { |
| char line[sizeof(DRIVER_MODULE_TAG)+10]; |
| #endif |
| |
| - if (!property_get(DRIVER_PROP_NAME, driver_status, NULL) |
| - || strcmp(driver_status, "ok") != 0) { |
| + if (!/*property_get(DRIVER_PROP_NAME, driver_status, NULL) |
| + || */strcmp(driver_status, "ok") != 0) { |
| return 0; /* driver not loaded */ |
| } |
| #ifdef WIFI_DRIVER_MODULE_PATH |
| @@ -234,7 +239,7 @@ int is_wifi_driver_loaded() { |
| */ |
| if ((proc = fopen(MODULE_FILE, "r")) == NULL) { |
| ALOGW("Could not open %s: %s", MODULE_FILE, strerror(errno)); |
| - property_set(DRIVER_PROP_NAME, "unloaded"); |
| + //property_set(DRIVER_PROP_NAME, "unloaded"); |
| return 0; |
| } |
| while ((fgets(line, sizeof(line), proc)) != NULL) { |
| @@ -244,7 +249,7 @@ int is_wifi_driver_loaded() { |
| } |
| } |
| fclose(proc); |
| - property_set(DRIVER_PROP_NAME, "unloaded"); |
| + //property_set(DRIVER_PROP_NAME, "unloaded"); |
| return 0; |
| #else |
| return 1; |
| @@ -266,14 +271,14 @@ int wifi_load_driver() |
| |
| if (strcmp(FIRMWARE_LOADER,"") == 0) { |
| /* usleep(WIFI_DRIVER_LOADER_DELAY); */ |
| - property_set(DRIVER_PROP_NAME, "ok"); |
| + //property_set(DRIVER_PROP_NAME, "ok"); |
| } |
| else { |
| - property_set("ctl.start", FIRMWARE_LOADER); |
| + //property_set("ctl.start", FIRMWARE_LOADER); |
| } |
| sched_yield(); |
| while (count-- > 0) { |
| - if (property_get(DRIVER_PROP_NAME, driver_status, NULL)) { |
| + if (/*property_get(DRIVER_PROP_NAME, driver_status, NULL)*/) { |
| if (strcmp(driver_status, "ok") == 0) |
| return 0; |
| else if (strcmp(driver_status, "failed") == 0) { |
| @@ -283,7 +288,7 @@ int wifi_load_driver() |
| } |
| usleep(200000); |
| } |
| - property_set(DRIVER_PROP_NAME, "timeout"); |
| + //property_set(DRIVER_PROP_NAME, "timeout"); |
| wifi_unload_driver(); |
| return -1; |
| #else |
| @@ -295,7 +300,7 @@ int wifi_load_driver() |
| if (wifi_change_driver_state(WIFI_DRIVER_STATE_ON) < 0) |
| return -1; |
| #endif |
| - property_set(DRIVER_PROP_NAME, "ok"); |
| + //property_set(DRIVER_PROP_NAME, "ok"); |
| return 0; |
| #endif |
| } |
| @@ -325,7 +330,7 @@ int wifi_unload_driver() |
| return -1; |
| } |
| #endif |
| - property_set(DRIVER_PROP_NAME, "unloaded"); |
| + //property_set(DRIVER_PROP_NAME, "unloaded"); |
| return 0; |
| #endif |
| } |
| @@ -344,13 +349,13 @@ int ensure_entropy_file_exists() |
| } |
| return 0; |
| } |
| - destfd = TEMP_FAILURE_RETRY(open(SUPP_ENTROPY_FILE, O_CREAT|O_RDWR, 0660)); |
| + destfd = (open(SUPP_ENTROPY_FILE, O_CREAT|O_RDWR, 0660)); |
| if (destfd < 0) { |
| ALOGE("Cannot create \"%s\": %s", SUPP_ENTROPY_FILE, strerror(errno)); |
| return -1; |
| } |
| |
| - if (TEMP_FAILURE_RETRY(write(destfd, dummy_key, sizeof(dummy_key))) != sizeof(dummy_key)) { |
| + if ((write(destfd, dummy_key, sizeof(dummy_key))) != sizeof(dummy_key)) { |
| ALOGE("Error writing \"%s\": %s", SUPP_ENTROPY_FILE, strerror(errno)); |
| close(destfd); |
| return -1; |
| @@ -395,20 +400,20 @@ int ensure_config_file_exists(const char *config_file) |
| return -1; |
| } |
| |
| - srcfd = TEMP_FAILURE_RETRY(open(SUPP_CONFIG_TEMPLATE, O_RDONLY)); |
| + srcfd = (open(SUPP_CONFIG_TEMPLATE, O_RDONLY)); |
| if (srcfd < 0) { |
| ALOGE("Cannot open \"%s\": %s", SUPP_CONFIG_TEMPLATE, strerror(errno)); |
| return -1; |
| } |
| |
| - destfd = TEMP_FAILURE_RETRY(open(config_file, O_CREAT|O_RDWR, 0660)); |
| + destfd = (open(config_file, O_CREAT|O_RDWR, 0660)); |
| if (destfd < 0) { |
| close(srcfd); |
| ALOGE("Cannot create \"%s\": %s", config_file, strerror(errno)); |
| return -1; |
| } |
| |
| - while ((nread = TEMP_FAILURE_RETRY(read(srcfd, buf, sizeof(buf)))) != 0) { |
| + while ((nread = (read(srcfd, buf, sizeof(buf)))) != 0) { |
| if (nread < 0) { |
| ALOGE("Error reading \"%s\": %s", SUPP_CONFIG_TEMPLATE, strerror(errno)); |
| close(srcfd); |
| @@ -416,7 +421,7 @@ int ensure_config_file_exists(const char *config_file) |
| unlink(config_file); |
| return -1; |
| } |
| - TEMP_FAILURE_RETRY(write(destfd, buf, nread)); |
| + (write(destfd, buf, nread)); |
| } |
| |
| close(destfd); |
| @@ -443,7 +448,7 @@ int wifi_start_supplicant(int p2p_supported) |
| { |
| char supp_status[PROPERTY_VALUE_MAX] = {'\0'}; |
| int count = 200; /* wait at most 20 seconds for completion */ |
| - const prop_info *pi; |
| + //const prop_info *pi; |
| unsigned serial = 0, i; |
| |
| if (p2p_supported) { |
| @@ -462,8 +467,8 @@ int wifi_start_supplicant(int p2p_supported) |
| } |
| |
| /* Check whether already running */ |
| - if (property_get(supplicant_prop_name, supp_status, NULL) |
| - && strcmp(supp_status, "running") == 0) { |
| + if (/*property_get(supplicant_prop_name, supp_status, NULL) |
| + && */strcmp(supp_status, "running") == 0) { |
| return 0; |
| } |
| |
| @@ -490,23 +495,20 @@ int wifi_start_supplicant(int p2p_supported) |
| * it starts in the stopped state and never manages to start |
| * running at all. |
| */ |
| - pi = __system_property_find(supplicant_prop_name); |
| + /*pi = __system_property_find(supplicant_prop_name); |
| if (pi != NULL) { |
| serial = __system_property_serial(pi); |
| - } |
| - property_get("wifi.interface", primary_iface, WIFI_TEST_INTERFACE); |
| + }*/ |
| + //property_get("wifi.interface", primary_iface, WIFI_TEST_INTERFACE); |
| |
| - property_set("ctl.start", supplicant_name); |
| + //property_set("ctl.start", supplicant_name); |
| sched_yield(); |
| - |
| +/* |
| while (count-- > 0) { |
| if (pi == NULL) { |
| pi = __system_property_find(supplicant_prop_name); |
| } |
| if (pi != NULL) { |
| - /* |
| - * property serial updated means that init process is scheduled |
| - * after we sched_yield, further property status checking is based on this */ |
| if (__system_property_serial(pi) != serial) { |
| __system_property_read(pi, NULL, supp_status); |
| if (strcmp(supp_status, "running") == 0) { |
| @@ -517,7 +519,7 @@ int wifi_start_supplicant(int p2p_supported) |
| } |
| } |
| usleep(100000); |
| - } |
| + }*/ |
| return -1; |
| } |
| |
| @@ -535,16 +537,16 @@ int wifi_stop_supplicant(int p2p_supported) |
| } |
| |
| /* Check whether supplicant already stopped */ |
| - if (property_get(supplicant_prop_name, supp_status, NULL) |
| - && strcmp(supp_status, "stopped") == 0) { |
| + if (/*property_get(supplicant_prop_name, supp_status, NULL) |
| + &&*/ strcmp(supp_status, "stopped") == 0) { |
| return 0; |
| } |
| |
| - property_set("ctl.stop", supplicant_name); |
| + //property_set("ctl.stop", supplicant_name); |
| sched_yield(); |
| |
| while (count-- > 0) { |
| - if (property_get(supplicant_prop_name, supp_status, NULL)) { |
| + if (/*property_get(supplicant_prop_name, supp_status, NULL)*/1) { |
| if (strcmp(supp_status, "stopped") == 0) |
| return 0; |
| } |
| @@ -559,8 +561,8 @@ int wifi_connect_on_socket_path(const char *path) |
| char supp_status[PROPERTY_VALUE_MAX] = {'\0'}; |
| |
| /* Make sure supplicant is running */ |
| - if (!property_get(supplicant_prop_name, supp_status, NULL) |
| - || strcmp(supp_status, "running") != 0) { |
| + if (!/*property_get(supplicant_prop_name, supp_status, NULL) |
| + ||*/ strcmp(supp_status, "running") != 0) { |
| ALOGE("Supplicant not running, cannot connect"); |
| return -1; |
| } |
| @@ -618,7 +620,7 @@ int wifi_send_command(const char *cmd, char *reply, size_t *reply_len) |
| if (ret == -2) { |
| ALOGD("'%s' command timed out.\n", cmd); |
| /* unblocks the monitor receive socket for termination */ |
| - TEMP_FAILURE_RETRY(write(exit_sockets[0], "T", 1)); |
| + (write(exit_sockets[0], "T", 1)); |
| return -2; |
| } else if (ret < 0 || strncmp(reply, "FAIL", 4) == 0) { |
| return -1; |
| @@ -631,13 +633,14 @@ int wifi_send_command(const char *cmd, char *reply, size_t *reply_len) |
| |
| int wifi_supplicant_connection_active() |
| { |
| + #if 0 |
| char supp_status[PROPERTY_VALUE_MAX] = {'\0'}; |
| |
| - if (property_get(supplicant_prop_name, supp_status, NULL)) { |
| + if (/*property_get(supplicant_prop_name, supp_status, NULL)*/1) { |
| if (strcmp(supp_status, "stopped") == 0) |
| return -1; |
| } |
| - |
| + #endif |
| return 0; |
| } |
| |
| @@ -653,7 +656,7 @@ int wifi_ctrl_recv(char *reply, size_t *reply_len) |
| rfds[1].fd = exit_sockets[1]; |
| rfds[1].events |= POLLIN; |
| do { |
| - res = TEMP_FAILURE_RETRY(poll(rfds, 2, 30000)); |
| + res = (poll(rfds, 2, 30000)); |
| if (res < 0) { |
| ALOGE("Error poll = %d", res); |
| return res; |
| @@ -785,7 +788,7 @@ void wifi_close_supplicant_connection() |
| wifi_close_sockets(); |
| |
| while (count-- > 0) { |
| - if (property_get(supplicant_prop_name, supp_status, NULL)) { |
| + if (/*property_get(supplicant_prop_name, supp_status, NULL)*/1) { |
| if (strcmp(supp_status, "stopped") == 0) |
| return; |
| } |
| @@ -819,13 +822,13 @@ int wifi_change_fw_path(const char *fwpath) |
| |
| if (!fwpath) |
| return ret; |
| - fd = TEMP_FAILURE_RETRY(open(WIFI_DRIVER_FW_PATH_PARAM, O_WRONLY)); |
| + fd = (open(WIFI_DRIVER_FW_PATH_PARAM, O_WRONLY)); |
| if (fd < 0) { |
| ALOGE("Failed to open wlan fw path param (%s)", strerror(errno)); |
| return -1; |
| } |
| len = strlen(fwpath) + 1; |
| - if (TEMP_FAILURE_RETRY(write(fd, fwpath, len)) != len) { |
| + if ((write(fd, fwpath, len)) != len) { |
| ALOGE("Failed to write wlan fw path param (%s)", strerror(errno)); |
| ret = -1; |
| } |