From 54bf7d7bd5a7d486b3a3f61877dcd82cc26658a4 Mon Sep 17 00:00:00 2001 From: Yuguo Zou Date: Wed, 12 Jul 2017 12:13:05 +0800 Subject: [PATCH] mute wifi_conf messages --- .../sdk/common/api/wifi/wifi_conf.c | 56 ++++++++++--------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/targets/TARGET_Realtek/TARGET_AMEBA/sdk/common/api/wifi/wifi_conf.c b/targets/TARGET_Realtek/TARGET_AMEBA/sdk/common/api/wifi/wifi_conf.c index 4aa147ad60..199d760a9d 100644 --- a/targets/TARGET_Realtek/TARGET_AMEBA/sdk/common/api/wifi/wifi_conf.c +++ b/targets/TARGET_Realtek/TARGET_AMEBA/sdk/common/api/wifi/wifi_conf.c @@ -30,6 +30,12 @@ #if CONFIG_EXAMPLE_UART_ATCMD #include "at_cmd/atcmd_wifi.h" #endif +extern u32 GlobalDebugEnable; +#define WIFI_CONF_MSG(...) do {\ + if (GlobalDebugEnable) \ + printf("\r" __VA_ARGS__);\ +}while(0) + #if CONFIG_INIC_EN extern int inic_start(void); extern int inic_stop(void); @@ -195,7 +201,7 @@ static int wifi_connect_local(rtw_network_info_t *pWifi) break; default: ret = -1; - printf("\n\rWIFICONF: security type(0x%x) is not supported.\n\r", pWifi->security_type); + WIFI_CONF_MSG("\n\rWIFICONF: security type(0x%x) is not supported.\n\r", pWifi->security_type); break; } if(ret == 0) @@ -244,7 +250,7 @@ static int wifi_connect_bssid_local(rtw_network_info_t *pWifi) break; default: ret = -1; - printf("\n\rWIFICONF: security type(0x%x) is not supported.\n\r", pWifi->security_type); + WIFI_CONF_MSG("\n\rWIFICONF: security type(0x%x) is not supported.\n\r", pWifi->security_type); break; } if(ret == 0){ @@ -351,7 +357,7 @@ void restore_wifi_info_to_flash() if(data_to_flash && p_write_reconnect_ptr){ if(wifi_get_setting((const char*)ifname[0],&setting) || setting.mode == RTW_MODE_AP){ - printf("\r\n %s():wifi_get_setting fail or ap mode", __func__); + WIFI_CONF_MSG("\r\n %s():wifi_get_setting fail or ap mode", __func__); return; } channel = setting.channel; @@ -515,7 +521,7 @@ int wifi_connect( #ifdef CONFIG_ENABLE_EAP if(get_eap_phase()){ if(rtw_down_timeout_sema( &join_result->join_sema, 60000 ) == RTW_FALSE) { - printf("RTW API: Join bss timeout\r\n"); + WIFI_CONF_MSG("RTW API: Join bss timeout\r\n"); if(password_len) { rtw_free(join_result->network_info.password); } @@ -531,7 +537,7 @@ int wifi_connect( else #endif if(rtw_down_timeout_sema( &join_result->join_sema, RTW_JOIN_TIMEOUT ) == RTW_FALSE) { - printf("RTW API: Join bss timeout\r\n"); + WIFI_CONF_MSG("RTW API: Join bss timeout\r\n"); if(password_len) { rtw_free(join_result->network_info.password); } @@ -641,7 +647,7 @@ int wifi_connect_bssid( if(semaphore == NULL) { if(rtw_down_timeout_sema( &join_result->join_sema, RTW_JOIN_TIMEOUT ) == RTW_FALSE) { - printf("RTW API: Join bss timeout\r\n"); + WIFI_CONF_MSG("RTW API: Join bss timeout\r\n"); if(password_len) { rtw_free(join_result->network_info.password); } @@ -685,7 +691,7 @@ int wifi_disconnect(void) const __u8 null_bssid[ETH_ALEN + 2] = {0, 0, 0, 0, 0, 1, 0, 0}; if (wext_set_bssid(WLAN0_NAME, null_bssid) < 0){ - printf("\n\rWEXT: Failed to set bogus BSSID to disconnect"); + WIFI_CONF_MSG("\n\rWEXT: Failed to set bogus BSSID to disconnect"); ret = -1; } return ret; @@ -918,7 +924,7 @@ int wifi_on(rtw_mode_t mode) static int event_init = 0; if(rltk_wlan_running(WLAN0_IDX)) { - printf("\n\rWIFI is already running"); + WIFI_CONF_MSG("\n\rWIFI is already running"); return 1; } @@ -934,7 +940,7 @@ int wifi_on(rtw_mode_t mode) // set wifi mib wifi_set_mib(); - printf("\n\rInitializing WIFI ..."); + WIFI_CONF_MSG("\n\rInitializing WIFI ..."); for(idx=0;idxssid, reconnect_param->security_type, reconnect_param->password, reconnect_param->ssid_len, reconnect_param->password_len, reconnect_param->key_id, NULL); #if DEVICE_EMAC @@ -1797,7 +1803,7 @@ static void wifi_autoreconnect_thread(void *param) #if LWIP_AUTOIP uint8_t *ip = LwIP_GetIP(&xnetif[0]); if((ip[0] == 0) && (ip[1] == 0) && (ip[2] == 0) && (ip[3] == 0)) { - printf("\n\nIPv4 AUTOIP ..."); + WIFI_CONF_MSG("\n\nIPv4 AUTOIP ..."); LwIP_AUTOIP(&xnetif[0]); } #endif @@ -1822,7 +1828,7 @@ void wifi_autoreconnect_hdl(rtw_security_t security_type, param.key_id = key_id; if(!rtw_create_task(&g_wifi_auto_reconnect_task,"wifi_autoreconnect",512,TASK_PRORITY_IDEL+1,wifi_autoreconnect_thread, ¶m)) - printf("\n\rTCP ERROR: Create TCP server task failed."); + WIFI_CONF_MSG("\n\rTCP ERROR: Create TCP server task failed."); } int wifi_config_autoreconnect(__u8 mode, __u8 retry_times, __u16 timeout)