| From 801018bbcf3427713997b1ead85fec6c9acaf2bb Mon Sep 17 00:00:00 2001 |
| From: "howard.hsu" <howard-yh.hsu@mediatek.com> |
| Date: Wed, 6 Apr 2022 09:20:37 +0800 |
| Subject: [PATCH] HAL: refactor wifi_getRadioEnable() |
| |
| --- |
| source/wifi/wifi_hal.c | 11 ++++++++--- |
| 1 file changed, 8 insertions(+), 3 deletions(-) |
| |
| diff --git a/source/wifi/wifi_hal.c b/source/wifi/wifi_hal.c |
| index 1d07d19..c753d99 100644 |
| --- a/source/wifi/wifi_hal.c |
| +++ b/source/wifi/wifi_hal.c |
| @@ -1025,13 +1025,18 @@ INT wifi_getRadioEnable(INT radioIndex, BOOL *output_bool) //RDKB |
| |
| 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_OK; |
| } |
| //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)) |
| + *output_bool = TRUE; |
| + fclose(fp); |
| return RETURN_OK; |
| } |
| |
| -- |
| 2.18.0 |
| |