diff options
author | Dmitry Shmidt <dimitrysh%android.com@gtempaccount.com> | 2014-05-15 16:32:02 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-05-15 16:32:02 +0000 |
commit | 6b9d0da0167ab643e09cba5743753c22e40e7fb2 (patch) | |
tree | 6da4d50bb0541eb56c5185abe791c7f5e7a3f0e3 /wifi | |
parent | 0eb0b4a31aa70754cf4c345220d1a0ae9a8d6a08 (diff) | |
parent | 9595dc8c8e07d40d606f11fedb7afb035bc87eb2 (diff) | |
download | hardware_libhardware_legacy-6b9d0da0167ab643e09cba5743753c22e40e7fb2.zip hardware_libhardware_legacy-6b9d0da0167ab643e09cba5743753c22e40e7fb2.tar.gz hardware_libhardware_legacy-6b9d0da0167ab643e09cba5743753c22e40e7fb2.tar.bz2 |
am 9595dc8c: am 4248e7c3: am a5b275c3: Merge "Changes to restart supplicant on crash"
* commit '9595dc8c8e07d40d606f11fedb7afb035bc87eb2':
Changes to restart supplicant on crash
Diffstat (limited to 'wifi')
-rw-r--r-- | wifi/wifi.c | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/wifi/wifi.c b/wifi/wifi.c index bc8d33e..87be8d8 100644 --- a/wifi/wifi.c +++ b/wifi/wifi.c @@ -602,6 +602,18 @@ int wifi_send_command(const char *cmd, char *reply, size_t *reply_len) return 0; } +int wifi_supplicant_connection_active() +{ + char supp_status[PROPERTY_VALUE_MAX] = {'\0'}; + + if (property_get(supplicant_prop_name, supp_status, NULL)) { + if (strcmp(supp_status, "stopped") == 0) + return -1; + } + + return 0; +} + int wifi_ctrl_recv(char *reply, size_t *reply_len) { int res; @@ -613,11 +625,21 @@ int wifi_ctrl_recv(char *reply, size_t *reply_len) rfds[0].events |= POLLIN; rfds[1].fd = exit_sockets[1]; rfds[1].events |= POLLIN; - res = TEMP_FAILURE_RETRY(poll(rfds, 2, -1)); - if (res < 0) { - ALOGE("Error poll = %d", res); - return res; - } + do { + res = TEMP_FAILURE_RETRY(poll(rfds, 2, 30000)); + if (res < 0) { + ALOGE("Error poll = %d", res); + return res; + } else if (res == 0) { + /* timed out, check if supplicant is active + * or not .. + */ + res = wifi_supplicant_connection_active(); + if (res < 0) + return -2; + } + } while (res == 0); + if (rfds[0].revents & POLLIN) { return wpa_ctrl_recv(monitor_conn, reply, reply_len); } |