Update and mute debug messages from wifi

pull/4760/head
Yuguo Zou 2017-06-29 16:40:01 +08:00 committed by adbridge
parent 6d0badf8f8
commit 51a7036e21
8 changed files with 54 additions and 46 deletions

View File

@ -90,7 +90,9 @@ RTWInterface::RTWInterface()
{ {
emac_interface_t *emac; emac_interface_t *emac;
int ret; int ret;
extern u32 GlobalDebugEnable;
GlobalDebugEnable = 0;
emac = wlan_emac_init_interface(); emac = wlan_emac_init_interface();
if (!emac) { if (!emac) {
printf("Error init RTWInterface!\r\n"); printf("Error init RTWInterface!\r\n");

View File

@ -20,6 +20,12 @@
#include <wifi/wifi_ind.h> #include <wifi/wifi_ind.h>
#include <osdep_service.h> #include <osdep_service.h>
extern u32 GlobalDebugEnable;
#define WIFI_UTIL_MSG(...) do {\
if (GlobalDebugEnable) \
printf("\r" __VA_ARGS__);\
}while(0)
int iw_ioctl(const char *ifname, unsigned long request, struct iwreq *pwrq) int iw_ioctl(const char *ifname, unsigned long request, struct iwreq *pwrq)
{ {
memcpy(pwrq->ifr_name, ifname, 5); memcpy(pwrq->ifr_name, ifname, 5);
@ -36,7 +42,7 @@ int wext_get_ssid(const char *ifname, __u8 *ssid)
iwr.u.essid.length = 32; iwr.u.essid.length = 32;
if (iw_ioctl(ifname, SIOCGIWESSID, &iwr) < 0) { if (iw_ioctl(ifname, SIOCGIWESSID, &iwr) < 0) {
printf("\n\rioctl[SIOCGIWESSID] ssid = NULL, not connected"); //do not use perror WIFI_UTIL_MSG("\n\rioctl[SIOCGIWESSID] ssid = NULL, not connected"); //do not use perror
ret = -1; ret = -1;
} else { } else {
ret = iwr.u.essid.length; ret = iwr.u.essid.length;
@ -65,7 +71,7 @@ int wext_set_ssid(const char *ifname, const __u8 *ssid, __u16 ssid_len)
iwr.u.essid.flags = (ssid_len != 0); iwr.u.essid.flags = (ssid_len != 0);
if (iw_ioctl(ifname, SIOCSIWESSID, &iwr) < 0) { if (iw_ioctl(ifname, SIOCSIWESSID, &iwr) < 0) {
printf("\n\rioctl[SIOCSIWESSID] error"); WIFI_UTIL_MSG("\n\rioctl[SIOCSIWESSID] error");
ret = -1; ret = -1;
} }
@ -86,7 +92,7 @@ int wext_set_bssid(const char *ifname, const __u8 *bssid)
} }
if (iw_ioctl(ifname, SIOCSIWAP, &iwr) < 0) { if (iw_ioctl(ifname, SIOCSIWAP, &iwr) < 0) {
printf("\n\rioctl[SIOCSIWAP] error"); WIFI_UTIL_MSG("\n\rioctl[SIOCSIWAP] error");
ret = -1; ret = -1;
} }
@ -108,7 +114,7 @@ int wext_set_auth_param(const char *ifname, __u16 idx, __u32 value)
iwr.u.param.value = value; iwr.u.param.value = value;
if (iw_ioctl(ifname, SIOCSIWAUTH, &iwr) < 0) { if (iw_ioctl(ifname, SIOCSIWAUTH, &iwr) < 0) {
printf("\n\rWEXT: SIOCSIWAUTH(param %d value 0x%x) failed)", idx, value); WIFI_UTIL_MSG("\n\rWEXT: SIOCSIWAUTH(param %d value 0x%x) failed)", idx, value);
} }
return ret; return ret;
@ -162,7 +168,7 @@ int wext_set_key_ext(const char *ifname, __u16 alg, const __u8 *addr, int key_id
if (iw_ioctl(ifname, SIOCSIWENCODEEXT, &iwr) < 0) { if (iw_ioctl(ifname, SIOCSIWENCODEEXT, &iwr) < 0) {
ret = -2; ret = -2;
printf("\n\rioctl[SIOCSIWENCODEEXT] set key fail"); WIFI_UTIL_MSG("\n\rioctl[SIOCSIWENCODEEXT] set key fail");
} }
rtw_free(ext); rtw_free(ext);
@ -184,7 +190,7 @@ int wext_get_enc_ext(const char *ifname, __u16 *alg, __u8 *key_idx, __u8 *passph
iwr.u.encoding.pointer = ext; iwr.u.encoding.pointer = ext;
if (iw_ioctl(ifname, SIOCGIWENCODEEXT, &iwr) < 0) { if (iw_ioctl(ifname, SIOCGIWENCODEEXT, &iwr) < 0) {
printf("\n\rioctl[SIOCGIWENCODEEXT] error"); WIFI_UTIL_MSG("\n\rioctl[SIOCGIWENCODEEXT] error");
ret = -1; ret = -1;
} }
else else
@ -213,7 +219,7 @@ int wext_set_passphrase(const char *ifname, const __u8 *passphrase, __u16 passph
iwr.u.passphrase.flags = (passphrase_len != 0); iwr.u.passphrase.flags = (passphrase_len != 0);
if (iw_ioctl(ifname, SIOCSIWPRIVPASSPHRASE, &iwr) < 0) { if (iw_ioctl(ifname, SIOCSIWPRIVPASSPHRASE, &iwr) < 0) {
printf("\n\rioctl[SIOCSIWESSID+0x1f] error"); WIFI_UTIL_MSG("\n\rioctl[SIOCSIWESSID+0x1f] error");
ret = -1; ret = -1;
} }
@ -229,7 +235,7 @@ int wext_get_passphrase(const char *ifname, __u8 *passphrase)
iwr.u.passphrase.pointer = (void *) passphrase; iwr.u.passphrase.pointer = (void *) passphrase;
if (iw_ioctl(ifname, SIOCGIWPRIVPASSPHRASE, &iwr) < 0) { if (iw_ioctl(ifname, SIOCGIWPRIVPASSPHRASE, &iwr) < 0) {
printf("\n\rioctl[SIOCGIWPRIVPASSPHRASE] error"); WIFI_UTIL_MSG("\n\rioctl[SIOCGIWPRIVPASSPHRASE] error");
ret = -1; ret = -1;
} }
else { else {
@ -292,7 +298,7 @@ int wext_enable_powersave(const char *ifname, __u8 ips_mode, __u8 lps_mode)
iwr.u.data.length = pindex; iwr.u.data.length = pindex;
if (iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr) < 0) { if (iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr) < 0) {
printf("\n\rioctl[SIOCSIWPRIVAPESSID] error"); WIFI_UTIL_MSG("\n\rioctl[SIOCSIWPRIVAPESSID] error");
ret = -1; ret = -1;
} }
@ -330,7 +336,7 @@ int wext_disable_powersave(const char *ifname)
iwr.u.data.length = pindex; iwr.u.data.length = pindex;
if (iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr) < 0) { if (iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr) < 0) {
printf("\n\rioctl[SIOCSIWPRIVAPESSID] error"); WIFI_UTIL_MSG("\n\rioctl[SIOCSIWPRIVAPESSID] error");
ret = -1; ret = -1;
} }
@ -367,7 +373,7 @@ int wext_set_tdma_param(const char *ifname, __u8 slot_period, __u8 rfon_period_l
iwr.u.data.length = pindex; iwr.u.data.length = pindex;
if (iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr) < 0) { if (iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr) < 0) {
printf("\n\rioctl[SIOCSIWPRIVAPESSID] error"); WIFI_UTIL_MSG("\n\rioctl[SIOCSIWPRIVAPESSID] error");
ret = -1; ret = -1;
} }
@ -400,7 +406,7 @@ int wext_set_lps_dtim(const char *ifname, __u8 lps_dtim)
iwr.u.data.length = pindex; iwr.u.data.length = pindex;
if (iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr) < 0) { if (iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr) < 0) {
printf("\n\rioctl[SIOCSIWPRIVAPESSID] error"); WIFI_UTIL_MSG("\n\rioctl[SIOCSIWPRIVAPESSID] error");
ret = -1; ret = -1;
} }
@ -434,7 +440,7 @@ int wext_get_lps_dtim(const char *ifname, __u8 *lps_dtim)
iwr.u.data.length = pindex; iwr.u.data.length = pindex;
if (iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr) < 0) { if (iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr) < 0) {
printf("\n\rioctl[SIOCSIWPRIVAPESSID] error"); WIFI_UTIL_MSG("\n\rioctl[SIOCSIWPRIVAPESSID] error");
ret = -1; ret = -1;
goto exit; goto exit;
} }
@ -443,7 +449,7 @@ int wext_get_lps_dtim(const char *ifname, __u8 *lps_dtim)
if((para[0]==3)&&(para[1]==1)) if((para[0]==3)&&(para[1]==1))
*lps_dtim = para[2]; *lps_dtim = para[2];
else else
printf("\n\r%s error", __func__); WIFI_UTIL_MSG("\n\r%s error", __func__);
exit: exit:
rtw_free(para); rtw_free(para);
@ -492,7 +498,7 @@ int wext_set_tos_value(const char *ifname, __u8 *tos_value)
iwr.u.data.length = cmd_len + 4; iwr.u.data.length = cmd_len + 4;
if (iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr) < 0) { if (iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr) < 0) {
printf("\n\rwext_set_tos_value():ioctl[SIOCDEVPRIVATE] error"); WIFI_UTIL_MSG("\n\rwext_set_tos_value():ioctl[SIOCDEVPRIVATE] error");
ret = -1; ret = -1;
} }
@ -518,7 +524,7 @@ int wext_get_tx_power(const char *ifname, __u8 *poweridx)
iwr.u.data.pointer = para; iwr.u.data.pointer = para;
iwr.u.data.length = cmd_len + 20; iwr.u.data.length = cmd_len + 20;
if (iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr) < 0) { if (iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr) < 0) {
printf("\n\rwext_get_tx_power():ioctl[SIOCDEVPRIVATE] error"); WIFI_UTIL_MSG("\n\rwext_get_tx_power():ioctl[SIOCDEVPRIVATE] error");
ret = -1; ret = -1;
} }
@ -577,7 +583,7 @@ int wext_set_mode(const char *ifname, int mode)
memset(&iwr, 0, sizeof(iwr)); memset(&iwr, 0, sizeof(iwr));
iwr.u.mode = mode; iwr.u.mode = mode;
if (iw_ioctl(ifname, SIOCSIWMODE, &iwr) < 0) { if (iw_ioctl(ifname, SIOCSIWMODE, &iwr) < 0) {
printf("\n\rioctl[SIOCSIWMODE] error"); WIFI_UTIL_MSG("\n\rioctl[SIOCSIWMODE] error");
ret = -1; ret = -1;
} }
@ -592,7 +598,7 @@ int wext_get_mode(const char *ifname, int *mode)
memset(&iwr, 0, sizeof(iwr)); memset(&iwr, 0, sizeof(iwr));
if (iw_ioctl(ifname, SIOCGIWMODE, &iwr) < 0) { if (iw_ioctl(ifname, SIOCGIWMODE, &iwr) < 0) {
printf("\n\rioctl[SIOCGIWMODE] error"); WIFI_UTIL_MSG("\n\rioctl[SIOCGIWMODE] error");
ret = -1; ret = -1;
} }
else else
@ -612,7 +618,7 @@ int wext_set_ap_ssid(const char *ifname, const __u8 *ssid, __u16 ssid_len)
iwr.u.essid.flags = (ssid_len != 0); iwr.u.essid.flags = (ssid_len != 0);
if (iw_ioctl(ifname, SIOCSIWPRIVAPESSID, &iwr) < 0) { if (iw_ioctl(ifname, SIOCSIWPRIVAPESSID, &iwr) < 0) {
printf("\n\rioctl[SIOCSIWPRIVAPESSID] error"); WIFI_UTIL_MSG("\n\rioctl[SIOCSIWPRIVAPESSID] error");
ret = -1; ret = -1;
} }
@ -629,7 +635,7 @@ int wext_set_country(const char *ifname, rtw_country_code_t country_code)
iwr.u.param.value = country_code; iwr.u.param.value = country_code;
if (iw_ioctl(ifname, SIOCSIWPRIVCOUNTRY, &iwr) < 0) { if (iw_ioctl(ifname, SIOCSIWPRIVCOUNTRY, &iwr) < 0) {
printf("\n\rioctl[SIOCSIWPRIVCOUNTRY] error"); WIFI_UTIL_MSG("\n\rioctl[SIOCSIWPRIVCOUNTRY] error");
ret = -1; ret = -1;
} }
return ret; return ret;
@ -643,7 +649,7 @@ int wext_get_rssi(const char *ifname, int *rssi)
memset(&iwr, 0, sizeof(iwr)); memset(&iwr, 0, sizeof(iwr));
if (iw_ioctl(ifname, SIOCGIWSENS, &iwr) < 0) { if (iw_ioctl(ifname, SIOCGIWSENS, &iwr) < 0) {
printf("\n\rioctl[SIOCGIWSENS] error"); WIFI_UTIL_MSG("\n\rioctl[SIOCGIWSENS] error");
ret = -1; ret = -1;
} else { } else {
*rssi = 0 - iwr.u.sens.value; *rssi = 0 - iwr.u.sens.value;
@ -675,7 +681,7 @@ int wext_set_pscan_channel(const char *ifname, __u8 *ch, __u8 *pscan_config, __u
iwr.u.data.pointer = para; iwr.u.data.pointer = para;
iwr.u.data.length = (length + length + 1) + 12; iwr.u.data.length = (length + length + 1) + 12;
if (iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr) < 0) { if (iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr) < 0) {
printf("\n\rwext_set_pscan_channel():ioctl[SIOCDEVPRIVATE] error"); WIFI_UTIL_MSG("\n\rwext_set_pscan_channel():ioctl[SIOCDEVPRIVATE] error");
ret = -1; ret = -1;
} }
rtw_free(para); rtw_free(para);
@ -692,7 +698,7 @@ int wext_set_channel(const char *ifname, __u8 ch)
iwr.u.freq.i = ch; iwr.u.freq.i = ch;
if (iw_ioctl(ifname, SIOCSIWFREQ, &iwr) < 0) { if (iw_ioctl(ifname, SIOCSIWFREQ, &iwr) < 0) {
printf("\n\rioctl[SIOCSIWFREQ] error"); WIFI_UTIL_MSG("\n\rioctl[SIOCSIWFREQ] error");
ret = -1; ret = -1;
} }
@ -707,7 +713,7 @@ int wext_get_channel(const char *ifname, __u8 *ch)
memset(&iwr, 0, sizeof(iwr)); memset(&iwr, 0, sizeof(iwr));
if (iw_ioctl(ifname, SIOCGIWFREQ, &iwr) < 0) { if (iw_ioctl(ifname, SIOCGIWFREQ, &iwr) < 0) {
printf("\n\rioctl[SIOCGIWFREQ] error"); WIFI_UTIL_MSG("\n\rioctl[SIOCGIWFREQ] error");
ret = -1; ret = -1;
} }
else else
@ -754,7 +760,7 @@ int wext_set_scan(const char *ifname, char *buf, __u16 buf_len, __u16 flags)
iwr.u.data.flags = flags; iwr.u.data.flags = flags;
iwr.u.data.length = buf_len; iwr.u.data.length = buf_len;
if (iw_ioctl(ifname, SIOCSIWSCAN, &iwr) < 0) { if (iw_ioctl(ifname, SIOCSIWSCAN, &iwr) < 0) {
printf("\n\rioctl[SIOCSIWSCAN] error"); WIFI_UTIL_MSG("\n\rioctl[SIOCSIWSCAN] error");
ret = -1; ret = -1;
} }
return ret; return ret;
@ -768,7 +774,7 @@ int wext_get_scan(const char *ifname, char *buf, __u16 buf_len)
iwr.u.data.pointer = buf; iwr.u.data.pointer = buf;
iwr.u.data.length = buf_len; iwr.u.data.length = buf_len;
if (iw_ioctl(ifname, SIOCGIWSCAN, &iwr) < 0) { if (iw_ioctl(ifname, SIOCGIWSCAN, &iwr) < 0) {
printf("\n\rioctl[SIOCGIWSCAN] error"); WIFI_UTIL_MSG("\n\rioctl[SIOCGIWSCAN] error");
ret = -1; ret = -1;
}else }else
ret = iwr.u.data.flags; ret = iwr.u.data.flags;
@ -786,7 +792,7 @@ int wext_private_command_with_retval(const char *ifname, char *cmd, char *ret_bu
buf_size = strlen(cmd) + 1; // 1 : '\0' buf_size = strlen(cmd) + 1; // 1 : '\0'
buf = (char*)rtw_malloc(buf_size); buf = (char*)rtw_malloc(buf_size);
if(!buf){ if(!buf){
printf("\n\rWEXT: Can't malloc memory"); WIFI_UTIL_MSG("\n\rWEXT: Can't malloc memory");
return -1; return -1;
} }
memset(buf, 0, buf_size); memset(buf, 0, buf_size);
@ -797,7 +803,7 @@ int wext_private_command_with_retval(const char *ifname, char *cmd, char *ret_bu
iwr.u.data.flags = 0; iwr.u.data.flags = 0;
if ((ret = iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr)) < 0) { if ((ret = iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr)) < 0) {
printf("\n\rioctl[SIOCDEVPRIVATE] error. ret=%d\n", ret); WIFI_UTIL_MSG("\n\rioctl[SIOCDEVPRIVATE] error. ret=%d\n", ret);
} }
if(ret_buf){ if(ret_buf){
if(ret_len > iwr.u.data.length) if(ret_len > iwr.u.data.length)
@ -830,7 +836,7 @@ int wext_private_command(const char *ifname, char *cmd, int show_msg)
buf_size = strlen(cmd) + 1; // 1 : '\0' buf_size = strlen(cmd) + 1; // 1 : '\0'
buf = (char*)rtw_malloc(buf_size); buf = (char*)rtw_malloc(buf_size);
if (!buf) { if (!buf) {
printf("\n\rWEXT: Can't malloc memory"); WIFI_UTIL_MSG("\n\rWEXT: Can't malloc memory");
return -1; return -1;
} }
memset(buf, 0, buf_size); memset(buf, 0, buf_size);
@ -841,12 +847,12 @@ int wext_private_command(const char *ifname, char *cmd, int show_msg)
iwr.u.data.flags = 0; iwr.u.data.flags = 0;
if ((ret = iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr)) < 0) { if ((ret = iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr)) < 0) {
printf("\n\rioctl[SIOCDEVPRIVATE] error. ret=%d\n", ret); WIFI_UTIL_MSG("\n\rioctl[SIOCDEVPRIVATE] error. ret=%d\n", ret);
} }
if (show_msg && iwr.u.data.length) { if (show_msg && iwr.u.data.length) {
if(iwr.u.data.length > buf_size) if(iwr.u.data.length > buf_size)
printf("\n\rWEXT: Malloc memory is not enough"); WIFI_UTIL_MSG("\n\rWEXT: Malloc memory is not enough");
printf("\n\rPrivate Message: %s", (char *) iwr.u.data.pointer); WIFI_UTIL_MSG("\n\rPrivate Message: %s", (char *) iwr.u.data.pointer);
} }
rtw_free(buf); rtw_free(buf);
return ret; return ret;
@ -924,7 +930,7 @@ int wext_send_eapol(const char *ifname, char *buf, __u16 buf_len, __u16 flags)
iwr.u.data.length = buf_len; iwr.u.data.length = buf_len;
iwr.u.data.flags = flags; iwr.u.data.flags = flags;
if (iw_ioctl(ifname, SIOCSIWEAPOLSEND, &iwr) < 0) { if (iw_ioctl(ifname, SIOCSIWEAPOLSEND, &iwr) < 0) {
printf("\n\rioctl[SIOCSIWEAPOLSEND] error"); WIFI_UTIL_MSG("\n\rioctl[SIOCSIWEAPOLSEND] error");
ret = -1; ret = -1;
} }
return ret; return ret;
@ -940,7 +946,7 @@ int wext_send_mgnt(const char *ifname, char *buf, __u16 buf_len, __u16 flags)
iwr.u.data.length = buf_len; iwr.u.data.length = buf_len;
iwr.u.data.flags = flags; iwr.u.data.flags = flags;
if (iw_ioctl(ifname, SIOCSIWMGNTSEND, &iwr) < 0) { if (iw_ioctl(ifname, SIOCSIWMGNTSEND, &iwr) < 0) {
printf("\n\rioctl[SIOCSIWMGNTSEND] error"); WIFI_UTIL_MSG("\n\rioctl[SIOCSIWMGNTSEND] error");
ret = -1; ret = -1;
} }
return ret; return ret;
@ -956,7 +962,7 @@ int wext_set_gen_ie(const char *ifname, char *buf, __u16 buf_len, __u16 flags)
iwr.u.data.length = buf_len; iwr.u.data.length = buf_len;
iwr.u.data.flags = flags; iwr.u.data.flags = flags;
if (iw_ioctl(ifname, SIOCSIWGENIE, &iwr) < 0) { if (iw_ioctl(ifname, SIOCSIWGENIE, &iwr) < 0) {
printf("\n\rioctl[SIOCSIWGENIE] error"); WIFI_UTIL_MSG("\n\rioctl[SIOCSIWGENIE] error");
ret = -1; ret = -1;
} }
return ret; return ret;
@ -984,7 +990,7 @@ int wext_set_autoreconnect(const char *ifname, __u8 mode, __u8 retry_times, __u1
iwr.u.data.pointer = para; iwr.u.data.pointer = para;
iwr.u.data.length = (4) + cmd_len; iwr.u.data.length = (4) + cmd_len;
if (iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr) < 0) { if (iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr) < 0) {
printf("\n\rwext_set_autoreconnect():ioctl[SIOCDEVPRIVATE] error"); WIFI_UTIL_MSG("\n\rwext_set_autoreconnect():ioctl[SIOCDEVPRIVATE] error");
ret = -1; ret = -1;
} }
rtw_free(para); rtw_free(para);
@ -1008,7 +1014,7 @@ int wext_get_autoreconnect(const char *ifname, __u8 *mode)
iwr.u.data.pointer = para; iwr.u.data.pointer = para;
iwr.u.data.length = cmd_len; iwr.u.data.length = cmd_len;
if (iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr) < 0) { if (iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr) < 0) {
printf("\n\rwext_get_autoreconnect():ioctl[SIOCDEVPRIVATE] error"); WIFI_UTIL_MSG("\n\rwext_get_autoreconnect():ioctl[SIOCDEVPRIVATE] error");
ret = -1; ret = -1;
} }
*mode = *(__u8 *)(iwr.u.data.pointer); *mode = *(__u8 *)(iwr.u.data.pointer);
@ -1037,7 +1043,7 @@ int wext_add_custom_ie(const char *ifname, void *cus_ie, int ie_num)
__u8 *para = NULL; __u8 *para = NULL;
int cmd_len = 0; int cmd_len = 0;
if(ie_num <= 0 || !cus_ie){ if(ie_num <= 0 || !cus_ie){
printf("\n\rwext_add_custom_ie():wrong parameter"); WIFI_UTIL_MSG("\n\rwext_add_custom_ie():wrong parameter");
ret = -1; ret = -1;
return ret; return ret;
} }
@ -1056,7 +1062,7 @@ int wext_add_custom_ie(const char *ifname, void *cus_ie, int ie_num)
iwr.u.data.pointer = para; iwr.u.data.pointer = para;
iwr.u.data.length = (4)* 2 + cmd_len;// 2 input iwr.u.data.length = (4)* 2 + cmd_len;// 2 input
if (iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr) < 0) { if (iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr) < 0) {
printf("\n\rwext_add_custom_ie():ioctl[SIOCDEVPRIVATE] error"); WIFI_UTIL_MSG("\n\rwext_add_custom_ie():ioctl[SIOCDEVPRIVATE] error");
ret = -1; ret = -1;
} }
rtw_free(para); rtw_free(para);
@ -1071,7 +1077,7 @@ int wext_update_custom_ie(const char *ifname, void * cus_ie, int ie_index)
__u8 *para = NULL; __u8 *para = NULL;
int cmd_len = 0; int cmd_len = 0;
if(ie_index <= 0 || !cus_ie){ if(ie_index <= 0 || !cus_ie){
printf("\n\rwext_update_custom_ie():wrong parameter"); WIFI_UTIL_MSG("\n\rwext_update_custom_ie():wrong parameter");
ret = -1; ret = -1;
return ret; return ret;
} }
@ -1090,7 +1096,7 @@ int wext_update_custom_ie(const char *ifname, void * cus_ie, int ie_index)
iwr.u.data.pointer = para; iwr.u.data.pointer = para;
iwr.u.data.length = (4)* 2 + cmd_len;// 2 input iwr.u.data.length = (4)* 2 + cmd_len;// 2 input
if (iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr) < 0) { if (iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr) < 0) {
printf("\n\rwext_update_custom_ie():ioctl[SIOCDEVPRIVATE] error"); WIFI_UTIL_MSG("\n\rwext_update_custom_ie():ioctl[SIOCDEVPRIVATE] error");
ret = -1; ret = -1;
} }
rtw_free(para); rtw_free(para);
@ -1115,7 +1121,7 @@ int wext_del_custom_ie(const char *ifname)
iwr.u.data.pointer = para; iwr.u.data.pointer = para;
iwr.u.data.length = cmd_len; iwr.u.data.length = cmd_len;
if (iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr) < 0) { if (iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr) < 0) {
printf("\n\rwext_del_custom_ie():ioctl[SIOCDEVPRIVATE] error"); WIFI_UTIL_MSG("\n\rwext_del_custom_ie():ioctl[SIOCDEVPRIVATE] error");
ret = -1; ret = -1;
} }
rtw_free(para); rtw_free(para);
@ -1148,7 +1154,7 @@ int wext_enable_forwarding(const char *ifname)
iwr.u.essid.length = cmd_len + 1; iwr.u.essid.length = cmd_len + 1;
if (iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr) < 0) { if (iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr) < 0) {
printf("\n\rwext_enable_forwarding(): ioctl[SIOCDEVPRIVATE] error"); WIFI_UTIL_MSG("\n\rwext_enable_forwarding(): ioctl[SIOCDEVPRIVATE] error");
ret = -1; ret = -1;
} }
@ -1176,7 +1182,7 @@ int wext_disable_forwarding(const char *ifname)
iwr.u.essid.length = cmd_len + 1; iwr.u.essid.length = cmd_len + 1;
if (iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr) < 0) { if (iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr) < 0) {
printf("\n\rwext_disable_forwarding(): ioctl[SIOCDEVPRIVATE] error"); WIFI_UTIL_MSG("\n\rwext_disable_forwarding(): ioctl[SIOCDEVPRIVATE] error");
ret = -1; ret = -1;
} }
@ -1260,7 +1266,7 @@ int wext_init_mac_filter(void)
mf_list_head = (struct list_head *)rtw_malloc(sizeof(struct list_head)); mf_list_head = (struct list_head *)rtw_malloc(sizeof(struct list_head));
if(mf_list_head == NULL){ if(mf_list_head == NULL){
printf("\n\r[ERROR] %s : can't allocate mf_list_head",__func__); WIFI_UTIL_MSG("\n\r[ERROR] %s : can't allocate mf_list_head",__func__);
return -1; return -1;
} }
@ -1298,7 +1304,7 @@ int wext_add_mac_filter(unsigned char* hwaddr)
rtw_mac_filter_list_t *mf_list_new; rtw_mac_filter_list_t *mf_list_new;
mf_list_new = (rtw_mac_filter_list_t *)rtw_malloc(sizeof(rtw_mac_filter_list_t)); mf_list_new = (rtw_mac_filter_list_t *)rtw_malloc(sizeof(rtw_mac_filter_list_t));
if(mf_list_new == NULL){ if(mf_list_new == NULL){
printf("\n\r[ERROR] %s : can't allocate mf_list_new",__func__); WIFI_UTIL_MSG("\n\r[ERROR] %s : can't allocate mf_list_new",__func__);
return -1; return -1;
} }
memcpy(mf_list_new->mac_addr,hwaddr,6); memcpy(mf_list_new->mac_addr,hwaddr,6);