blob: e2a4720d9ce442b52671e73be725bb2fa98b3709 [file] [log] [blame]
developer3b7aaa72022-07-15 11:55:52 +08001From 801018bbcf3427713997b1ead85fec6c9acaf2bb Mon Sep 17 00:00:00 2001
2From: "howard.hsu" <howard-yh.hsu@mediatek.com>
3Date: Wed, 6 Apr 2022 09:20:37 +0800
4Subject: [PATCH] HAL: refactor wifi_getRadioEnable()
5
6---
7 source/wifi/wifi_hal.c | 11 ++++++++---
8 1 file changed, 8 insertions(+), 3 deletions(-)
9
10diff --git a/source/wifi/wifi_hal.c b/source/wifi/wifi_hal.c
11index 1d07d19..c753d99 100644
12--- a/source/wifi/wifi_hal.c
13+++ b/source/wifi/wifi_hal.c
14@@ -1025,13 +1025,18 @@ INT wifi_getRadioEnable(INT radioIndex, BOOL *output_bool) //RDKB
15
16 snprintf(interface_path, sizeof(interface_path), "/sys/class/net/%s%d/address", RADIO_PREFIX, radioIndex);
17 fp = fopen(interface_path, "r");
18- if(fp)
19+ if(!fp)
20 {
21- *output_bool = TRUE;
22- fclose(fp);
23+ return RETURN_OK;
24 }
25 //TODO: check if hostapd with config is running
26+ char buf[MAX_BUF_SIZE] = {0}, cmd[MAX_CMD_SIZE] = {0};
27+ sprintf(cmd, "hostapd_cli -i %s%d status | grep state | cut -d '=' -f2", AP_PREFIX, radioIndex);
28+ _syscmd(cmd, buf, sizeof(buf));
29
30+ if(!strncmp(buf, "ENABLED", 7))
31+ *output_bool = TRUE;
32+ fclose(fp);
33 return RETURN_OK;
34 }
35
36--
372.18.0
38