⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cmm_info.c

📁 Linux下的RT系列无线网卡驱动,可以直接在x86平台上编译
💻 C
📖 第 1 页 / 共 4 页
字号:
		sprintf(msg+strlen(msg),"%-28s", Ssid);      		//BSSID		sprintf(msg+strlen(msg),"%02x:%02x:%02x:%02x:%02x:%02x   ", 			pAdapter->ScanTab.BssEntry[i].Bssid[0], 			pAdapter->ScanTab.BssEntry[i].Bssid[1],			pAdapter->ScanTab.BssEntry[i].Bssid[2], 			pAdapter->ScanTab.BssEntry[i].Bssid[3], 			pAdapter->ScanTab.BssEntry[i].Bssid[4], 			pAdapter->ScanTab.BssEntry[i].Bssid[5]);		//Encryption Type		sprintf(msg+strlen(msg),"%-8s",GetEncryptType(pAdapter->ScanTab.BssEntry[i].WepStatus));		//Authentication Mode		sprintf(msg+strlen(msg),"%-10s",GetAuthMode(pAdapter->ScanTab.BssEntry[i].AuthMode));        // Rssi        Rssi = (INT)(pAdapter->ScanTab.BssEntry[i].Rssi - pAdapter->BbpRssiToDbmDelta);        if (Rssi >= -50)            Rssi_Quality = 100;        else if (Rssi >= -80)    // between -50 ~ -80dbm            Rssi_Quality = (UINT)(24 + ((Rssi + 80) * 26)/10);        else if (Rssi >= -90)   // between -80 ~ -90dbm            Rssi_Quality = (UINT)(((Rssi + 90) * 26)/10);        else    // < -84 dbm            Rssi_Quality = 0;        sprintf(msg+strlen(msg),"%-9d", Rssi_Quality);        // Wireless Mode        wireless_mode = NetworkTypeInUseSanity(&pAdapter->ScanTab.BssEntry[i]);        if (wireless_mode == Ndis802_11FH ||            wireless_mode == Ndis802_11DS)            sprintf(msg+strlen(msg),"%-7s", "11b");        else if (wireless_mode == Ndis802_11OFDM5)            sprintf(msg+strlen(msg),"%-7s", "11a");        else if (wireless_mode == Ndis802_11OFDM5_N)            sprintf(msg+strlen(msg),"%-7s", "11a/n");        else if (wireless_mode == Ndis802_11OFDM24)            sprintf(msg+strlen(msg),"%-7s", "11b/g");        else if (wireless_mode == Ndis802_11OFDM24_N)            sprintf(msg+strlen(msg),"%-7s", "11b/g/n");        else            sprintf(msg+strlen(msg),"%-7s", "unknow");		//Network Type				if (pAdapter->ScanTab.BssEntry[i].BssType == BSS_ADHOC)			sprintf(msg+strlen(msg),"%-3s\n", " Ad");		else			sprintf(msg+strlen(msg),"%-3s\n", " In");	}	wrq->u.data.length = strlen(msg);	Status = copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length);    DBGPRINT(RT_DEBUG_TRACE, ("RTMPIoctlGetSiteSurvey - wrq->u.data.length = %d\n", wrq->u.data.length));	os_free_mem(NULL, (PUCHAR)msg);}#define	MAC_LINE_LEN	(14+4+4+10+10+10+6+6)	// Addr+aid+psm+datatime+rxbyte+txbyte+current tx rate+last tx rateVOID RTMPIoctlGetMacTable(	IN PRTMP_ADAPTER pAd, 	IN struct iwreq *wrq){	INT i;	RT_802_11_MAC_TABLE MacTab;	char *msg;	MacTab.Num = 0;	for (i=0; i<MAX_LEN_OF_MAC_TABLE; i++)	{		if (pAd->MacTab.Content[i].ValidAsCLI && (pAd->MacTab.Content[i].Sst == SST_ASSOC))		{			COPY_MAC_ADDR(MacTab.Entry[MacTab.Num].Addr, &pAd->MacTab.Content[i].Addr);			MacTab.Entry[MacTab.Num].Aid = (UCHAR)pAd->MacTab.Content[i].Aid;			MacTab.Entry[MacTab.Num].Psm = pAd->MacTab.Content[i].PsMode;			MacTab.Entry[MacTab.Num].MimoPs = pAd->MacTab.Content[i].MmpsMode;			MacTab.Entry[MacTab.Num].TxRate.field.MCS = pAd->MacTab.Content[i].HTPhyMode.field.MCS;			MacTab.Entry[MacTab.Num].TxRate.field.BW = pAd->MacTab.Content[i].HTPhyMode.field.BW;			MacTab.Entry[MacTab.Num].TxRate.field.ShortGI = pAd->MacTab.Content[i].HTPhyMode.field.ShortGI;			MacTab.Entry[MacTab.Num].TxRate.field.STBC = pAd->MacTab.Content[i].HTPhyMode.field.STBC;			MacTab.Entry[MacTab.Num].TxRate.field.rsv = pAd->MacTab.Content[i].HTPhyMode.field.rsv;			MacTab.Entry[MacTab.Num].TxRate.field.MODE = pAd->MacTab.Content[i].HTPhyMode.field.MODE;			MacTab.Entry[MacTab.Num].TxRate.word = pAd->MacTab.Content[i].HTPhyMode.word;			MacTab.Num += 1;		}	}	wrq->u.data.length = sizeof(RT_802_11_MAC_TABLE);	if (copy_to_user(wrq->u.data.pointer, &MacTab, wrq->u.data.length))	{		DBGPRINT(RT_DEBUG_TRACE, ("%s: copy_to_user() fail\n", __FUNCTION__));	}	msg = (CHAR *) kmalloc(sizeof(CHAR)*(MAX_LEN_OF_MAC_TABLE*MAC_LINE_LEN), MEM_ALLOC_FLAG);	memset(msg, 0 ,MAX_LEN_OF_MAC_TABLE*MAC_LINE_LEN );	sprintf(msg,"%s","\n");	sprintf(msg+strlen(msg),"%-14s%-4s%-4s%-10s%-10s%-10s%-6s%-6s\n",		"MAC", "AID", "PSM", "LDT", "RxB", "TxB","CTxR", "LTxR");		for (i=0; i<MAX_LEN_OF_MAC_TABLE; i++)	{		PMAC_TABLE_ENTRY pEntry = &pAd->MacTab.Content[i];		if (pEntry->ValidAsCLI && (pEntry->Sst == SST_ASSOC))		{			if((strlen(msg)+MAC_LINE_LEN ) >= (MAX_LEN_OF_MAC_TABLE*MAC_LINE_LEN) )				break;				sprintf(msg+strlen(msg),"%02x%02x%02x%02x%02x%02x  ",				pEntry->Addr[0], pEntry->Addr[1], pEntry->Addr[2],				pEntry->Addr[3], pEntry->Addr[4], pEntry->Addr[5]);			sprintf(msg+strlen(msg),"%-4d", (int)pEntry->Aid);			sprintf(msg+strlen(msg),"%-4d", (int)pEntry->PsMode);			sprintf(msg+strlen(msg),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.LastDataPacketTime*/); // ToDo			sprintf(msg+strlen(msg),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.TotalRxByteCount*/); // ToDo			sprintf(msg+strlen(msg),"%-10d",0/*pAd->MacTab.Content[i].HSCounter.TotalTxByteCount*/); // ToDo			sprintf(msg+strlen(msg),"%-6d",RateIdToMbps[pAd->MacTab.Content[i].CurrTxRate]);			sprintf(msg+strlen(msg),"%-6d\n",0/*RateIdToMbps[pAd->MacTab.Content[i].LastTxRate]*/); // ToDo		}	} 	// for compatible with old API just do the printk to console	//wrq->u.data.length = strlen(msg);	//if (copy_to_user(wrq->u.data.pointer, msg, wrq->u.data.length))	{		DBGPRINT(RT_DEBUG_TRACE, ("%s", msg));	}	kfree(msg);}INT	Set_BASetup_Proc(	IN	PRTMP_ADAPTER	pAd, 	IN	PUCHAR			arg){    UCHAR mac[6], tid;	char *token, sepValue[] = ":", DASH = '-';	INT i;    MAC_TABLE_ENTRY *pEntry;/*	The BASetup inupt string format should be xx:xx:xx:xx:xx:xx-d, 		=>The six 2 digit hex-decimal number previous are the Mac address, 		=>The seventh decimal number is the tid value.*/	//printk("\n%s\n", arg);		if(strlen(arg) < 19)  //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format.		return FALSE;	token = strchr(arg, DASH);	if ((token != NULL) && (strlen(token)>1))	{		tid = simple_strtol((token+1), 0, 10);		if (tid > 15)			return FALSE;				*token = '\0';		for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++)		{			if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1))))				return FALSE;			AtoH(token, (PUCHAR)(&mac[i]), 1);		}		if(i != 6)			return FALSE;		printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x\n", mac[0], mac[1],				mac[2], mac[3], mac[4], mac[5], tid);	    pEntry = MacTableLookup(pAd, mac);    	if (pEntry) {        	printk("\nSetup BA Session: Tid = %d\n", tid);	        BAOriSessionSetUp(pAd, pEntry, tid, 0, 100, TRUE);    	}		return TRUE;	}	return FALSE;}INT	Set_BADecline_Proc(	IN	PRTMP_ADAPTER	pAd, 	IN	PUCHAR			arg){	ULONG bBADecline;	bBADecline = simple_strtol(arg, 0, 10);	if (bBADecline == 0)	{		pAd->CommonCfg.bBADecline = FALSE;	}	else if (bBADecline == 1)	{		pAd->CommonCfg.bBADecline = TRUE;	}	else 	{		return FALSE; //Invalid argument	}	DBGPRINT(RT_DEBUG_TRACE, ("Set_BADecline_Proc::(BADecline=%d)\n", pAd->CommonCfg.bBADecline));	return TRUE;}INT	Set_BAOriTearDown_Proc(	IN	PRTMP_ADAPTER	pAd, 	IN	PUCHAR			arg){    UCHAR mac[6], tid;	char *token, sepValue[] = ":", DASH = '-';	INT i;    MAC_TABLE_ENTRY *pEntry;    //printk("\n%s\n", arg);/*	The BAOriTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d, 		=>The six 2 digit hex-decimal number previous are the Mac address, 		=>The seventh decimal number is the tid value.*/    if(strlen(arg) < 19)  //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format.		return FALSE;	token = strchr(arg, DASH);	if ((token != NULL) && (strlen(token)>1))	{		tid = simple_strtol((token+1), 0, 10);		if (tid > 15)			return FALSE;				*token = '\0';		for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++)		{			if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1))))				return FALSE;			AtoH(token, (PUCHAR)(&mac[i]), 1);		}		if(i != 6)			return FALSE;	    printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", mac[0], mac[1],	           mac[2], mac[3], mac[4], mac[5], tid);	    pEntry = MacTableLookup(pAd, mac);	    if (pEntry) {	        printk("\nTear down Ori BA Session: Tid = %d\n", tid);        BAOriSessionTearDown(pAd, pEntry->Aid, tid, FALSE, TRUE);	    }		return TRUE;	}	return FALSE;}INT	Set_BARecTearDown_Proc(	IN	PRTMP_ADAPTER	pAd, 	IN	PUCHAR			arg){    UCHAR mac[6], tid;	char *token, sepValue[] = ":", DASH = '-';	INT i;    MAC_TABLE_ENTRY *pEntry;    //printk("\n%s\n", arg);/*	The BARecTearDown inupt string format should be xx:xx:xx:xx:xx:xx-d, 		=>The six 2 digit hex-decimal number previous are the Mac address, 		=>The seventh decimal number is the tid value.*/    if(strlen(arg) < 19)  //Mac address acceptable format 01:02:03:04:05:06 length 17 plus the "-" and tid value in decimal format.		return FALSE;	token = strchr(arg, DASH);	if ((token != NULL) && (strlen(token)>1))	{		tid = simple_strtol((token+1), 0, 10);		if (tid > 15)			return FALSE;				*token = '\0';		for (i = 0, token = rstrtok(arg, &sepValue[0]); token; token = rstrtok(NULL, &sepValue[0]), i++)		{			if((strlen(token) != 2) || (!isxdigit(*token)) || (!isxdigit(*(token+1))))				return FALSE;			AtoH(token, (PUCHAR)(&mac[i]), 1);		}		if(i != 6)			return FALSE;		printk("\n%02x:%02x:%02x:%02x:%02x:%02x-%02x", mac[0], mac[1],		       mac[2], mac[3], mac[4], mac[5], tid);		pEntry = MacTableLookup(pAd, mac);		if (pEntry) {		    printk("\nTear down Rec BA Session: Tid = %d\n", tid);		    BARecSessionTearDown(pAd, pEntry->Aid, tid, FALSE);		}		return TRUE;	}	return FALSE;}INT	Set_HtBw_Proc(	IN	PRTMP_ADAPTER	pAd, 	IN	PUCHAR			arg){	ULONG HtBw;	HtBw = simple_strtol(arg, 0, 10);	if (HtBw == BW_40)		pAd->CommonCfg.RegTransmitSetting.field.BW  = BW_40;	else if (HtBw == BW_40)		pAd->CommonCfg.RegTransmitSetting.field.BW  = BW_40;	else		return FALSE;  //Invalid argument 	SetCommonHT(pAd);		DBGPRINT(RT_DEBUG_TRACE, ("Set_HtBw_Proc::(HtBw=%d)\n", pAd->CommonCfg.RegTransmitSetting.field.BW));	return TRUE;}INT	Set_HtMcs_Proc(	IN	PRTMP_ADAPTER	pAd, 	IN	PUCHAR			arg){	ULONG HtMcs;	HtMcs = simple_strtol(arg, 0, 10);			if ( HtMcs <= 15 || HtMcs == 32)					pAd->CommonCfg.RegTransmitSetting.field.MCS = HtMcs;	//else if ( HtMcs >15 && HtMcs < MCS_AUTO)	//	return FALSE;  //Invalid argument 	else// if ( HtMcs >= MCS_AUTO )		pAd->CommonCfg.RegTransmitSetting.field.MCS = MCS_AUTO;		SetCommonHT(pAd);		DBGPRINT(RT_DEBUG_TRACE, ("Set_HtMcs_Proc::(HtMcs=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.MCS));	return TRUE;}INT	Set_HtGi_Proc(	IN	PRTMP_ADAPTER	pAd, 	IN	PUCHAR			arg){	ULONG HtGi;	HtGi = simple_strtol(arg, 0, 10);			if ( HtGi == GI_400)					pAd->CommonCfg.RegTransmitSetting.field.ShortGI = GI_400;	else if ( HtGi == GI_800 )		pAd->CommonCfg.RegTransmitSetting.field.ShortGI = GI_800;	else 		return FALSE; //Invalid argument 		SetCommonHT(pAd);		DBGPRINT(RT_DEBUG_TRACE, ("Set_HtGi_Proc::(ShortGI=%d)\n",pAd->CommonCfg.RegTransmitSetting.field.ShortGI));	return TRUE;}INT	Set_HtTxBASize_Proc(	IN	PRTMP_ADAPTER	pAd, 	IN	PUCHAR			arg){	UCHAR Size;	Size = simple_strtol(arg, 0, 10);			if (Size <=0 || Size >=64)	{		Size = 8;	}	pAd->CommonCfg.TxBASize = Size-1;	DBGPRINT(RT_DEBUG_ERROR, ("Set_HtTxBASize ::(TxBASize= %d)\n", Size));	return TRUE;}INT	Set_HtOpMode_Proc(	IN	PRTMP_ADAPTER	pAd, 	IN	PUCHAR			arg){	ULONG Value;		Value = simple_strtol(arg, 0, 10);	if (Value == HTMODE_GF)		pAd->CommonCfg.RegTransmitSetting.field.HTMODE  = HTMODE_GF;	else if ( Value == HTMODE_MM )		pAd->CommonCfg.RegTransmitSetting.field.HTMODE  = HTMODE_MM;	else 		return FALSE; //Invalid argument 		SetCommonHT(pAd);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -