[rdk-b][mt7986][wifi-hal][Refactor getRadioEnable]
[Description]
Refactor getRadioEnable. When radio status is scanning, also seem the radio is enable.
[Release-log]
N/A
Change-Id: Ic035f8ea9493a92e96c662b3fc91cece8abb99a2
diff --git a/src/wifi/wifi_hal.c b/src/wifi/wifi_hal.c
index 452a479..ba4b327 100644
--- a/src/wifi/wifi_hal.c
+++ b/src/wifi/wifi_hal.c
@@ -1024,13 +1024,18 @@
snprintf(interface_path, sizeof(interface_path), "/sys/class/net/%s%d/address", RADIO_PREFIX, radioIndex);
fp = fopen(interface_path, "r");
- if(fp)
+ if(!fp)
{
- *output_bool = TRUE;
- fclose(fp);
+ return RETURN_ERR;
}
//TODO: check if hostapd with config is running
+ char buf[MAX_BUF_SIZE] = {0}, cmd[MAX_CMD_SIZE] = {0};
+ sprintf(cmd, "hostapd_cli -i %s%d status | grep state | cut -d '=' -f2", AP_PREFIX, radioIndex);
+ _syscmd(cmd, buf, sizeof(buf));
+ if(strncmp(buf, "ENABLED", 7) == 0 || strncmp(buf, "ACS", 3) == 0 || strncmp(buf, "HT_SCAN", 7) == 0 || strncmp(buf, "DFS", 3) == 0)
+ *output_bool = TRUE;
+ fclose(fp);
return RETURN_OK;
}