int print_err_desc(int err)
{
    int i;
    for( i=0; i<SIZE_ARR(configMgr_error_desc);i++ )
    {
        if(configMgr_error_desc[i].err_code == err )
        {
            print_err("---err(%d) configMgr() = %s\n", err, configMgr_error_desc[i].desc );
            return -err;
        }
    }
    print_err("---err(%d) configMgr failed\n", err);
    return -err;
}
VOID CuCmd_ReportSeverityLevel(THandle hCuCmd, ConParm_t parm[], U16 nParms)
{
    CuCmd_t* pCuCmd = (CuCmd_t*)hCuCmd;
    U8 SeverityTable[REPORT_SEVERITY_MAX];
    S32 index = 0;
    PS8 SeverityValue = (PS8)(parm[0].value);

    /* Get the current report severity */
    if (!CuCommon_GetBuffer(pCuCmd->hCuCommon, REPORT_SEVERITY_TABLE_PARAM, SeverityTable, REPORT_SEVERITY_MAX))    
    {
        if(nParms == 0)
        {            
            S32 i;

            os_error_printf(CU_MSG_INFO2, (PS8)"Severity:\n");
            os_error_printf(CU_MSG_INFO2, (PS8)"-------------------------------\n");
            os_error_printf(CU_MSG_INFO2, (PS8)"%14s\tState\t%s\n", (PS8)"Severity level", (PS8)"Desc");

            for( i=1; i<SIZE_ARR(report_severity); i++ )
            {
                os_error_printf(CU_MSG_INFO2, (PS8)"%d\t%c\t%s\n", report_severity[i].value, (SeverityTable[i] == '1') ? '+' : ' ', report_severity[i].name );
            }

            os_error_printf(CU_MSG_INFO2, (PS8)"* Use '0' to clear all table.\n");
            os_error_printf(CU_MSG_INFO2, (PS8)"* Use '%d' (max index) to set all table.\n", REPORT_SEVERITY_MAX);            
        }
        else
        {
            for (index = 0; index < REPORT_SEVERITY_MAX; index ++)
            {
                if (SeverityValue[index] == '0')
                {
                    SeverityTable[index] = '0';
                } 
                else
                {
                    SeverityTable[index] = '1';
                }
            }
            CuCommon_SetBuffer(pCuCmd->hCuCommon, REPORT_SEVERITY_TABLE_PARAM, SeverityTable, REPORT_SEVERITY_MAX);
        }
    }
    else
    {
        os_error_printf(CU_MSG_ERROR, (PS8)"Error retriving the severity table from the driver\n");
    }
}
Beispiel #3
0
static S32 CuWext_FillBssidList(struct iw_event *iwe, OS_802_11_BSSID_EX* bssidList, S32 index)
{
	S32 res = 0;
	switch(iwe->cmd) {
	case SIOCGIWAP:
		os_memcpy(bssidList[index].MacAddress, iwe->u.ap_addr.sa_data, MAC_ADDR_LEN);
		bssidList[index].Configuration.BeaconPeriod = 0; /* default configuration */
		res = 1;
		break;
	case SIOCGIWESSID:
		bssidList[index-1].Ssid.SsidLength = iwe->u.data.length;
		os_memcpy(bssidList[index-1].Ssid.Ssid, iwe->u.data.pointer, bssidList[index-1].Ssid.SsidLength);
		if(iwe->u.data.length != MAX_SSID_LEN)
			bssidList[index-1].Ssid.Ssid[bssidList[index-1].Ssid.SsidLength] = 0;
		break;
	case SIOCGIWNAME: {
		int i;
		S8 buffer[IFNAMSIZ];
		static const char *ieee80211_modes[] = {
			"?",
			"IEEE 802.11 B",
			"IEEE 802.11 A",
			"IEEE 802.11 BG",
			"IEEE 802.11 ABG"
		};

		os_memset(buffer, 0, IFNAMSIZ);
		os_memcpy(buffer, iwe->u.name, IFNAMSIZ);
		for(i=0; i<SIZE_ARR(ieee80211_modes); i++)
			if (0 == os_strcmp((PS8)ieee80211_modes[i], buffer))
				break;
		bssidList[index-1].NetworkTypeInUse = i;
	}
	break;
	case SIOCGIWMODE:
		if(iwe->u.mode == IW_MODE_ADHOC)
			bssidList[index-1].InfrastructureMode = os802_11IBSS;
		else if (iwe->u.mode == IW_MODE_INFRA)
			bssidList[index-1].InfrastructureMode = os802_11Infrastructure;
		else if (iwe->u.mode == IW_MODE_AUTO)
			bssidList[index-1].InfrastructureMode = os802_11AutoUnknown;
		else
			bssidList[index-1].InfrastructureMode = os802_11InfrastructureMax;

		break;
	case SIOCGIWFREQ:
		bssidList[index-1].Configuration.Union.channel = iwe->u.freq.m;
		break;
	case IWEVQUAL:
		bssidList[index-1].Rssi = (S8)iwe->u.qual.level;
		break;
	case SIOCGIWENCODE:
		if(iwe->u.data.flags == (IW_ENCODE_ENABLED | IW_ENCODE_NOKEY)) {
			bssidList[index-1].Privacy = TRUE;
			bssidList[index-1].Capabilities |= CAP_PRIVACY_MASK<<CAP_PRIVACY_SHIFT;
		} else {
			bssidList[index-1].Privacy = FALSE;
			bssidList[index-1].Capabilities &= ~(CAP_PRIVACY_MASK<<CAP_PRIVACY_SHIFT);
		}
		break;
	case SIOCGIWRATE:
		break;
	case IWEVCUSTOM: {
		S8 buffer[100];

		os_memset(buffer, 0, 100);
		os_memcpy(buffer, iwe->u.data.pointer, iwe->u.data.length);

		if(!os_strncmp(buffer, (PS8)"Bcn", 3)) {
			char *p1;
			p1 = strtok(&buffer[10], " ");
			bssidList[index-1].Configuration.BeaconPeriod = atoi(p1);
		}
	}
	break;
	}

	return res;
}