WiFi: Wait for driver to be ready before operation
This commit calls a vendor hal function to wait for the driver to be
ready before it resumes operation. This ensures the driver is ready
and interfaces are created before framework tries to use them.
Bug: 73482286
Test: Manual test (reboot and make sure wifi comes up consistently)
Test: The reboot test has been performed more than 10 times in a row
Test: Also, tested toggling wifi off/on then rebooted, wifi starts fine
Change-Id: I868dac6dbaa0a5248ae6e35d4ba915bc0c4de6eb
Signed-off-by: Ahmed ElArabawy <arabawy@google.com>
diff --git a/wifi/1.2/default/wifi_legacy_hal.cpp b/wifi/1.2/default/wifi_legacy_hal.cpp
index 5f40d50..84af9c4 100644
--- a/wifi/1.2/default/wifi_legacy_hal.cpp
+++ b/wifi/1.2/default/wifi_legacy_hal.cpp
@@ -360,12 +360,18 @@
LOG(DEBUG) << "Legacy HAL already started";
return WIFI_SUCCESS;
}
+ LOG(DEBUG) << "Waiting for the driver ready";
+ wifi_error status = global_func_table_.wifi_wait_for_driver_ready();
+ if (status == WIFI_ERROR_TIMED_OUT) {
+ LOG(ERROR) << "Timed out awaiting driver ready";
+ return status;
+ }
LOG(DEBUG) << "Starting legacy HAL";
if (!iface_tool_.SetWifiUpState(true)) {
LOG(ERROR) << "Failed to set WiFi interface up";
return WIFI_ERROR_UNKNOWN;
}
- wifi_error status = global_func_table_.wifi_initialize(&global_handle_);
+ status = global_func_table_.wifi_initialize(&global_handle_);
if (status != WIFI_SUCCESS || !global_handle_) {
LOG(ERROR) << "Failed to retrieve global handle";
return status;