Merge "[RDKB][DT][SYNC][OSBNB00182646][MTK_ASK_7.3][RC5]6GHz radio stops beaconing intermittently"
diff --git a/src/logan_wifi/wifi_hal.c b/src/logan_wifi/wifi_hal.c
index fc3a952..9d07a30 100644
--- a/src/logan_wifi/wifi_hal.c
+++ b/src/logan_wifi/wifi_hal.c
@@ -48,6 +48,7 @@
#include "wifi_hal.h"
#include <libkvcutil.h>
#include <dirent.h>
+#include <stdarg.h>
#ifdef HAL_NETLINK_IMPL
#include <errno.h>
@@ -109,6 +110,14 @@
#define ROM_LOGAN_DAT_FILE "/rom/etc/wireless/mediatek/mt7990.b"
#endif
+#ifdef ARHT_SOC
+#define ROM_SSID_ENABLE_CONFIG "/usr/wireless/hal/wifi_config"
+#define ROM_WIFI_BRLAN_CONFIG "/usr/wireless/hal/wifi_config"
+#else
+#define ROM_SSID_ENABLE_CONFIG "/rom/etc/wireless/hal/wifi_config"
+#define ROM_WIFI_BRLAN_CONFIG "/rom/etc/wireless/hal/wifi_config"
+#endif
+
#define SSID_ENABLE_CONFIG "/etc/wireless/hal/wifi_config"
#define WIFI_BRLAN_CONFIG "/etc/wireless/hal/wifi_config"
@@ -168,9 +177,76 @@
DEBUG_ERROR = 1,
DEBUG_WARN = 2,
DEBUG_NOTICE = 3,
- DEBUG_INFO = 4
+ DEBUG_INFO = 4,
+ DEBUG_MAX
};
-int wifi_debug_level = DEBUG_NOTICE;
+int wifi_debug_level = DEBUG_WARN;
+
+#ifdef WIFI_DEBUG_FILE
+char *get_time(char *time)
+{
+ struct tm *tm_info;
+ struct timeval tv_now;
+ char tmp[64];
+
+ gettimeofday(&tv_now, NULL);
+ tm_info = localtime(&tv_now.tv_sec);
+
+ strftime(tmp, 64, "%y%m%d-%T", tm_info);
+ snprintf(time, 128, "%s.%06d", tmp, (int)tv_now.tv_usec);
+ return time;
+}
+
+void _wifi_debug(int level, const char *function, int line, const char *format, ...)
+{
+ char buff[256] = {0};
+ va_list list;
+ FILE *fpg = NULL;
+ get_time(buff);
+
+ if ((access("/nvram/wifiVendorHalDbg", R_OK)) == 0) {
+ fpg = fopen("/tmp/wifiVendorHal", "a+");
+ if (fpg == NULL) {
+ return;
+ }
+ } else {
+ switch (level) {
+ case DEBUG_OFF:
+ case DEBUG_ERROR:
+ case DEBUG_WARN:
+ fpg = fopen("/rdklogs/logs/wifi_vendor_hal.log", "a+");
+ if (fpg == NULL) {
+ return;
+ }
+ break;
+ case DEBUG_NOTICE:
+ case DEBUG_INFO:
+ default:
+ return;
+ }
+ }
+ static const char *level_marker[DEBUG_MAX] =
+ {
+ [DEBUG_OFF] = "<OFF>",
+ [DEBUG_ERROR] = "<ERR>",
+ [DEBUG_WARN] = "<WARN>",
+ [DEBUG_NOTICE] = "<NOTICE>",
+ [DEBUG_INFO] = "<INFO>",
+ };
+ if (level < DEBUG_MAX)
+ snprintf(&buff[strlen(buff)], 256 - strlen(buff), " %s ", level_marker[level]);
+ fprintf(fpg, "%s[%s:%d]", buff, function, line);
+ va_start(list, format);
+ vfprintf(fpg, format, list);
+ va_end(list);
+ fflush(fpg);
+ fclose(fpg);
+
+ return;
+}
+
+#define wifi_debug(level, format, ...) _wifi_debug(level, __func__, __LINE__, format, ##__VA_ARGS__)
+#else
#define wifi_debug(level, fmt, args...) \
{ \
if (level <= wifi_debug_level) \
@@ -178,19 +254,17 @@
printf("[%s][%d]"fmt"", __func__, __LINE__, ##args); \
} \
}
-
+#endif
#define wifi_assert(cond) \
{\
if (!(cond)) {\
- printf("!!!wifi hal assert!!!m %s %d\n", __func__, __LINE__);\
+ wifi_debug(DEBUG_ERROR, "!!!wifi hal assert!!!\n");\
}\
}
#ifdef WIFI_DEBUG
-#define wifi_dbg_printf printf
-#define WIFI_ENTRY_EXIT_DEBUG printf
+#define WIFI_ENTRY_EXIT_DEBUG(format, ...) _wifi_debug(DEBUG_OFF, __func__, __LINE__, format, ##__VA_ARGS__)
#else
-#define wifi_dbg_printf(format, args...)
#define WIFI_ENTRY_EXIT_DEBUG(format, args...)
#endif
@@ -457,6 +531,9 @@
static int ieee80211_channel_to_frequency(int channel, int *freqMHz);
static void wifi_PrepareDefaultHostapdConfigs(bool reset);
static void wifi_psk_file_reset();
+static void wifi_vap_status_reset();
+static void wifi_radio_reset_count_reset();
+static void wifi_guard_interval_file_check();
static void wifi_dat_file_reset_by_radio(char radio_idx);
static int util_get_sec_chan_offset(int channel, const char* ht_mode);
int hostapd_raw_add_bss(int apIndex);
@@ -984,7 +1061,7 @@
BOOL ap_enable = 0;
struct bss_mlo_info ml_info;
- wifi_debug(DEBUG_ERROR, "==========>\n");
+ wifi_debug(DEBUG_INFO, "==========>\n");
memset(&mld_config, 0, sizeof(mld_config));
for (band = 0; band < get_runtime_max_radio(); band++) {
@@ -1022,7 +1099,7 @@
mld_ap_set(mld, ap_index, 1);
bss_idx++;
token = strtok(NULL, ";");
- wifi_debug(DEBUG_ERROR, "mld[%ld] affiliated ap[%d].\n", mld_index, ap_index);
+ wifi_debug(DEBUG_INFO, "mld[%ld] affiliated ap[%d].\n", mld_index, ap_index);
}
}
@@ -1049,7 +1126,7 @@
ml_info.mld_grp_idx);
continue;
}
- wifi_debug(DEBUG_ERROR, "!Successfully get bss[%d] ml info from driver, mld_grp_idx=%d"
+ wifi_debug(DEBUG_OFF, "!Successfully get bss[%d] ml info from driver, mld_grp_idx=%d"
"mld_addr=%02x:%02x:%02x:%02x:%02x:%02x\n", ap_index, ml_info.mld_grp_idx,
ml_info.addr[0], ml_info.addr[1], ml_info.addr[2], ml_info.addr[3], ml_info.addr[4],
ml_info.addr[5]);
@@ -1085,14 +1162,14 @@
struct multi_link_device *mld;
char interface_name[IF_NAME_SIZE] = {0};
- wifi_debug(DEBUG_ERROR, "==========>\n");
+ wifi_debug(DEBUG_INFO, "==========>\n");
for (mld_index = 1; mld_index <= MAX_ML_MLD_CNT; mld_index++) {
if (!mld_test(mld_index))
continue;
mld = &(mld_config.mld[mld_index]);
- printf("MLD[%02d]: %02x:%02x:%02x:%02x:%02x:%02x\n\tAffiliated AP:\n", (int)(mld->mld_index),
+ wifi_debug(DEBUG_OFF, "MLD[%02d]: %02x:%02x:%02x:%02x:%02x:%02x\n\tAffiliated AP:\n", (int)(mld->mld_index),
mld->mld_mac[0], mld->mld_mac[1], mld->mld_mac[2],
mld->mld_mac[3], mld->mld_mac[4], mld->mld_mac[5]);
@@ -1103,10 +1180,10 @@
wifi_debug(DEBUG_ERROR, "invalid ap_index %d\n", ap_index);
continue;
}
- printf("\tap[%d] %s\n", (int)ap_index, interface_name);
+ wifi_debug(DEBUG_INFO, "\tap[%d] %s\n", (int)ap_index, interface_name);
}
}
- wifi_debug(DEBUG_ERROR, "<==========\n");
+ wifi_debug(DEBUG_INFO, "<==========\n");
}
INT wifi_eht_create_ap_mld(unsigned char mld_index, unsigned char *mac)
@@ -1487,7 +1564,7 @@
MldGroup.name = "MldGroup";
MldGroup.value = MldGroup_V_Str;
wifi_datfileWrite(config_file_dat, &MldGroup, 1);
- wifi_debug(DEBUG_ERROR, "band[%u] MldGroup=%s\n", band, MldGroup_V_Str);
+ wifi_debug(DEBUG_INFO, "band[%u] MldGroup=%s\n", band, MldGroup_V_Str);
return RETURN_OK;
}
@@ -1520,7 +1597,7 @@
while (fgets(buf, sizeof(buf), fp)) {
buf_len = strlen(buf);
if (buf_len == 0) {
- wifi_debug(DEBUG_ERROR, "Unexpected snprintf fail\n");
+ wifi_debug(DEBUG_ERROR, "buf_len = 0\n");
if (fclose(fp) != 0) {
wifi_debug(DEBUG_ERROR, "fclose fail\n");
}
@@ -2469,7 +2546,7 @@
if (access(SSID_ENABLE_CONFIG, F_OK) == 0 && reset == FALSE)
return;
- res = _syscmd_secure(ret_buf, sizeof(ret_buf), "cp /rom%s %s", SSID_ENABLE_CONFIG, SSID_ENABLE_CONFIG);
+ res = _syscmd_secure(ret_buf, sizeof(ret_buf), "cp %s %s", ROM_SSID_ENABLE_CONFIG, SSID_ENABLE_CONFIG);
if (res) {
wifi_debug(DEBUG_ERROR, "_syscmd_secure fail\n");
}
@@ -2486,7 +2563,7 @@
if (access(WIFI_BRLAN_CONFIG, F_OK) == 0 && reset == FALSE)
return;
- res = _syscmd_secure(ret_buf, sizeof(ret_buf), "cp /rom%s %s", WIFI_BRLAN_CONFIG, WIFI_BRLAN_CONFIG);
+ res = _syscmd_secure(ret_buf, sizeof(ret_buf), "cp %s %s", ROM_WIFI_BRLAN_CONFIG, WIFI_BRLAN_CONFIG);
if (res) {
wifi_debug(DEBUG_ERROR, "_syscmd_secure fail\n");
}
@@ -2526,7 +2603,7 @@
wifi_debug(DEBUG_ERROR, "_syscmd_secure fail\n");
}
- wifi_debug(DEBUG_ERROR, "vap_index[%d] %s\n", vap_index, enable ? "enabled" : "disabled");
+ wifi_debug(DEBUG_OFF, "vap_index[%d] %s\n", vap_index, enable ? "enabled" : "disabled");
return 0;
}
@@ -2555,26 +2632,35 @@
int res;
/*delete running hostapd conf files*/
- wifi_dbg_printf("\n[%s]: deleting hostapd conf file.", __func__);
+ wifi_debug(DEBUG_INFO, "deleting hostapd conf file.\n");
- res = _syscmd_secure(buf, sizeof(buf), "rm -rf /nvram/*.conf");
+ res = _syscmd_secure(buf, sizeof(buf), "rm -rf /nvram/hostapd*.conf");
if (res) {
wifi_debug(DEBUG_ERROR, "_syscmd_secure fail\n");
}
- wifi_PrepareWifiBrlanConfig(TRUE);
+ wifi_psk_file_reset();
+ wifi_vap_status_reset();
+ wifi_radio_reset_count_reset();
+ wifi_guard_interval_file_check();
+
+ wifi_PrepareWifiBrlanConfig(TRUE);
wifi_PrepareDefaultHostapdConfigs(TRUE);
wifi_PrepareEnableSSIDConfig(TRUE);
wifi_psk_file_reset();
+ for (UCHAR radio_idx = 0; radio_idx < get_runtime_max_radio(); radio_idx++) {
+ wifi_dat_file_reset_by_radio(radio_idx);
+ }
+#if 0
memset(buf, 0, MAX_BUF_SIZE);
res = _syscmd_secure(buf, sizeof(buf), "systemctl restart hostapd.service");
if (res) {
wifi_debug(DEBUG_ERROR, "_syscmd_secure fail\n");
}
-
+#endif
return RETURN_OK;
}
@@ -2989,7 +3075,7 @@
bss_num = LOGAN_MAX_NUM_VAP_PER_RADIO;
}
- wifi_debug(DEBUG_ERROR, "band %d BssidNum %d\n", radio_idx, bss_num);
+ wifi_debug(DEBUG_OFF, "band %d BssidNum %d\n", radio_idx, bss_num);
/*TBD: we need refine setup flow and mbss flow*/
for (bss_idx = 0; bss_idx < bss_num; bss_idx++) {
if (array_index_to_vap_index(radio_idx, bss_idx, &ap_idx) != RETURN_OK) {
@@ -3037,7 +3123,7 @@
wifi_setApEnable(ap_idx, FALSE);
wifi_GetInterfaceName(ap_idx, inf_name);
- wifi_debug(DEBUG_ERROR, "bring up %s\n", inf_name);
+ wifi_debug(DEBUG_OFF, "bring up %s\n", inf_name);
memset(cmd, 0, MAX_CMD_SIZE);
memset(ret_buf, 0, MAX_BUF_SIZE);
@@ -3227,7 +3313,7 @@
if (os_snprintf_error(sizeof(file), res)) {
wifi_debug(DEBUG_ERROR, "Unexpected snprintf fail\n");
}
- wifi_debug(DEBUG_ERROR, "%s:file %s", __func__, file);
+ wifi_debug(DEBUG_INFO, "%s:file %s", __func__, file);
if (access(file, F_OK) != 0) {
res = _syscmd_secure(ret_buf, sizeof(ret_buf), "touch %s", file);
if (res) {
@@ -3256,7 +3342,7 @@
if (os_snprintf_error(sizeof(file), res)) {
wifi_debug(DEBUG_ERROR, "Unexpected snprintf fail\n");
}
- wifi_debug(DEBUG_ERROR, "%s:file %s", __func__, file);
+ wifi_debug(DEBUG_INFO, "%s:file %s", __func__, file);
if (access(file, F_OK) != 0) {
res = _syscmd_secure(ret_buf, sizeof(ret_buf), "touch %s", file);
if (res) {
@@ -3285,7 +3371,7 @@
if (os_snprintf_error(sizeof(file), res)) {
wifi_debug(DEBUG_ERROR, "Unexpected snprintf fail\n");
}
- wifi_debug(DEBUG_ERROR, "%s:file %s", __func__, file);
+ wifi_debug(DEBUG_INFO, "%s:file %s", __func__, file);
if (access(file, F_OK) != 0) {
res = _syscmd_secure(ret_buf, sizeof(ret_buf), "touch %s", file);
if (res) {
@@ -3624,7 +3710,7 @@
}
/*deinit mtk nl80211 vendor msg*/
mtk_nl80211_deint(&unl_ins);
- wifi_debug(DEBUG_NOTICE, "set cmd success.\n");
+ wifi_debug(DEBUG_INFO, "set cmd success.\n");
WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__);
return RETURN_OK;
@@ -3729,7 +3815,7 @@
}
f = v_secure_popen("r","iw %s survey dump | grep 'in use' -A6", interface_name);
if (f == NULL) {
- wifi_dbg_printf("%s: v_secure_popen %s error\n", __func__, cmd);
+ wifi_debug(DEBUG_ERROR,"v_secure_popen %s error\n", cmd);
return RETURN_ERR;
}
@@ -4027,7 +4113,7 @@
}
/*deinit mtk nl80211 vendor msg*/
mtk_nl80211_deint(&unl_ins);
- wifi_debug(DEBUG_NOTICE, "set cmd success.\n");
+ wifi_debug(DEBUG_INFO, "set cmd success.\n");
WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__);
return RETURN_OK;
@@ -5077,83 +5163,83 @@
{
writeBandWidth(radioIndex,"20MHz");
wifi_setRadioOperatingChannelBandwidth(radioIndex,"20MHz");
- printf("\nChannel Mode is 802.11a (5GHz)\n");
+ wifi_debug(DEBUG_INFO,"\nChannel Mode is 802.11a (5GHz)\n");
}
else if (strcmp (channelMode,"11NAHT20") == 0)
{
writeBandWidth(radioIndex,"20MHz");
wifi_setRadioOperatingChannelBandwidth(radioIndex,"20MHz");
- printf("\nChannel Mode is 802.11n-20MHz(5GHz)\n");
+ wifi_debug(DEBUG_INFO,"\nChannel Mode is 802.11n-20MHz(5GHz)\n");
}
else if (strcmp (channelMode,"11NAHT40PLUS") == 0)
{
writeBandWidth(radioIndex,"40MHz");
wifi_setRadioOperatingChannelBandwidth(radioIndex,"40MHz");
- printf("\nChannel Mode is 802.11n-40MHz(5GHz)\n");
+ wifi_debug(DEBUG_INFO,"\nChannel Mode is 802.11n-40MHz(5GHz)\n");
}
else if (strcmp (channelMode,"11NAHT40MINUS") == 0)
{
writeBandWidth(radioIndex,"40MHz");
wifi_setRadioOperatingChannelBandwidth(radioIndex,"40MHz");
- printf("\nChannel Mode is 802.11n-40MHz(5GHz)\n");
+ wifi_debug(DEBUG_INFO,"\nChannel Mode is 802.11n-40MHz(5GHz)\n");
}
else if (strcmp (channelMode,"11ACVHT20") == 0)
{
writeBandWidth(radioIndex,"20MHz");
wifi_setRadioOperatingChannelBandwidth(radioIndex,"20MHz");
- printf("\nChannel Mode is 802.11ac-20MHz(5GHz)\n");
+ wifi_debug(DEBUG_INFO,"\nChannel Mode is 802.11ac-20MHz(5GHz)\n");
}
else if (strcmp (channelMode,"11ACVHT40PLUS") == 0)
{
writeBandWidth(radioIndex,"40MHz");
wifi_setRadioOperatingChannelBandwidth(radioIndex,"40MHz");
- printf("\nChannel Mode is 802.11ac-40MHz(5GHz)\n");
+ wifi_debug(DEBUG_INFO,"\nChannel Mode is 802.11ac-40MHz(5GHz)\n");
}
else if (strcmp (channelMode,"11ACVHT40MINUS") == 0)
{
writeBandWidth(radioIndex,"40MHz");
wifi_setRadioOperatingChannelBandwidth(radioIndex,"40MHz");
- printf("\nChannel Mode is 802.11ac-40MHz(5GHz)\n");
+ wifi_debug(DEBUG_INFO,"\nChannel Mode is 802.11ac-40MHz(5GHz)\n");
}
else if (strcmp (channelMode,"11ACVHT80") == 0)
{
wifi_setRadioOperatingChannelBandwidth(radioIndex,"80MHz");
- printf("\nChannel Mode is 802.11ac-80MHz(5GHz)\n");
+ wifi_debug(DEBUG_INFO,"\nChannel Mode is 802.11ac-80MHz(5GHz)\n");
}
else if (strcmp (channelMode,"11ACVHT160") == 0)
{
wifi_setRadioOperatingChannelBandwidth(radioIndex,"160MHz");
- printf("\nChannel Mode is 802.11ac-160MHz(5GHz)\n");
+ wifi_debug(DEBUG_INFO,"\nChannel Mode is 802.11ac-160MHz(5GHz)\n");
}
else if (strcmp (channelMode,"11B") == 0)
{
writeBandWidth(radioIndex,"20MHz");
wifi_setRadioOperatingChannelBandwidth(radioIndex,"20MHz");
- printf("\nChannel Mode is 802.11b(2.4GHz)\n");
+ wifi_debug(DEBUG_INFO,"\nChannel Mode is 802.11b(2.4GHz)\n");
}
else if (strcmp (channelMode,"11G") == 0)
{
writeBandWidth(radioIndex,"20MHz");
wifi_setRadioOperatingChannelBandwidth(radioIndex,"20MHz");
- printf("\nChannel Mode is 802.11g(2.4GHz)\n");
+ wifi_debug(DEBUG_INFO,"\nChannel Mode is 802.11g(2.4GHz)\n");
}
else if (strcmp (channelMode,"11NGHT20") == 0)
{
writeBandWidth(radioIndex,"20MHz");
wifi_setRadioOperatingChannelBandwidth(radioIndex,"20MHz");
- printf("\nChannel Mode is 802.11n-20MHz(2.4GHz)\n");
+ wifi_debug(DEBUG_INFO,"\nChannel Mode is 802.11n-20MHz(2.4GHz)\n");
}
else if (strcmp (channelMode,"11NGHT40PLUS") == 0)
{
writeBandWidth(radioIndex,"40MHz");
wifi_setRadioOperatingChannelBandwidth(radioIndex,"40MHz");
- printf("\nChannel Mode is 802.11n-40MHz(2.4GHz)\n");
+ wifi_debug(DEBUG_INFO,"\nChannel Mode is 802.11n-40MHz(2.4GHz)\n");
}
else if (strcmp (channelMode,"11NGHT40MINUS") == 0)
{
writeBandWidth(radioIndex,"40MHz");
wifi_setRadioOperatingChannelBandwidth(radioIndex,"40MHz");
- printf("\nChannel Mode is 802.11n-40MHz(2.4GHz)\n");
+ wifi_debug(DEBUG_INFO,"\nChannel Mode is 802.11n-40MHz(2.4GHz)\n");
}
else
{
@@ -5776,7 +5862,7 @@
}
/*deinit mtk nl80211 vendor msg*/
mtk_nl80211_deint(&unl_ins);
- wifi_debug(DEBUG_NOTICE,"send cmd success\n");
+ wifi_debug(DEBUG_INFO,"send cmd success\n");
WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__);
return ext_ch;
@@ -6093,8 +6179,8 @@
band = radio_index_to_band(radioIndex);
if (band == band_invalid) {
+ wifi_debug(DEBUG_ERROR, "Invalid radio index");
return RETURN_ERR;
- wifi_dbg_printf("[%s]: Invalid radio index", __func__);
}
res = snprintf(config_file, sizeof(config_file), "%s%d.dat",LOGAN_DAT_FILE, band);
if (os_snprintf_error(sizeof(config_file), res)) {
@@ -6861,7 +6947,7 @@
/*deinit mtk nl80211 vendor msg*/
mtk_nl80211_deint(&unl_ins);
*output_ulong = checktime;
- wifi_debug(DEBUG_NOTICE,"send cmd success\n");
+ wifi_debug(DEBUG_INFO,"send cmd success\n");
WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__);
return RETURN_OK;
@@ -6926,7 +7012,7 @@
}
/*deinit mtk nl80211 vendor msg*/
mtk_nl80211_deint(&unl_ins);
- wifi_debug(DEBUG_NOTICE,"send cmd success\n");
+ wifi_debug(DEBUG_INFO,"send cmd success\n");
WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__);
return RETURN_OK;
@@ -7387,7 +7473,7 @@
memcpy(ext_channel, "0", strlen("0"));
ext_ch = 0;
} else {
- printf("%s: invalid EXT_CHA:%s\n", __func__, string);
+ wifi_debug(DEBUG_ERROR, "invalid EXT_CHA:%s\n", string);
return RETURN_ERR;
}
params.name = "HT_EXTCHA";
@@ -7466,7 +7552,7 @@
ret = wifi_setGuardInterval(radioIndex, GI);
if (ret == RETURN_ERR) {
- wifi_dbg_printf("%s: wifi_setGuardInterval return error\n", __func__);
+ wifi_debug(DEBUG_ERROR, "wifi_setGuardInterval return error\n");
return RETURN_ERR;
}
@@ -7506,7 +7592,7 @@
} else {
// output the max MCS for the current radio mode
if (wifi_getRadioMode(radioIndex, buf, &mode_bitmap) == RETURN_ERR) {
- wifi_dbg_printf("%s: wifi_getradiomode return error.\n", __func__);
+ wifi_debug(DEBUG_ERROR, "wifi_getradiomode return error.\n");
return RETURN_ERR;
}
if (mode_bitmap & WIFI_MODE_AX) {
@@ -7702,7 +7788,7 @@
while(true)
{
if(support == NULL) { // input not in the list
- wifi_dbg_printf("Input value is invalid.\n");
+ wifi_debug(DEBUG_ERROR, "Input value is invalid.\n");
return RETURN_ERR;
}
if (strncmp(txpower_str, support, strlen(support)) == 0) {
@@ -7742,7 +7828,7 @@
}
/*deinit mtk nl80211 vendor msg*/
mtk_nl80211_deint(&unl_ins);
- wifi_debug(DEBUG_NOTICE, "set cmd success.\n");
+ wifi_debug(DEBUG_INFO, "set cmd success.\n");
res = snprintf(pwr_file, sizeof(pwr_file), "%s%d.txt", POWER_PERCENTAGE, radio_index_to_band(radioIndex));
if (os_snprintf_error(sizeof(pwr_file), res)) {
@@ -8115,9 +8201,7 @@
params.name= "basic_rates";
params.value =TransmitRates;
- wifi_dbg_printf("\n%s:",__func__);
- wifi_dbg_printf("\nparams.value=%s\n",params.value);
- wifi_dbg_printf("\n******************Transmit rates=%s\n",TransmitRates);
+ wifi_debug(DEBUG_INFO, "params.value=%s, Transmit rates=%s\n", params.value, TransmitRates);
if (array_index_to_vap_index(radioIndex, 0, &main_vap_idx) != RETURN_OK) {
wifi_debug(DEBUG_ERROR, "invalid radio_index[%d]\n", radioIndex);
return RETURN_ERR;
@@ -8173,7 +8257,7 @@
fp = fopen("/tmp/Radio_Stats.txt", "r");
if(fp == NULL)
{
- printf("/tmp/Radio_Stats.txt not exists \n");
+ wifi_debug(DEBUG_ERROR, "/tmp/Radio_Stats.txt not exists\n");
return RETURN_ERR;
}
if (fclose(fp) != 0) {
@@ -8632,7 +8716,7 @@
}
wifi_hostapdRead(config_file,"ssid",output, MAX_SSID_NAME_LEN);
- wifi_dbg_printf("\n[%s]: SSID Name is : %s",__func__,output);
+ wifi_debug(DEBUG_INFO, "SSID Name is : %s\n", output);
return RETURN_OK;
}
@@ -8800,7 +8884,7 @@
}
f = v_secure_popen("r", "iw dev %s survey dump | grep 'frequency\\|noise' | awk '{print $2}'", interface_name);
if (f == NULL) {
- wifi_dbg_printf("%s: v_secure_popen %s error\n", __func__, cmd);
+ wifi_debug(DEBUG_ERROR, "v_secure_popen %s error\n", cmd);
return RETURN_ERR;
}
@@ -8897,7 +8981,7 @@
wifi_debug(DEBUG_ERROR, "Unexpected snprintf fail\n");
return RETURN_ERR;
}
- wifi_debug(DEBUG_ERROR, "cmd: %s\n", cmd);
+ wifi_debug(DEBUG_INFO, "cmd: %s\n", cmd);
f = v_secure_popen("r", "iw dev %s scan | grep '%s\\|SSID\\|freq\\|beacon interval\\|capabilities\\|signal\\|Supported rates\\|DTIM\\| \
// WPA\\|RSN\\|Group cipher\\|HT operation\\|secondary channel offset\\|channel width\\|HE.*GHz' | grep -v -e '*.*BSS'", interface_name, interface_name);
@@ -8933,7 +9017,7 @@
tmp = realloc(scan_array, sizeof(wifi_neighbor_ap2_t)*(index+1));
if (tmp == NULL) { // no more memory to use
index--;
- wifi_dbg_printf("%s: realloc failed\n", __func__);
+ wifi_debug(DEBUG_INFO, "realloc failed\n");
break;
}
scan_array = tmp;
@@ -10105,7 +10189,7 @@
}
band = radio_index_to_band(radioIndex);
if (band == band_invalid) {
- printf("%s:Band Error\n", __func__);
+ wifi_debug(DEBUG_ERROR, "Band Error\n");
return RETURN_ERR;
}
res = snprintf(dat_file, sizeof(dat_file), "%s%d.dat", LOGAN_DAT_FILE, band);
@@ -10374,7 +10458,7 @@
}
/*deinit mtk nl80211 vendor msg*/
mtk_nl80211_deint(&unl_ins);
- wifi_debug(DEBUG_NOTICE,"send cmd success, get output_bool:%d\n", *output_bool);
+ wifi_debug(DEBUG_INFO,"send cmd success, get output_bool:%d\n", *output_bool);
return RETURN_OK;
err:
mtk_nl80211_deint(&unl_ins);
@@ -10470,7 +10554,7 @@
MTK_NL80211_VENDOR_ATTR_AP_BA_EN_INFO);
return RETURN_ERR;
}
- wifi_debug(DEBUG_NOTICE, "cmd success:output_bool(%d)\n", *output_bool);
+ wifi_debug(DEBUG_INFO, "cmd success:output_bool(%d)\n", *output_bool);
return RETURN_OK;
}
@@ -10540,7 +10624,7 @@
return RETURN_ERR;
}
if (nla_put_u8(msg, MTK_NL80211_VENDOR_ATTR_AP_HT_OP_MODE, enable)) {
- printf("Nla put attribute error\n");
+ wifi_debug(DEBUG_ERROR, "Nla put attribute error\n");
nlmsg_free(msg);
goto err;
}
@@ -10550,8 +10634,8 @@
goto err;
}
mtk_nl80211_deint(&unl_ins);
- //wifi_debug(DEBUG_NOTICE, "set Gf cmd success.\n");
- printf("set gf=%d cmd success.\n", enable);
+ wifi_debug(DEBUG_INFO, "set Gf cmd success.\n");
+
return RETURN_OK;
err:
mtk_nl80211_deint(&unl_ins);
@@ -10667,7 +10751,7 @@
wifi_debug(DEBUG_ERROR, "send MTK_NL80211_VENDOR_ATTR_MCAST_SNOOP_ENABLE cmd fails\n");
return RETURN_ERR;
}
- wifi_debug(DEBUG_ERROR, "send cmd success: get igmp status:(%d)\n", *output_bool);
+ wifi_debug(DEBUG_INFO, "send cmd success: get igmp status:(%d)\n", *output_bool);
return RETURN_OK;
}
@@ -10680,7 +10764,7 @@
wifi_debug(DEBUG_ERROR, "send MTK_NL80211_VENDOR_ATTR_MCAST_SNOOP_ENABLE cmd fails\n");
return RETURN_ERR;
}
- wifi_debug(DEBUG_ERROR, "send cmd success: set igmp enable(%d)\n", enable);
+ wifi_debug(DEBUG_INFO, "send cmd success: set igmp enable(%d)\n", enable);
return RETURN_OK;
}
@@ -10757,30 +10841,22 @@
// Outputs the index number in that corresponds to the SSID string
INT wifi_getIndexFromName(CHAR *inputSsidString, INT *output_int)
{
- char buf[32] = {0};
int ap_idx = 0;
- char *apIndex_str = NULL;
char radio_idx = 0;
char bss_idx = 0;
- int res;
- long int tmp;
+ unsigned char i;
+ char inf_name[IF_NAME_SIZE] = {0};
- res = _syscmd_secure(buf, sizeof(buf), "grep -rn ^interface=%s$ /nvram/hostapd*.conf | cut -d '.' -f1 | cut -d 'd' -f2 | tr -d '\\n'", inputSsidString);
- if (res) {
- wifi_debug(DEBUG_ERROR, "_syscmd_secure fail\n");
- }
+ for (i = 0; i < MAX_APS; i++) {
+ if (wifi_GetInterfaceName(i, inf_name) != RETURN_OK)
+ continue;
- if (strlen(buf)) {
- apIndex_str = strtok(buf, "\n");
- if (apIndex_str == NULL) {
- wifi_debug(DEBUG_ERROR, "strtok fail\n");
- return RETURN_ERR;
- }
- if (hal_strtol(apIndex_str, 10, &tmp) < 0) {
- wifi_debug(DEBUG_ERROR, "strtol fail\n");
+ if (strncmp(inf_name, inputSsidString, strlen(inf_name)) == 0) {
+ wifi_debug(DEBUG_INFO, "hostapd conf find, inf(%s), use inf idx(%d).\n",
+ inputSsidString, i);
+ *output_int = i;
+ return RETURN_OK;
}
- *output_int = tmp;
- return RETURN_OK;
}
/* If interface name is not in hostapd config, the caller maybe wifi agent to generate data model.*/
@@ -10794,8 +10870,8 @@
bss_idx = atoi(inputSsidString + strlen(PREFIX_WIFI2G));
radio_idx = 0;
} else {
- printf("%s: hostapd conf not find, unknow inf(%s), return ERROR!!!(%d).\n",
- __func__, inputSsidString, ap_idx);
+ wifi_debug(DEBUG_ERROR, "hostapd conf not find, unknow inf(%s), return ERROR!!!(%d).\n",
+ inputSsidString, ap_idx);
*output_int = -1;
return RETURN_ERR;
}
@@ -10806,8 +10882,8 @@
}
if (ap_idx >= 0 && ap_idx < MAX_APS) {
- printf("%s: hostapd conf not find, inf(%s), use inf idx(%d).\n",
- __func__, inputSsidString, ap_idx);
+ wifi_debug(DEBUG_INFO, "hostapd conf find, inf(%s), use inf idx(%d).\n",
+ inputSsidString, ap_idx);
*output_int = ap_idx;
return RETURN_OK;
}
@@ -10999,7 +11075,7 @@
if(strcmp(buf,"0")==0)
{
- printf("%s: wpa_mode is %s ......... \n", __func__, buf);
+ wifi_debug(DEBUG_OFF, "wpa_mode is %s ......... \n", buf);
res = snprintf(output_string, 32, "None");
if (os_snprintf_error(32, res)) {
wifi_debug(DEBUG_ERROR, "Unexpected snprintf fail\n");
@@ -11020,7 +11096,7 @@
memset(output_string, '\0', 32);
wifi_hostapdRead(config_file, param_name, output_string, 32);
}
- wifi_dbg_printf("\n%s output_string=%s",__func__,output_string);
+ wifi_debug(DEBUG_INFO, "output_string=%s\n", output_string);
if(strcmp(output_string,"TKIP CCMP") == 0) {
len = strlen("TKIPandAESEncryption");
@@ -11162,7 +11238,7 @@
WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n", __func__, __LINE__);
- wifi_dbg_printf("\n%s algo_mode=%d", __func__, mode);
+ wifi_debug(DEBUG_INFO, "algo_mode=%d\n", mode);
params.name = "auth_algs";
if ((mode & 1 && mode & 2) || mode & 4)
@@ -11199,7 +11275,7 @@
if(authMode == NULL)
return RETURN_ERR;
- wifi_dbg_printf("\n%s AuthMode=%s",__func__,authMode);
+ wifi_debug(DEBUG_INFO, "AuthMode=%s\n", authMode);
params.name = "wpa_key_mgmt";
if((strcmp(authMode,"PSKAuthentication") == 0) || (strcmp(authMode,"SharedAuthentication") == 0))
@@ -11241,7 +11317,7 @@
*authMode = 0;
wifi_getApBeaconType(apIndex,BeaconType);
- printf("%s____%s \n",__FUNCTION__,BeaconType);
+ wifi_debug(DEBUG_INFO, "%s____%s \n",__FUNCTION__,BeaconType);
if(strcmp(BeaconType,"None") == 0) {
memcpy(authMode, "None", 4);
@@ -11253,7 +11329,7 @@
return RETURN_ERR;
}
wifi_hostapdRead(config_file, "wpa_key_mgmt", authMode, 32);
- wifi_dbg_printf("\n[%s]: AuthMode Name is : %s",__func__,authMode);
+ wifi_debug(DEBUG_INFO, "AuthMode Name is : %s\n", authMode);
if(strcmp(authMode,"WPA-PSK") == 0) {
len = strlen("SharedAuthentication");
memcpy(authMode, "SharedAuthentication", len);
@@ -11647,7 +11723,7 @@
}
/*deinit mtk nl80211 vendor msg*/
mtk_nl80211_deint(&unl_ins);
- wifi_debug(DEBUG_NOTICE, "set cmd success.\n");
+ wifi_debug(DEBUG_INFO, "set cmd success.\n");
return RETURN_OK;
err:
mtk_nl80211_deint(&unl_ins);
@@ -11706,7 +11782,7 @@
}
/*deinit mtk nl80211 vendor msg*/
mtk_nl80211_deint(&unl_ins);
- wifi_debug(DEBUG_NOTICE, "set cmd success.\n");
+ wifi_debug(DEBUG_INFO, "set cmd success.\n");
return RETURN_OK;
err:
mtk_nl80211_deint(&unl_ins);
@@ -11877,7 +11953,7 @@
}
/*deinit mtk nl80211 vendor msg*/
mtk_nl80211_deint(&unl_ins);
- wifi_debug(DEBUG_NOTICE, "set cmd success.\n");
+ wifi_debug(DEBUG_INFO, "set cmd success.\n");
return RETURN_OK;
err:
mtk_nl80211_deint(&unl_ins);
@@ -11937,7 +12013,7 @@
return RETURN_ERR;
}
if (nla_put_u16(msg, MTK_NL80211_VENDOR_ATTR_VLAN_ID_INFO, vlanId)) {
- printf("Nla put attribute error\n");
+ wifi_debug(DEBUG_ERROR, "Nla put attribute error\n");
nlmsg_free(msg);
goto err;
}
@@ -11947,8 +12023,8 @@
goto err;
}
mtk_nl80211_deint(&unl_ins);
- //wifi_debug(DEBUG_NOTICE, "set vlanId cmd success.\n", vlanId);
- printf("set vlanId=%d cmd success.\n", vlanId);
+ wifi_debug(DEBUG_INFO, "set vlanId = %d cmd success.\n", vlanId);
+
return RETURN_OK;
err:
mtk_nl80211_deint(&unl_ins);
@@ -11991,7 +12067,7 @@
return RETURN_ERR;
}
- wifi_debug(DEBUG_ERROR, "Bridge device %s has subnet mask: %s\n", br_name, inet_ntoa(sin->sin_addr));
+ wifi_debug(DEBUG_OFF, "Bridge device %s has subnet mask: %s\n", br_name, inet_ntoa(sin->sin_addr));
memcpy(subnet, inet_ntoa(sin->sin_addr), strlen(inet_ntoa(sin->sin_addr)));
close(sock);
@@ -12135,7 +12211,7 @@
}
if (nla_put_u8(msg, MTK_NL80211_VENDOR_ATTR_VLAN_TAG_INFO, 0)) {
- printf("Nla put attribute error\n");
+ wifi_debug(DEBUG_ERROR, "Nla put attribute error\n");
nlmsg_free(msg);
goto err;
}
@@ -12146,7 +12222,7 @@
goto err;
}
mtk_nl80211_deint(&unl_ins);
- wifi_debug(DEBUG_NOTICE, "set vlan_tag 0 cmd success.\n");
+ wifi_debug(DEBUG_INFO, "set vlan_tag 0 cmd success.\n");
/*step 2. mwctl dev %s set vlan_priority 0*/
ret = mtk_nl80211_init(&unl_ins, &msg, &msg_data, ¶m);
@@ -12156,7 +12232,7 @@
}
if (nla_put_u8(msg, MTK_NL80211_VENDOR_ATTR_VLAN_PRIORITY_INFO, 0)) {
- printf("Nla put attribute error\n");
+ wifi_debug(DEBUG_ERROR, "Nla put attribute error\n");
nlmsg_free(msg);
goto err;
}
@@ -12167,7 +12243,7 @@
goto err;
}
mtk_nl80211_deint(&unl_ins);
- wifi_debug(DEBUG_NOTICE, "set vlan_priority 0 cmd success.\n");
+ wifi_debug(DEBUG_INFO, "set vlan_priority 0 cmd success.\n");
/*step 3. mwctl dev %s set vlan_id 0*/
ret = mtk_nl80211_init(&unl_ins, &msg, &msg_data, ¶m);
@@ -12177,7 +12253,7 @@
}
if (nla_put_u16(msg, MTK_NL80211_VENDOR_ATTR_VLAN_ID_INFO, 0)) {
- printf("Nla put attribute error\n");
+ wifi_debug(DEBUG_ERROR, "Nla put attribute error\n");
nlmsg_free(msg);
goto err;
}
@@ -12188,7 +12264,7 @@
goto err;
}
mtk_nl80211_deint(&unl_ins);
- wifi_debug(DEBUG_NOTICE, "set vlan_id cmd success.\n");
+ wifi_debug(DEBUG_INFO, "set vlan_id cmd success.\n");
/*step 4. mwctl dev %s set vlan_en 0*/
ret = mtk_nl80211_init(&unl_ins, &msg, &msg_data, ¶m);
@@ -12198,7 +12274,7 @@
}
if (nla_put_u8(msg, MTK_NL80211_VENDOR_ATTR_VLAN_EN_INFO, 0)) {
- printf("Nla put attribute error\n");
+ wifi_debug(DEBUG_ERROR, "Nla put attribute error\n");
nlmsg_free(msg);
goto err;
}
@@ -12209,7 +12285,7 @@
goto err;
}
mtk_nl80211_deint(&unl_ins);
- wifi_debug(DEBUG_NOTICE, "set vlan_id cmd success.\n");
+ wifi_debug(DEBUG_INFO, "set vlan_id cmd success.\n");
/*step 5. mwctl dev %s set vlan_policy 0:4*/
vlan_param.direction = 0;
@@ -12220,7 +12296,7 @@
return RETURN_ERR;
}
if (nla_put(msg, MTK_NL80211_VENDOR_ATTR_VLAN_POLICY_INFO, sizeof(vlan_param), &vlan_param)) {
- printf("Nla put attribute error\n");
+ wifi_debug(DEBUG_ERROR, "Nla put attribute error\n");
nlmsg_free(msg);
goto err;
}
@@ -12231,7 +12307,7 @@
goto err;
}
mtk_nl80211_deint(&unl_ins);
- wifi_debug(DEBUG_NOTICE, "set vlan_policy 0:4 cmd success.\n");
+ wifi_debug(DEBUG_INFO, "set vlan_policy 0:4 cmd success.\n");
/*step 6. mwctl dev %s set vlan_policy 1:0*/
vlan_param.direction = 1;
@@ -12243,7 +12319,7 @@
}
if (nla_put(msg, MTK_NL80211_VENDOR_ATTR_VLAN_POLICY_INFO, sizeof(vlan_param), &vlan_param)) {
- printf("Nla put attribute error\n");
+ wifi_debug(DEBUG_ERROR, "Nla put attribute error\n");
nlmsg_free(msg);
goto err;
}
@@ -12255,7 +12331,7 @@
}
/*deinit mtk nl80211 vendor msg*/
mtk_nl80211_deint(&unl_ins);
- wifi_debug(DEBUG_NOTICE, "set vlan_policy 1:0 cmd success.\n");
+ wifi_debug(DEBUG_INFO, "set vlan_policy 1:0 cmd success.\n");
/*TODO need to modify VLAN config in dat file*/
WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__);
@@ -12506,7 +12582,7 @@
memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_name, interface_name, strlen(interface_name));
if (ioctl(sock, SIOCGIFFLAGS, &ifr) < 0) {
- wifi_debug(DEBUG_INFO, "ioctl(SIOCGIFFLAGS) failed, %s\n", strerror(errno));
+ wifi_debug(DEBUG_ERROR, "ioctl(SIOCGIFFLAGS) failed, %s\n", strerror(errno));
close(sock);
return FALSE;
}
@@ -12567,7 +12643,7 @@
int res;
if (!output_string) {
- printf("%s: null pointer!", __func__);
+ wifi_debug(DEBUG_ERROR, "null pointer!");
return RETURN_ERR;
}
@@ -12971,7 +13047,7 @@
else {
int device_num = atoi(output);
if (device_num > MAX_ASSOCIATED_STA_NUM || device_num < 0) {
- wifi_dbg_printf("\n[%s]: get max_num_sta error: %d", __func__, device_num);
+ wifi_debug(DEBUG_ERROR, "\nget max_num_sta error: %d", device_num);
return RETURN_ERR;
}
else {
@@ -13248,18 +13324,17 @@
if(strcmp(buf,"0")==0)
{
- printf("wpa_mode is %s ......... \n",buf);
+ wifi_debug(DEBUG_ERROR, "wpa_mode is %s ......... \n",buf);
return RETURN_ERR;
}
- wifi_dbg_printf("\nFunc=%s\n",__func__);
res = snprintf(config_file, sizeof(config_file), "%s%d.conf",CONFIG_PREFIX,apIndex);
if (os_snprintf_error(sizeof(config_file), res)) {
wifi_debug(DEBUG_ERROR, "Unexpected snprintf fail\n");
return RETURN_ERR;
}
wifi_hostapdRead(config_file,"wpa_psk",output_string,65);
- wifi_dbg_printf("\noutput_string=%s\n",output_string);
+ wifi_debug(DEBUG_INFO, "output_string=%s\n", output_string);
return RETURN_OK;
}
@@ -13280,7 +13355,7 @@
if(strlen(preSharedKey) != 64)
{
- wifi_dbg_printf("\nCannot Set Preshared Key length of preshared key should be 64 chars\n");
+ wifi_debug(DEBUG_ERROR, "\nCannot Set Preshared Key length of preshared key should be 64 chars\n");
return RETURN_ERR;
}
params.value = preSharedKey;
@@ -13305,7 +13380,6 @@
char config_file[MAX_BUF_SIZE] = {0}, buf[32] = {0};
int res;
- wifi_dbg_printf("\nFunc=%s\n",__func__);
if (NULL == output_string)
return RETURN_ERR;
@@ -13318,12 +13392,12 @@
wifi_hostapdRead(config_file,"wpa",buf,sizeof(buf));
if(strcmp(buf,"0")==0)
{
- printf("wpa_mode is %s ......... \n",buf);
+ wifi_debug(DEBUG_ERROR, "wpa_mode is %s ......... \n",buf);
return RETURN_ERR;
}
wifi_hostapdRead(config_file,"wpa_passphrase",output_string,64);
- wifi_dbg_printf("\noutput_string=%s\n",output_string);
+ wifi_debug(DEBUG_INFO, "output_string=%s\n", output_string);
return RETURN_OK;
}
@@ -13341,7 +13415,7 @@
if(strlen(passPhrase)<8 || strlen(passPhrase)>63)
{
- wifi_dbg_printf("\nCannot Set Preshared Key length of preshared key should be 8 to 63 chars\n");
+ wifi_debug(DEBUG_ERROR, "\nCannot Set Preshared Key length of preshared key should be 8 to 63 chars\n");
return RETURN_ERR;
}
params.name = "wpa_passphrase";
@@ -13548,7 +13622,7 @@
"auth_server_addr=%s\\n"
"auth_server_port=%s\\n"
"auth_server_shared_secret=%s' >> %s", IPAddress, port_str, RadiusSecret, config_file)) {
- wifi_dbg_printf("%s: command failed, cmd: %s\n", __func__, cmd);
+ wifi_debug(DEBUG_ERROR, "command failed, cmd: %s\n", cmd);
return RETURN_ERR;
}
} else {
@@ -13574,7 +13648,7 @@
"auth_server_addr=%s\\n"
"auth_server_port=%s\\n"
"auth_server_shared_secret=%s/' %s", IPAddress, port_str, RadiusSecret, config_file)) {
- wifi_dbg_printf("%s: command failed, cmd: %s\n", __func__, cmd);
+ wifi_debug(DEBUG_ERROR, "command failed, cmd: %s\n", cmd);
return RETURN_ERR;
}
}
@@ -13685,7 +13759,7 @@
"auth_server_addr=%s\\n"
"auth_server_port=%s\\n"
"auth_server_shared_secret=%s' >> %s", IPAddress, port_str, RadiusSecret, config_file)){
- wifi_dbg_printf("%s: command failed, cmd: %s\n", __func__, cmd);
+ wifi_debug(DEBUG_ERROR, "command failed, cmd: %s\n", cmd);
return RETURN_ERR;
}
} else {
@@ -13712,7 +13786,7 @@
"auth_server_addr=%s\\n"
"auth_server_port=%s\\n"
"auth_server_shared_secret=%s/' %s", IPAddress, port_str, RadiusSecret, config_file)){
- wifi_dbg_printf("%s: command failed, cmd: %s\n", __func__, cmd);
+ wifi_debug(DEBUG_ERROR, "command failed, cmd: %s\n", cmd);
return RETURN_ERR;
}
}
@@ -13873,7 +13947,7 @@
else if(!strcmp(methods, "ExternalNFCToken"))
res = snprintf(config_methods, sizeof(config_methods), "%s ", "ext_nfc_token");
else
- printf("%s: Unknown WpsConfigMethod\n", __func__);
+ wifi_debug(DEBUG_ERROR, "Unknown WpsConfigMethod\n");
}
else if(*token=='I' && !strcmp(token, "IntegratedNFCToken"))
res = snprintf(config_methods, sizeof(config_methods), "%s ", "int_nfc_token");
@@ -13886,10 +13960,10 @@
else if(!strcmp(token, "PIN"))
res = snprintf(config_methods, sizeof(config_methods), "%s ", "keypad");
else
- printf("%s: Unknown WpsConfigMethod\n", __func__);
+ wifi_debug(DEBUG_ERROR, "Unknown WpsConfigMethod\n");
}
else
- printf("%s: Unknown WpsConfigMethod\n", __func__);
+ wifi_debug(DEBUG_ERROR, "Unknown WpsConfigMethod\n");
if (os_snprintf_error(sizeof(config_methods), res)) {
wifi_debug(DEBUG_ERROR, "Unexpected snprintf fail\n");
@@ -14198,7 +14272,7 @@
interface_name, interface_name);
if (fp == NULL)
{
- printf("Failed to run command inside function %s\n",__FUNCTION__ );
+ wifi_debug(DEBUG_ERROR, "Failed to run command\n");
return RETURN_ERR;
}
@@ -14210,7 +14284,7 @@
}
wifi_count = (unsigned int) atoi ( str );
*output_array_size = wifi_count;
- printf(" In rdkb hal ,Wifi Client Counts and index %d and %d \n",*output_array_size,apIndex);
+ wifi_debug(DEBUG_OFF, " In rdkb hal ,Wifi Client Counts and index %d and %d \n",*output_array_size,apIndex);
v_secure_pclose(fp);
if(wifi_count == 0)
@@ -14225,7 +14299,7 @@
temp = (wifi_associated_dev3_t*)calloc(1, sizeof(wifi_associated_dev3_t)*wifi_count) ;
if(temp == NULL)
{
- printf("Error Statement. Insufficient memory \n");
+ wifi_debug(DEBUG_ERROR, "Error Statement. Insufficient memory \n");
return RETURN_ERR;
}
@@ -14249,7 +14323,7 @@
fp = fopen("/tmp/AssociatedDevice_Stats.txt", "r");
if(fp == NULL)
{
- printf("/tmp/AssociatedDevice_Stats.txt not exists \n");
+ wifi_debug(DEBUG_ERROR, "/tmp/AssociatedDevice_Stats.txt not exists \n");
free(temp);
return RETURN_ERR;
}
@@ -14948,7 +15022,7 @@
*associated_dev_array = temp;
if(temp == NULL)
{
- printf("Error Statement. Insufficient memory \n");
+ wifi_debug(DEBUG_ERROR, "Error Statement. Insufficient memory \n");
return RETURN_ERR;
}
memset(buf,0,sizeof(buf));
@@ -15331,7 +15405,7 @@
char conf_file[MAX_BUF_SIZE] = {0};
if ((rssiThreshold >= 0 && rssiThreshold <= 60) || (rssiThreshold >= -94 && rssiThreshold <= -30)) {
- wifi_debug(DEBUG_ERROR, "Valid threshold!\n");
+ wifi_debug(DEBUG_NOTICE, "Valid threshold!\n");
} else {
wifi_debug(DEBUG_ERROR, "ERROR! Input is invalid threshold!, Valid range from -30 to -94 or 0 to 60\n");
return RETURN_ERR;
@@ -15486,7 +15560,7 @@
wifi_debug(DEBUG_ERROR, "v_secure_system fail\n");
return RETURN_ERR;
}
- printf("%s: %s\n", __func__, cmd);
+ wifi_debug(DEBUG_OFF, "%s: %s\n", __func__, cmd);
return status;
}
@@ -15646,7 +15720,7 @@
else if (strncmp(output, "2", 1) == 0)
res = snprintf(output_string, 64, "Required");
else {
- wifi_dbg_printf("\n[%s]: Unexpected ieee80211w=%s", __func__, output);
+ wifi_debug(DEBUG_ERROR, "Unexpected ieee80211w=%s\n", output);
return RETURN_ERR;
}
if (os_snprintf_error(64, res)) {
@@ -15654,7 +15728,7 @@
return RETURN_ERR;
}
- wifi_dbg_printf("\n[%s]: ieee80211w is : %s", __func__, output);
+ wifi_debug(DEBUG_INFO, "ieee80211w is : %s\n", output);
return RETURN_OK;
}
INT wifi_setApMBOConfig(INT apIndex)
@@ -15698,7 +15772,7 @@
else if (strncmp(MfpConfig, "Required", strlen("Required")) == 0)
params.value = "2";
else{
- wifi_dbg_printf("%s: invalid MfpConfig. Input has to be Disabled, Optional or Required \n", __func__);
+ wifi_debug(DEBUG_ERROR, "invalid MfpConfig. Input has to be Disabled, Optional or Required\n");
return RETURN_ERR;
}
@@ -15957,8 +16031,7 @@
params.name = "supported_rates";
params.value = output;
- wifi_dbg_printf("\n%s:",__func__);
- wifi_dbg_printf("params.value=%s\n",params.value);
+ wifi_debug(DEBUG_INFO, "params.value=%s\n", params.value);
res = snprintf(config_file, sizeof(config_file), "%s%d.conf",CONFIG_PREFIX,wlanIndex);
if (os_snprintf_error(sizeof(config_file), res)) {
wifi_debug(DEBUG_ERROR, "Unexpected snprintf fail\n");
@@ -16468,13 +16541,13 @@
return RETURN_ERR;
}
- wifi_debug(DEBUG_ERROR, "cmd: %s\n", cmd);
+ wifi_debug(DEBUG_INFO, "cmd: %s\n", cmd);
f = v_secure_popen("r", "iw dev %s scan | grep '%s\\|SSID\\|freq\\|beacon interval\\|capabilities\\|signal\\|Supported rates\\|DTIM\\| \
// WPA\\|RSN\\|Group cipher\\|HT operation\\|secondary channel offset\\|channel width\\|HE.*GHz' | grep -v -e '*.*BSS'", interface_name, interface_name);
if (f == NULL) {
- wifi_dbg_printf("%s: v_secure_popen %s error\n", __func__, cmd);
+ wifi_debug(DEBUG_ERROR, "v_secure_popen %s error\n", cmd);
return RETURN_ERR;
}
@@ -16502,7 +16575,7 @@
tmp = realloc(scan_array, sizeof(wifi_neighbor_ap2_t)*(index+1));
if (tmp == NULL) { // no more memory to use
index--;
- wifi_dbg_printf("%s: realloc failed\n", __func__);
+ wifi_debug(DEBUG_ERROR, "realloc failed\n");
break;
}
scan_array = tmp;
@@ -16581,7 +16654,7 @@
wifi_debug(DEBUG_ERROR, "sscanf fail, index = %d\n", index);
goto err;
} else
- wifi_debug(DEBUG_ERROR, "index = %d, ssid=%s\n", index, scan_array[index].ap_SSID);
+ wifi_debug(DEBUG_OFF, "index = %d, ssid=%s\n", index, scan_array[index].ap_SSID);
if (filter_enable && strcmp(scan_array[index].ap_SSID, filter_SSID) == 0) {
filter_BSS = true;
}
@@ -16805,7 +16878,7 @@
int res;
if(wifi_getApName(apIndex, interface_name) != RETURN_OK) {
- wifi_dbg_printf("%s: wifi_getApName failed\n", __FUNCTION__);
+ wifi_debug(DEBUG_ERROR, "wifi_getApName failed\n");
return RETURN_ERR;
}
@@ -16824,7 +16897,7 @@
}
f = v_secure_popen("r", "iw dev %s station get %s | grep 'rx\\|tx' | tr -d '\t'", interface_name, mac_str);
if(f == NULL) {
- wifi_dbg_printf("%s: v_secure_popen %s error\n", __func__, cmd);
+ wifi_debug(DEBUG_ERROR, "v_secure_popen %s error\n", cmd);
return RETURN_ERR;
}
@@ -16993,14 +17066,14 @@
char interface_name[50] = {0};
if(wifi_getApName(apIndex, interface_name) != RETURN_OK) {
- wifi_dbg_printf("%s: wifi_getApName failed\n", __FUNCTION__);
+ wifi_debug(DEBUG_ERROR, "wifi_getApName failed\n");
return RETURN_ERR;
}
fp = v_secure_popen( "r", "iw dev %s station dump | grep %s | wc -l", interface_name, interface_name);
if (fp == NULL)
{
- printf("Failed to run command inside function %s\n",__FUNCTION__ );
+ wifi_debug(DEBUG_ERROR, "Failed to run command\n");
return RETURN_ERR;
}
@@ -17012,7 +17085,7 @@
}
wifi_count = (unsigned int) atoi ( str );
*output_array_size = wifi_count;
- wifi_dbg_printf(" In rdkb hal ,Wifi Client Counts and index %d and %d \n",*output_array_size,apIndex);
+ wifi_debug(DEBUG_INFO, "In rdkb hal ,Wifi Client Counts and index %d and %d \n", *output_array_size,apIndex);
v_secure_pclose(fp);
if(wifi_count == 0)
@@ -17026,7 +17099,7 @@
*associated_dev_array = temp;
if(temp == NULL)
{
- printf("Error Statement. Insufficient memory \n");
+ wifi_debug(DEBUG_ERROR, "Error Statement. Insufficient memory \n");
return RETURN_ERR;
}
@@ -17039,7 +17112,7 @@
fp = fopen("/tmp/AssociatedDevice_Stats.txt", "r");
if(fp == NULL)
{
- printf("/tmp/AssociatedDevice_Stats.txt not exists \n");
+ wifi_debug(DEBUG_ERROR, "/tmp/AssociatedDevice_Stats.txt not exists \n");
return RETURN_ERR;
}
if (fclose(fp) == EOF) {
@@ -17065,7 +17138,7 @@
}
memcpy(temp[count].cli_MACAddress,mac,(sizeof(unsigned char))*6);
- wifi_dbg_printf("MAC %d = %X:%X:%X:%X:%X:%X \n", count, temp[count].cli_MACAddress[0],temp[count].cli_MACAddress[1], temp[count].cli_MACAddress[2], temp[count].cli_MACAddress[3], temp[count].cli_MACAddress[4], temp[count].cli_MACAddress[5]);
+ wifi_debug(DEBUG_INFO, "MAC %d = %X:%X:%X:%X:%X:%X \n", count, temp[count].cli_MACAddress[0],temp[count].cli_MACAddress[1], temp[count].cli_MACAddress[2], temp[count].cli_MACAddress[3], temp[count].cli_MACAddress[4], temp[count].cli_MACAddress[5]);
}
temp[count].cli_AuthenticationState = 1; //TODO
temp[count].cli_Active = 1; //TODO
@@ -17449,7 +17522,7 @@
/*deinit mtk nl80211 vendor msg*/
mtk_nl80211_deint(&unl_ins);
- wifi_debug(DEBUG_NOTICE, "set cmd success.\n");
+ wifi_debug(DEBUG_INFO, "set cmd success.\n");
res = snprintf(mgmt_pwr_file, sizeof(mgmt_pwr_file), "%s%d.txt", MGMT_POWER_CTRL, wlanIndex);
if (os_snprintf_error(sizeof(mgmt_pwr_file), res)) {
@@ -17640,7 +17713,7 @@
if(sinfo[NL80211_STA_INFO_TID_STATS])
{
if(nla_parse_nested(stats_info, NL80211_TID_STATS_MAX,tidattr, tid_policy)) {
- printf("failed to parse nested stats attributes!");
+ wifi_debug(DEBUG_ERROR, "failed to parse nested stats attributes!");
return NL_SKIP;
}
}
@@ -17824,7 +17897,7 @@
}
/*deinit mtk nl80211 vendor msg*/
mtk_nl80211_deint(&unl_ins);
- wifi_debug(DEBUG_NOTICE, "set cmd success.\n");
+ wifi_debug(DEBUG_INFO, "set cmd success.\n");
return RETURN_OK;
err:
mtk_nl80211_deint(&unl_ins);
@@ -17870,7 +17943,7 @@
if (sinfo[NL80211_STA_INFO_TID_STATS]) {
if(nla_parse_nested(stats_info, NL80211_TID_STATS_MAX,sinfo[NL80211_STA_INFO_TID_STATS], tid_policy)) {
- printf("failed to parse nested stats attributes!");
+ wifi_debug(DEBUG_ERROR, "failed to parse nested rate attributes!");
return NL_SKIP;
}
}
@@ -17878,7 +17951,7 @@
if( nla_data(tb[NL80211_ATTR_VHT_CAPABILITY]) )
{
- printf("Type is VHT\n");
+ wifi_debug(DEBUG_INFO, "Type is VHT\n");
if(rinfo[NL80211_RATE_INFO_VHT_NSS])
((wifi_associated_dev_rate_info_rx_stats_t*)arg)->nss = nla_get_u8(rinfo[NL80211_RATE_INFO_VHT_NSS]);
@@ -17893,7 +17966,7 @@
if((rinfo[NL80211_RATE_INFO_10_MHZ_WIDTH]) || (rinfo[NL80211_RATE_INFO_5_MHZ_WIDTH]) )
((wifi_associated_dev_rate_info_rx_stats_t*)arg)->bw = 0;
} else {
- printf(" OFDM or CCK \n");
+ wifi_debug(DEBUG_INFO, "OFDM or CCK\n");
((wifi_associated_dev_rate_info_rx_stats_t*)arg)->bw = 0;
((wifi_associated_dev_rate_info_rx_stats_t*)arg)->nss = 0;
}
@@ -18014,14 +18087,14 @@
if(sinfo[NL80211_STA_INFO_TID_STATS])
{
if(nla_parse_nested(stats_info, NL80211_TID_STATS_MAX,sinfo[NL80211_STA_INFO_TID_STATS], tid_policy)) {
- printf("failed to parse nested stats attributes!");
+ wifi_debug(DEBUG_ERROR, "failed to parse nested rate attributes!");
return NL_SKIP;
}
}
if (tb[NL80211_ATTR_VHT_CAPABILITY]) {
if(nla_data(tb[NL80211_ATTR_VHT_CAPABILITY]))
{
- printf("Type is VHT\n");
+ wifi_debug(DEBUG_INFO, "Type is VHT\n");
if(rinfo[NL80211_RATE_INFO_VHT_NSS])
((wifi_associated_dev_rate_info_tx_stats_t*)arg)->nss = nla_get_u8(rinfo[NL80211_RATE_INFO_VHT_NSS]);
@@ -18038,7 +18111,7 @@
}
else
{
- printf(" OFDM or CCK \n");
+ wifi_debug(DEBUG_INFO, "OFDM or CCK\n");
((wifi_associated_dev_rate_info_tx_stats_t*)arg)->bw = 0;
((wifi_associated_dev_rate_info_tx_stats_t*)arg)->nss = 0;
}
@@ -18276,7 +18349,7 @@
if(access("/tmp/freq-channel-map.txt", F_OK)==-1)
{
- printf("Creating Frequency-Channel Map\n");
+ wifi_debug(DEBUG_OFF, "Creating Frequency-Channel Map\n");
v_secure_system("iw phy | grep 'MHz \\[' | cut -d' ' -f2,4 > /tmp/freq-channel-map.txt");
}
@@ -18304,7 +18377,7 @@
ieee80211_channel_to_frequency(channel, &freqMHz);
if (freqMHz == -1) {
- wifi_dbg_printf("%s: failed to get channel frequency for channel: %d\n", __func__, channel);
+ wifi_debug(DEBUG_ERROR, "failed to get channel frequency for channel: %d\n", channel);
return -1;
}
@@ -18323,7 +18396,7 @@
}
if (_syscmd_secure(buf, bufsz, "iw dev %s survey dump | grep -A5 %d | tr -d '\\t'", interface_name, freqMHz) == RETURN_ERR) {
- wifi_dbg_printf("%s: failed to execute '%s' for radioIndex=%d\n", __FUNCTION__, cmd, radioIndex);
+ wifi_debug(DEBUG_ERROR, "failed to execute '%s' for radioIndex=%d\n", cmd, radioIndex);
return -1;
}
@@ -18346,7 +18419,7 @@
val = strtok(NULL, " ");
if (val == NULL)
continue;
- wifi_dbg_printf("%s: key='%s' val='%s'\n", __func__, key, val);
+ wifi_debug(DEBUG_INFO, "key='%s' val='%s'\n", key, val);
if (!strcmp(key, "noise")) {
if (sscanf(val, "%d", &stats->ch_noise) == EOF)
@@ -18448,7 +18521,7 @@
if (number_of_channels == 0) {
if (wifi_getRadioChannel(radioIndex, &channel) != RETURN_OK) {
- wifi_dbg_printf("%s: cannot get current channel for radioIndex=%d\n", __func__, radioIndex);
+ wifi_debug(DEBUG_ERROR, "cannot get current channel for radioIndex=%d\n", radioIndex);
return RETURN_ERR;
}
number_of_channels = 1;
@@ -18469,7 +18542,7 @@
return RETURN_ERR;
}
if (fetch_survey_from_buf(radioIndex, buf, &input_output_channelStats_array[i])) {
- wifi_dbg_printf("%s: cannot fetch survey from buf for radioIndex=%d\n", __func__, radioIndex);
+ wifi_debug(DEBUG_ERROR, "cannot fetch survey from buf for radioIndex=%d\n", radioIndex);
return RETURN_ERR;
}
@@ -18483,7 +18556,7 @@
input_output_channelStats_array[i].ch_utilization_busy *= 1000;
input_output_channelStats_array[i].ch_utilization_total *= 1000;
- wifi_dbg_printf("%s: ch_number=%d ch_noise=%d total=%llu busy=%llu busy_rx=%llu busy_tx=%llu busy_self=%llu busy_ext=%llu\n",
+ wifi_debug(DEBUG_INFO, "%s: ch_number=%d ch_noise=%d total=%llu busy=%llu busy_rx=%llu busy_tx=%llu busy_self=%llu busy_ext=%llu\n",
__func__,
input_output_channelStats_array[i].ch_number,
input_output_channelStats_array[i].ch_noise,
@@ -18547,7 +18620,7 @@
wpa_ctrl_detach(ctrl->wpa);
wpa_ctrl_close(ctrl->wpa);
ctrl->wpa = NULL;
- printf("WPA_CTRL: closed index=%d\n", ctrl->ssid_index);
+ wifi_debug(DEBUG_OFF, "WPA_CTRL: closed index=%d\n", ctrl->ssid_index);
}
static void ctrl_process(struct ctrl *ctrl)
@@ -18608,12 +18681,12 @@
}
if (strncmp("CTRL-EVENT-TERMINATING", str, 22) == 0) {
- printf("CTRL_WPA: handle TERMINATING event\n");
+ wifi_debug(DEBUG_ERROR, "CTRL_WPA: handle TERMINATING event\n");
goto retry;
}
if (strncmp("AP-DISABLED", str, 11) == 0) {
- printf("CTRL_WPA: handle AP-DISABLED\n");
+ wifi_debug(DEBUG_ERROR, "CTRL_WPA: handle AP-DISABLED\n");
goto retry;
}
@@ -18622,7 +18695,7 @@
handled:
if ((drops = ctrl_get_drops(ctrl))) {
- printf("WPA_CTRL: dropped %d messages index=%d\n", drops, ctrl->ssid_index);
+ wifi_debug(DEBUG_OFF, "WPA_CTRL: dropped %d messages index=%d\n", drops, ctrl->ssid_index);
if (ctrl->overrun)
ctrl->overrun(ctrl);
}
@@ -18630,9 +18703,9 @@
return;
retry:
- printf("WPA_CTRL: closing\n");
+ wifi_debug(DEBUG_ERROR, "WPA_CTRL: closing\n");
ctrl_close(ctrl);
- printf("WPA_CTRL: retrying from ctrl prcoess\n");
+ wifi_debug(DEBUG_ERROR, "WPA_CTRL: retrying from ctrl prcoess\n");
ev_timer_again(evloop, &ctrl->retry);
}
@@ -18695,7 +18768,7 @@
{
struct ctrl *ctrl = container_of(stat, struct ctrl, stat);
- printf("WPA_CTRL: index=%d file state changed\n", ctrl->ssid_index);
+ wifi_debug(DEBUG_OFF, "WPA_CTRL: index=%d file state changed\n", ctrl->ssid_index);
ctrl_open(ctrl);
}
@@ -18705,7 +18778,7 @@
wifi_debug(DEBUG_INFO, "WPA_CTRL: index=%d retrying\n", ctrl->ssid_index);
if (ctrl_open(ctrl) == 0) {
- printf("WPA_CTRL: retry successful\n");
+ wifi_debug(DEBUG_OFF, "WPA_CTRL: retry successful\n");
ev_timer_stop(evloop, &ctrl->retry);
}
}
@@ -18732,7 +18805,8 @@
{
struct ctrl *ctrl = container_of(buf, struct ctrl, reply);
- printf("WPA_CTRL: unsolicited message: index=%d len=%zu msg=%s", ctrl->ssid_index, len, buf);
+ wifi_debug(DEBUG_INFO, "WPA_CTRL: unsolicited message: index=%d len=%zu msg=%s\n",
+ ctrl->ssid_index, len, buf);
ctrl_process(ctrl);
}
@@ -18777,18 +18851,18 @@
ret = wifi_getSSIDNumberOfEntries(&snum);
if (ret != RETURN_OK) {
- printf("%s: failed to get SSID count", __func__);
+ wifi_debug(DEBUG_ERROR, "failed to get SSID count\n");
return;
}
if (snum > MAX_APS) {
- printf("more ssid than supported! %lu\n", snum);
+ wifi_debug(DEBUG_ERROR, "more ssid than supported! %lu\n", snum);
return;
}
for (s = 0; s < snum; s++) {
if (wifi_getApEnable(s, &status) != RETURN_OK) {
- printf("%s: failed to get AP Enable for index: %lu\n", __func__, s);
+ wifi_debug(DEBUG_ERROR, "failed to get AP Enable for index: %lu\n", s);
continue;
}
if (status == false) continue;
@@ -18800,9 +18874,10 @@
if (err == 0 && len > strlen(pong) && !strncmp(reply, pong, strlen(pong)))
continue;
- printf("WPA_CTRL: ping timeout index=%d\n", wpa_ctrl[s].ssid_index);
+ wifi_debug(DEBUG_OFF, "WPA_CTRL: ping timeout index=%d\n", wpa_ctrl[s].ssid_index);
+
ctrl_close(&wpa_ctrl[s]);
- printf("WPA_CTRL: ev_timer_again %lu\n", s);
+ wifi_debug(DEBUG_OFF, "WPA_CTRL: ev_timer_again %lu\n", s);
ev_timer_again(evloop, &wpa_ctrl[s].retry);
}
}
@@ -18822,12 +18897,12 @@
ret = wifi_getSSIDNumberOfEntries(&snum);
if (ret != RETURN_OK) {
- printf("%s: failed to get SSID count", __func__);
+ wifi_debug(DEBUG_ERROR, "failed to get SSID count\n");
return RETURN_ERR;
}
if (snum > MAX_APS) {
- printf("more ssid than supported! %lu\n", snum);
+ wifi_debug(DEBUG_ERROR, "more ssid than supported! %lu\n", snum);
return RETURN_ERR;
}
evloop = ev_loop_new(0);
@@ -18853,7 +18928,7 @@
return RETURN_ERR;
}
initialized = 1;
- printf("WPA_CTRL: initialized\n");
+ wifi_debug(DEBUG_OFF, "WPA_CTRL: initialized\n");
return RETURN_OK;
}
@@ -18939,7 +19014,7 @@
}
if (_syscmd_secure(channel_numbers_buf, sizeof(channel_numbers_buf), "iw phy phy%d info | grep -e '\\*.*MHz .*dBm' | grep -v '%sno IR\\|5340\\|5480' | awk '{print $4}' | tr -d '[]'", phyId, dfs_enable?"":"radar\\|") == RETURN_ERR) {
- wifi_dbg_printf("%s: failed to execute '%s'\n", __FUNCTION__, cmd);
+ wifi_debug(DEBUG_ERROR, "failed to execute '%s'\n", cmd);
return RETURN_ERR;
}
@@ -18947,7 +19022,7 @@
i = 0;
while ((ptr = get_line_from_str_buf(ptr, line))) {
if (i >= outputMapSize) {
- wifi_dbg_printf("%s: DFS map size too small\n", __FUNCTION__);
+ wifi_debug(DEBUG_ERROR, "DFS map size too small\n");
return RETURN_ERR;
}
if (sscanf(line, "%d", &outputMap[i].ch_number) != 1) {
@@ -18959,17 +19034,17 @@
// Below command should fetch string for DFS state (usable, available or unavailable)
// Example line: "DFS state: usable (for 78930 sec)"
if (sprintf(cmd,"iw list | grep -A 2 '\\[%d\\]' | tr -d '\\t' | grep 'DFS state' | awk '{print $3}' | tr -d '\\n'", outputMap[i].ch_number) < 0) {
- wifi_dbg_printf("%s: failed to build dfs state command\n", __FUNCTION__);
+ wifi_debug(DEBUG_ERROR, "failed to build dfs state command\n");
return RETURN_ERR;
}
memset(dfs_state_buf, 0, sizeof(dfs_state_buf));
if (_syscmd_secure(dfs_state_buf, sizeof(dfs_state_buf),"iw list | grep -A 2 '\\[%d\\]' | tr -d '\\t' | grep 'DFS state' | awk '{print $3}' | tr -d '\\n'", outputMap[i].ch_number) == RETURN_ERR) {
- wifi_dbg_printf("%s: failed to execute '%s'\n", __FUNCTION__, cmd);
+ wifi_debug(DEBUG_ERROR, "failed to execute '%s'\n", cmd);
return RETURN_ERR;
}
- wifi_dbg_printf("DFS state = '%s'\n", dfs_state_buf);
+ wifi_debug(DEBUG_INFO, "DFS state = '%s'\n", dfs_state_buf);
if (!strcmp(dfs_state_buf, "usable")) {
outputMap[i].ch_state = CHAN_STATE_DFS_NOP_FINISHED;
@@ -18985,7 +19060,7 @@
return RETURN_OK;
- wifi_dbg_printf("%s: wrong radio index (%d)\n", __FUNCTION__, radioIndex);
+ wifi_debug(DEBUG_ERROR, "wrong radio index (%d)\n", radioIndex);
return RETURN_ERR;
}
@@ -19193,12 +19268,12 @@
WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
if ((mu_type < WIFI_DL_MU_TYPE_NONE)
|| (mu_type > WIFI_DL_MU_TYPE_OFDMA_MIMO)) {
- printf("%s:mu_type input Error", __func__);
+ wifi_debug(DEBUG_ERROR, "%s:mu_type input Error", __func__);
return RETURN_ERR;
}
band = radio_index_to_band(radio_index);
if (band == band_invalid) {
- printf("%s:Band Error\n", __func__);
+ wifi_debug(DEBUG_ERROR, "%s:Band Error\n", __func__);
return RETURN_ERR;
}
res = snprintf(dat_file, sizeof(dat_file), "%s%d.dat", LOGAN_DAT_FILE, band);
@@ -19216,7 +19291,7 @@
WIFI_ENTRY_EXIT_DEBUG("bss number: %d\n", bss_cnt);
if ((val_cnt >= sizeof(new_ofdmabuf))
|| (val_cnt >= sizeof(new_mimobuf))) {
- printf("%s:bss cnt Error", __func__);
+ wifi_debug(DEBUG_ERROR, "%s:bss cnt Error", __func__);
return RETURN_ERR;
}
/*translate set value*/
@@ -19237,7 +19312,8 @@
/*same value, not operation*/
if ((strncmp(new_mimobuf, mimobuf, 1) ==0)
&& (strncmp(new_ofdmabuf, ofdmabuf, 1) ==0)) {
- printf("%s:Reduntant value\n", __func__);
+ wifi_debug(DEBUG_ERROR, "%s:Reduntant value\n", __func__);
+
return RETURN_OK;
}
/*modify dat file to new file*/
@@ -19269,7 +19345,7 @@
return RETURN_ERR;
band = radio_index_to_band(radio_index);
if (band == band_invalid) {
- printf("%s:Band Error\n", __func__);
+ wifi_debug(DEBUG_ERROR, "%s:Band Error\n", __func__);
return RETURN_ERR;
}
res = snprintf(dat_file, sizeof(dat_file), "%s%d.dat", LOGAN_DAT_FILE, band);
@@ -19332,12 +19408,12 @@
WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
band = radio_index_to_band(radio_index);
if (band == band_invalid) {
- printf("%s:Band Error\n", __func__);
+ wifi_debug(DEBUG_ERROR, "%s:Band Error\n", __func__);
return RETURN_ERR;
}
if ((mu_type < WIFI_UL_MU_TYPE_NONE)
|| (mu_type > WIFI_UL_MU_TYPE_OFDMA)) {
- printf("%s:mu_type input Error\n", __func__);
+ wifi_debug(DEBUG_ERROR, "%s:mu_type input Error\n", __func__);
return RETURN_ERR;
}
res = snprintf(dat_file, sizeof(dat_file), "%s%d.dat", LOGAN_DAT_FILE, band);
@@ -19351,10 +19427,10 @@
WIFI_ENTRY_EXIT_DEBUG("%s:ofdma-%s, mimo-%s\n", __func__, ofdmabuf, mimobuf);
get_bssnum_byindex(radio_index, &bss_cnt);
val_cnt = 2*bss_cnt - 1;
- printf("bssNumber:%d,ValCnt:%d\n", bss_cnt, val_cnt);
+ wifi_debug(DEBUG_INFO, "bssNumber:%d,ValCnt:%d\n", bss_cnt, val_cnt);
if ((val_cnt >= sizeof(new_ofdmabuf))
|| (val_cnt >= sizeof(new_mimobuf))) {
- printf("%s:bss cnt Error\n", __func__);
+ wifi_debug(DEBUG_ERROR, "bss cnt Error\n");
return RETURN_ERR;
}
/*translate set value*/
@@ -19366,11 +19442,11 @@
strncpy(new_ofdmabuf, str_one, val_cnt);
strncpy(new_mimobuf, str_zero, val_cnt);
}
- printf("%s:new_ofdmabuf-%s, new_mimobuf-%s\n", __func__, new_ofdmabuf, new_mimobuf);
+ wifi_debug(DEBUG_INFO, "new_ofdmabuf-%s, new_mimobuf-%s\n", new_ofdmabuf, new_mimobuf);
/*same value, not operation*/
if ((strncmp(new_mimobuf, mimobuf, 1) ==0)
&& (strncmp(new_ofdmabuf, ofdmabuf, 1) ==0)) {
- printf("%s:Reduntant value\n", __func__);
+ wifi_debug(DEBUG_ERROR, "Reduntant value\n");
return RETURN_OK;
}
/*modify dat file to new file*/
@@ -19402,7 +19478,7 @@
return RETURN_ERR;
band = radio_index_to_band(radio_index);
if (band == band_invalid) {
- printf("%s:Band Error", __func__);
+ wifi_debug(DEBUG_ERROR, "%s:Band Error", __func__);
return RETURN_ERR;
}
res = snprintf(dat_file, sizeof(dat_file), "%s%d.dat", LOGAN_DAT_FILE, band);
@@ -19461,14 +19537,14 @@
WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
if (wifi_getRadioMode(radio_index, buf, &mode_map) == RETURN_ERR) {
- wifi_dbg_printf("%s: wifi_getRadioMode return error\n", __func__);
+ wifi_debug(DEBUG_ERROR, "wifi_getRadioMode return error\n");
return RETURN_ERR;
}
/*sanity check*/
if (((guard_interval == wifi_guard_interval_1600)
|| (guard_interval == wifi_guard_interval_3200))
&& ((mode_map & (WIFI_MODE_BE | WIFI_MODE_AX)) == 0)) {
- wifi_dbg_printf("%s: N/AC Mode not support 1600/3200ns GI\n", __func__);
+ wifi_debug(DEBUG_ERROR, "N/AC Mode not support 1600/3200ns GI\n");
return RETURN_ERR;
}
res = snprintf(config_file, sizeof(config_file), "%s%d.conf", CONFIG_PREFIX, radio_index);
@@ -19600,7 +19676,7 @@
int res;
if (color < 1 || color > 63) {
- wifi_dbg_printf("color value is err:%d.\n", color);
+ wifi_debug(DEBUG_ERROR, "color value is err:%d.\n", color);
return RETURN_ERR;
}
params.name = "he_bss_color";
@@ -19632,7 +19708,6 @@
int res;
unsigned long tmp;
- wifi_dbg_printf("\nFunc=%s\n", __func__);
if (NULL == color)
return RETURN_ERR;
@@ -19657,7 +19732,7 @@
wifi_debug(DEBUG_ERROR, "Unexpected strtoul fail\n");
}
*color = tmp;
- wifi_dbg_printf("\noutput_string=%s\n", color);
+ wifi_debug(DEBUG_INFO, "output_string=%s\n", color);
return RETURN_OK;
}
@@ -19685,7 +19760,7 @@
wifi_debug(DEBUG_ERROR, "Unexpected snprintf fail\n");
return RETURN_ERR;
}
- printf("DEBUG LOG wifi_getMultiPskClientKey(%s)\n",cmd);
+ wifi_debug(DEBUG_INFO, "DEBUG LOG wifi_getMultiPskClientKey(%s)\n",cmd);
res = _syscmd_secure(key->wifi_keyId, 64, "hostapd_cli -i %s sta %x:%x:%x:%x:%x:%x |grep '^keyid' | cut -f 2 -d = | tr -d '\n'",interface_name,mac[0],mac[1],mac[2], mac[3], mac[4], mac[5]);
if(res) {
@@ -19790,7 +19865,7 @@
pos++;
//Here should be 00:00:00:00:00:00
if (!(strcmp(pos,"00:00:00:00:00:00"))) {
- printf("Not supported MAC: %s\n", pos);
+ wifi_debug(DEBUG_ERROR, "Not supported MAC: %s\n", pos);
}
if (!(pos = index(pos, ' '))) {
ret = RETURN_ERR;
@@ -19838,7 +19913,7 @@
unsigned char hex_ssid_len;
/*rmeove all neighbors*/
- wifi_dbg_printf("\n[%s]: removing all neighbors from %s\n", __func__, interface_name);
+ wifi_debug(DEBUG_INFO, "removing all neighbors from %s\n", interface_name);
if (wifi_GetInterfaceName(apIndex, interface_name) != RETURN_OK)
return RETURN_ERR;
@@ -21329,7 +21404,7 @@
int ret, bss_num, i;
char ret_buf[MAX_BUF_SIZE] = {0};
BOOL enabled = FALSE;
- struct timeval tv_now;
+ int bss_idx;
ret = wifi_BandProfileRead(0, index, "BssidNum", ret_buf, sizeof(ret_buf), "1");
if (ret != 0) {
@@ -21345,7 +21420,7 @@
wifi_debug(DEBUG_ERROR, "bss_num is larger than %d, use %d\n", LOGAN_MAX_NUM_VAP_PER_RADIO, LOGAN_MAX_NUM_VAP_PER_RADIO);
bss_num = LOGAN_MAX_NUM_VAP_PER_RADIO;
}
- wifi_debug(DEBUG_ERROR, "band %d BssidNum %d\n", index, bss_num);
+ wifi_debug(DEBUG_OFF, "band %d BssidNum %d\n", index, bss_num);
WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
@@ -21355,10 +21430,20 @@
wifi_debug(DEBUG_ERROR, "wifi_getRadioEnable return error.\n");
return RETURN_ERR;
}
- if (enabled == FALSE && operationParam->enable == TRUE) {
- wifi_setRadioEnable(index, TRUE);
- gettimeofday(&tv_now, NULL);
- radio_start_uptime[index] = wifi_getSystemUpSecs();
+ if (operationParam->enable == TRUE) {
+ if (enabled == FALSE) {
+ wifi_setRadioEnable(index, TRUE);
+ radio_start_uptime[index] = wifi_getSystemUpSecs();
+ } else {
+ for (bss_idx = 0; bss_idx < bss_num; bss_idx++) {
+ if (array_index_to_vap_index(index, bss_idx, &ApIndex) != RETURN_OK) {
+ wifi_debug(DEBUG_ERROR, "invalid radioIndex %d, bss_idx %d\n", index, bss_idx);
+ continue;
+ }
+ if (getVapEnableConfig(ApIndex) == TRUE)
+ wifi_setApEnable(ApIndex, TRUE);
+ }
+ }
} else if (enabled == TRUE && operationParam->enable == FALSE) {
wifi_setRadioEnable(index, FALSE);
return RETURN_OK;
@@ -21615,7 +21700,7 @@
UCHAR country_find = FALSE;
WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
- printf("Entering %s index = %d\n", __func__, (int)index);
+ wifi_debug(DEBUG_OFF, "Entering %s index = %d\n", __func__, (int)index);
memset(operationParam, 0, sizeof(wifi_radio_operationParam_t));
res = snprintf(dat_file, sizeof(dat_file), "%s%d.dat", LOGAN_DAT_FILE, index);
@@ -21955,7 +22040,7 @@
unsigned char mld_index;
WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
- printf("Entering %s index = %d\n", __func__, (int)index);
+ wifi_debug(DEBUG_OFF, "Entering %s index = %d\n", __func__, (int)index);
memset((void *)map, 0, sizeof(*map));
ret = wifi_BandProfileRead(0, index, "BssidNum", buf, sizeof(buf), "0");
@@ -22123,7 +22208,7 @@
mld_info->common_info.mld_enable = TRUE;
mld_info->common_info.mld_id = mld_index;
}
- wifi_debug(DEBUG_ERROR,
+ wifi_debug(DEBUG_OFF,
"vap_index[%d], mld_enable=%d, mld_id[%d]\n",
vap->vap_index, mld_info->common_info.mld_enable, mld_info->common_info.mld_id);
}
@@ -22183,7 +22268,7 @@
return RETURN_ERR;
}
- wifi_debug(DEBUG_ERROR, "raw ADD bss_config config_file=%s\n", config_file);
+ wifi_debug(DEBUG_OFF, "raw ADD bss_config config_file=%s\n", config_file);
res = _syscmd_secure(buf, sizeof(buf), "hostapd_cli -i global raw ADD bss_config=phy%d:%s", phyId, config_file);
if (res) {
@@ -22192,8 +22277,6 @@
}
} else {
- wifi_debug(DEBUG_ERROR, "%s %d\n", __func__, __LINE__);
-
wifi_debug(DEBUG_ERROR, "global raw REMOVE %s\n", interface_name);
res = _syscmd_secure(buf, sizeof(buf), "hostapd_cli -i global raw REMOVE %s", interface_name);
if (res) {
@@ -22265,7 +22348,7 @@
wifi_debug(DEBUG_ERROR, "Unexpected snprintf fail\n");
return RETURN_ERR;
}
- wifi_debug(DEBUG_ERROR, "set bridge to %s in %s\n", bridge_name, config_file);
+ wifi_debug(DEBUG_OFF, "set bridge to %s in %s\n", bridge_name, config_file);
param.name = "bridge";
param.value = bridge_name;
@@ -22345,7 +22428,7 @@
struct params params[1];
WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
- printf("Entering %s radio[%d], map->num_vaps = %d\n", __func__, (int)index, map->num_vaps);
+ wifi_debug(DEBUG_OFF, "Entering %s radio[%d], map->num_vaps = %d\n", __func__, (int)index, map->num_vaps);
for (i = 0; i < map->num_vaps; i++) {
hostapd_if_restart = 0;
multiple_set = TRUE;
@@ -22368,7 +22451,7 @@
wifi_setApEnable(vap_info->vap_index, TRUE);
}
- wifi_debug(DEBUG_ERROR, "\nCreate VAP for vap_info->vap_index=%d\n", vap_info->vap_index);
+ wifi_debug(DEBUG_OFF, "\nCreate VAP for vap_info->vap_index=%d\n", vap_info->vap_index);
band_idx = radio_index_to_band(index);
res = snprintf(config_file, sizeof(config_file), "%s%d.conf", CONFIG_PREFIX, vap_info->vap_index);
@@ -22520,7 +22603,7 @@
vap_info = &map->vap_array[i];
mld_info = &vap_info->u.bss_info.mld_info.common_info;
- wifi_debug(DEBUG_ERROR, "process mlo operation\n");
+ wifi_debug(DEBUG_INFO, "process mlo operation\n");
if (!mld_info->mld_enable) {
wifi_debug(DEBUG_ERROR, "disable mlo on vap[%d], vap->enabled=%d\n",
(int)vap_info->vap_index, vap_info->u.bss_info.enabled);
@@ -22671,7 +22754,8 @@
/* get radio channels cabability */
status = wifi_getRadioCapChannels(radioIndex, pchannels);
{
- printf("[wifi_hal dbg] : func[%s] line[%d] error_ret[%d] radio_index[%d] output[%s]\n", __FUNCTION__, __LINE__, status, radioIndex, pchannels);
+ wifi_debug(DEBUG_OFF, "[wifi_hal dbg] : error_ret[%d] radio_index[%d] output[%s]\n",
+ status, radioIndex, pchannels);
}
/* Number of channels and list*/
chlistp->num_channels = parse_channel_list_int_arr(pchannels, chlistp);
@@ -22691,10 +22775,11 @@
memset(output_string, 0, sizeof(output_string));
status = wifi_getRadioCountryCode(radioIndex, output_string);
if (status != 0) {
- printf("[wifi_hal dbg] : func[%s] line[%d] error_ret[%d] radio_index[%d] output[%s]\n", __FUNCTION__, __LINE__, status, radioIndex, output_string);
+ wifi_debug(DEBUG_ERROR, "[wifi_hal dbg] : error_ret[%d] radio_index[%d] output[%s]\n",
+ status, radioIndex, output_string);
return RETURN_ERR;
} else
- printf("[wifi_hal dbg] : func[%s] line[%d], output [%s]\n", __FUNCTION__, __LINE__, output_string);
+ wifi_debug(DEBUG_OFF, "[wifi_hal dbg] : output [%s]\n", output_string);
rcap->numcountrySupported = ARRAY_SIZE(all_country_code);
@@ -22819,7 +22904,7 @@
{
status = getRadioCapabilities(radioIndex, &(cap->wifi_prop.radiocap[radioIndex]));
if (status != 0) {
- printf("%s: getRadioCapabilities idx = %d\n", __FUNCTION__, radioIndex);
+ wifi_debug(DEBUG_ERROR, "getRadioCapabilities idx = %d\n", radioIndex);
return RETURN_ERR;
}
@@ -22827,7 +22912,7 @@
{
if (iter >= (get_runtime_max_radio() * MAX_NUM_VAP_PER_RADIO))
{
- printf("%s: to many vaps for index map (%d)\n", __func__, iter);
+ wifi_debug(DEBUG_ERROR, "to many vaps for index map (%d)\n", iter);
return RETURN_ERR;
}
iface_info = &cap->wifi_prop.interface_map[iter];
@@ -23520,7 +23605,7 @@
else
*enable = FALSE;
- wifi_dbg_printf("\n[%s]: proxy_arp is : %s", __func__, output);
+ wifi_debug(DEBUG_INFO, "proxy_arp is : %s\n", output);
return RETURN_OK;
}
@@ -23581,7 +23666,7 @@
}
f = v_secure_popen("r", "cat /sys/kernel/debug/ieee80211/phy%d/mt76/twt_stats | tail -n %d | tr '|' ' ' | tr -s ' '", phyId, *numSessionReturned);
if (f == NULL) {
- wifi_dbg_printf("%s: v_secure_popen %s error\n", __func__, cmd);
+ wifi_debug(DEBUG_ERROR, "v_secure_popen %s error\n", cmd);
return RETURN_ERR;
}
@@ -23706,7 +23791,7 @@
}
/*deinit mtk nl80211 vendor msg*/
mtk_nl80211_deint(&unl_ins);
- wifi_debug(DEBUG_NOTICE, " %s cmd success.\n", inf_name);
+ wifi_debug(DEBUG_INFO, " %s cmd success.\n", inf_name);
}
return RETURN_OK;