Wifi: Set wlan.driver.status to 'ok' when ready
Currently, the wlan.driver.status property is set to 'ok' once the
driver is loaded. This is not accurate, cause having the driver loaded
does not necessarily means it is ready for operation.
This commit sets the driver to 'ok' state after it is checked for
readiness. This implementation of the check is device specific.
Bug: 111924712
Test: Manual test
Change-Id: I074d819e9acdfdd6f033d85cdd71c0bc3984eb9d
Signed-off-by: Ahmed ElArabawy <arabawy@google.com>
diff --git a/wifi/1.3/default/wifi_legacy_hal.cpp b/wifi/1.3/default/wifi_legacy_hal.cpp
index 55fe073..817c860 100644
--- a/wifi/1.3/default/wifi_legacy_hal.cpp
+++ b/wifi/1.3/default/wifi_legacy_hal.cpp
@@ -18,6 +18,7 @@
#include <chrono>
#include <android-base/logging.h>
+#include <cutils/properties.h>
#include "hidl_sync_util.h"
#include "wifi_legacy_hal.h"
@@ -35,6 +36,7 @@
static constexpr uint32_t kMaxWakeReasonStatsArraySize = 32;
static constexpr uint32_t kMaxRingBuffers = 10;
static constexpr uint32_t kMaxStopCompleteWaitMs = 100;
+static constexpr char kDriverPropName[] = "wlan.driver.status";
// Helper function to create a non-const char* for legacy Hal API's.
std::vector<char> makeCharVec(const std::string& str) {
@@ -366,6 +368,8 @@
LOG(ERROR) << "Timed out awaiting driver ready";
return status;
}
+ property_set(kDriverPropName, "ok");
+
LOG(DEBUG) << "Starting legacy HAL";
if (!iface_tool_.SetWifiUpState(true)) {
LOG(ERROR) << "Failed to set WiFi interface up";