summaryrefslogtreecommitdiffstats
path: root/wifi/wifi.c
diff options
context:
space:
mode:
Diffstat (limited to 'wifi/wifi.c')
-rw-r--r--wifi/wifi.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/wifi/wifi.c b/wifi/wifi.c
index 1b5124f..5fdf99b 100644
--- a/wifi/wifi.c
+++ b/wifi/wifi.c
@@ -57,6 +57,8 @@ static char iface[PROPERTY_VALUE_MAX];
#endif
#define WIFI_TEST_INTERFACE "sta"
+#define WIFI_DRIVER_LOADER_DELAY 1000000
+
static const char IFACE_DIR[] = "/data/system/wpa_supplicant";
static const char DRIVER_MODULE_NAME[] = WIFI_DRIVER_MODULE_NAME;
static const char DRIVER_MODULE_TAG[] = WIFI_DRIVER_MODULE_NAME " ";
@@ -150,7 +152,7 @@ int wifi_load_driver()
return -1;
if (strcmp(FIRMWARE_LOADER,"") == 0) {
- usleep(500000);
+ usleep(WIFI_DRIVER_LOADER_DELAY);
property_set(DRIVER_PROP_NAME, "ok");
}
else {
@@ -281,7 +283,7 @@ int wifi_start_supplicant()
sched_yield();
while (count-- > 0) {
- #ifdef HAVE_LIBC_SYSTEM_PROPERTIES
+#ifdef HAVE_LIBC_SYSTEM_PROPERTIES
if (pi == NULL) {
pi = __system_property_find(SUPP_PROP_NAME);
}
@@ -400,13 +402,19 @@ int wifi_wait_for_event(char *buf, size_t buflen)
struct timeval tval;
struct timeval *tptr;
- if (monitor_conn == NULL)
- return 0;
+ if (monitor_conn == NULL) {
+ LOGD("Connection closed\n");
+ strncpy(buf, WPA_EVENT_TERMINATING " - connection closed", buflen-1);
+ buf[buflen-1] = '\0';
+ return strlen(buf);
+ }
result = wpa_ctrl_recv(monitor_conn, buf, &nread);
if (result < 0) {
LOGD("wpa_ctrl_recv failed: %s\n", strerror(errno));
- return -1;
+ strncpy(buf, WPA_EVENT_TERMINATING " - recv error", buflen-1);
+ buf[buflen-1] = '\0';
+ return strlen(buf);
}
buf[nread] = '\0';
/* LOGD("wait_for_event: result=%d nread=%d string=\"%s\"\n", result, nread, buf); */