summaryrefslogtreecommitdiffstats
path: root/libwifi_hal
diff options
context:
space:
mode:
authorAhmed ElArabawy <arabawy@google.com>2018-06-05 10:45:53 -0700
committerAhmed ElArabawy <arabawy@google.com>2018-08-20 17:54:11 +0000
commit708d500e48c78ac59b9d9819afb7a85ebe24a214 (patch)
treee70b5c82b6c40f8d5a58f29a2c7e4f6244c32265 /libwifi_hal
parent4da60b5fbb97f95f7fc3afc03d79a51985bf1298 (diff)
downloadandroid_frameworks_opt_net_wifi-708d500e48c78ac59b9d9819afb7a85ebe24a214.tar.gz
android_frameworks_opt_net_wifi-708d500e48c78ac59b9d9819afb7a85ebe24a214.tar.bz2
android_frameworks_opt_net_wifi-708d500e48c78ac59b9d9819afb7a85ebe24a214.zip
Wifi: Remove early setting of driver status to ok
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 removes this early setting of the property. Another change will set it once the driver is fully operational. The 'ok' state is reached when the driver is checked for readiness (which is a vendor specific operation). Bug: 111924712 Test: Manual test Change-Id: I0aba15fa613b52589ce20bbc6209d5775925c8d4 Signed-off-by: Ahmed ElArabawy <arabawy@google.com>
Diffstat (limited to 'libwifi_hal')
-rw-r--r--libwifi_hal/wifi_hal_common.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/libwifi_hal/wifi_hal_common.cpp b/libwifi_hal/wifi_hal_common.cpp
index 413daf7da..d4774bda7 100644
--- a/libwifi_hal/wifi_hal_common.cpp
+++ b/libwifi_hal/wifi_hal_common.cpp
@@ -43,6 +43,7 @@ extern "C" int delete_module(const char *, unsigned int);
#endif
static const char DRIVER_PROP_NAME[] = "wlan.driver.status";
+static bool is_driver_loaded = false;
#ifdef WIFI_DRIVER_MODULE_PATH
static const char DRIVER_MODULE_NAME[] = WIFI_DRIVER_MODULE_NAME;
static const char DRIVER_MODULE_TAG[] = WIFI_DRIVER_MODULE_NAME " ";
@@ -117,10 +118,14 @@ int is_wifi_driver_loaded() {
char line[sizeof(DRIVER_MODULE_TAG) + 10];
#endif
- if (!property_get(DRIVER_PROP_NAME, driver_status, NULL) ||
- strcmp(driver_status, "ok") != 0) {
+ if (!property_get(DRIVER_PROP_NAME, driver_status, NULL)) {
return 0; /* driver not loaded */
}
+
+ if (!is_driver_loaded) {
+ return 0;
+ } /* driver not loaded */
+
#ifdef WIFI_DRIVER_MODULE_PATH
/*
* If the property says the driver is loaded, check to
@@ -130,7 +135,10 @@ int is_wifi_driver_loaded() {
*/
if ((proc = fopen(MODULE_FILE, "r")) == NULL) {
PLOG(WARNING) << "Could not open " << MODULE_FILE;
- property_set(DRIVER_PROP_NAME, "unloaded");
+ is_driver_loaded = false;
+ if (strcmp(driver_status, "unloaded") != 0) {
+ property_set(DRIVER_PROP_NAME, "unloaded");
+ }
return 0;
}
while ((fgets(line, sizeof(line), proc)) != NULL) {
@@ -140,7 +148,10 @@ int is_wifi_driver_loaded() {
}
}
fclose(proc);
- property_set(DRIVER_PROP_NAME, "unloaded");
+ is_driver_loaded = false;
+ if (strcmp(driver_status, "unloaded") != 0) {
+ property_set(DRIVER_PROP_NAME, "unloaded");
+ }
return 0;
#else
return 1;
@@ -163,7 +174,7 @@ int wifi_load_driver() {
if (wifi_change_driver_state(WIFI_DRIVER_STATE_ON) < 0) return -1;
#endif
- property_set(DRIVER_PROP_NAME, "ok");
+ is_driver_loaded = true;
return 0;
}
@@ -192,6 +203,7 @@ int wifi_unload_driver() {
if (wifi_change_driver_state(WIFI_DRIVER_STATE_OFF) < 0) return -1;
}
#endif
+ is_driver_loaded = false;
property_set(DRIVER_PROP_NAME, "unloaded");
return 0;
#endif