summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2018-04-29 07:20:33 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2018-04-29 07:20:33 +0000
commitd82404483179ee21231e76768e4a705884ade2af (patch)
tree39b3dcca5a978c515dd4f01194f7150188347359
parent627d70f2a07926030a157caee4e6f32412bcc803 (diff)
parent23a2406046c232e1b11ba3ccaf1b4aed73f06c30 (diff)
downloadhardware_replicant_wlan-d82404483179ee21231e76768e4a705884ade2af.tar.gz
hardware_replicant_wlan-d82404483179ee21231e76768e4a705884ade2af.tar.bz2
hardware_replicant_wlan-d82404483179ee21231e76768e4a705884ade2af.zip
Snap for 4751833 from 23a2406046c232e1b11ba3ccaf1b4aed73f06c30 to pi-release
Change-Id: Iaf69c52a9585aa442f30659c8a549ca08e194917
-rw-r--r--bcmdhd/wifi_hal/wifi_hal.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/bcmdhd/wifi_hal/wifi_hal.cpp b/bcmdhd/wifi_hal/wifi_hal.cpp
index 511ff3f..81cad8a 100644
--- a/bcmdhd/wifi_hal/wifi_hal.cpp
+++ b/bcmdhd/wifi_hal/wifi_hal.cpp
@@ -60,6 +60,13 @@
#define WIFI_HAL_CMD_SOCK_PORT 644
#define WIFI_HAL_EVENT_SOCK_PORT 645
+/*
+ * Defines for wifi_wait_for_driver_ready()
+ * Specify durations between polls and max wait time
+ */
+#define POLL_DRIVER_DURATION_US (100000)
+#define POLL_DRIVER_MAX_TIME_MS (10000)
+
static void internal_event_handler(wifi_handle handle, int events);
static int internal_no_seq_check(nl_msg *msg, void *arg);
static int internal_valid_message_handler(nl_msg *msg, void *arg);
@@ -151,6 +158,7 @@ wifi_error init_wifi_vendor_hal_func_table(wifi_hal_fn *fn)
return WIFI_ERROR_UNKNOWN;
}
fn->wifi_initialize = wifi_initialize;
+ fn->wifi_wait_for_driver_ready = wifi_wait_for_driver_ready;
fn->wifi_cleanup = wifi_cleanup;
fn->wifi_event_loop = wifi_event_loop;
fn->wifi_get_supported_feature_set = wifi_get_supported_feature_set;
@@ -306,6 +314,25 @@ wifi_error wifi_initialize(wifi_handle *handle)
return WIFI_SUCCESS;
}
+wifi_error wifi_wait_for_driver_ready(void)
+{
+ // This function will wait to make sure basic client netdev is created
+ // Function times out after 10 seconds
+ int count = (POLL_DRIVER_MAX_TIME_MS * 1000) / POLL_DRIVER_DURATION_US;
+ FILE *fd;
+
+ do {
+ if ((fd = fopen("/sys/class/net/wlan0", "r")) != NULL) {
+ fclose(fd);
+ return WIFI_SUCCESS;
+ }
+ usleep(POLL_DRIVER_DURATION_US);
+ } while(--count > 0);
+
+ ALOGE("Timed out waiting on Driver ready ... ");
+ return WIFI_ERROR_TIMED_OUT;
+}
+
static int wifi_add_membership(wifi_handle handle, const char *group)
{
hal_info *info = getHalInfo(handle);