Staging: vt6655: whitespace fixes to iotcl.c
The indents didn't line up at all in the original code. I also fixed a bunch of other white issues as I went along. I changed the comment style and removed some commented out code. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
44ec5d2916
commit
0d3eb2b29f
1 changed files with 598 additions and 703 deletions
|
@ -38,24 +38,14 @@
|
||||||
#include "wpactl.h"
|
#include "wpactl.h"
|
||||||
#include "rf.h"
|
#include "rf.h"
|
||||||
|
|
||||||
/*--------------------- Static Definitions -------------------------*/
|
static int msglevel = MSG_LEVEL_INFO;
|
||||||
|
|
||||||
/*--------------------- Static Classes ----------------------------*/
|
|
||||||
|
|
||||||
/*--------------------- Static Variables --------------------------*/
|
|
||||||
//static int msglevel =MSG_LEVEL_DEBUG;
|
|
||||||
static int msglevel =MSG_LEVEL_INFO;
|
|
||||||
|
|
||||||
#ifdef WPA_SM_Transtatus
|
#ifdef WPA_SM_Transtatus
|
||||||
SWPAResult wpa_Result;
|
SWPAResult wpa_Result;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*--------------------- Static Functions --------------------------*/
|
int private_ioctl(PSDevice pDevice, struct ifreq *rq)
|
||||||
|
{
|
||||||
/*--------------------- Export Variables --------------------------*/
|
|
||||||
|
|
||||||
int private_ioctl(PSDevice pDevice, struct ifreq *rq) {
|
|
||||||
|
|
||||||
PSCmdRequest pReq = (PSCmdRequest)rq;
|
PSCmdRequest pReq = (PSCmdRequest)rq;
|
||||||
PSMgmtObject pMgmt = pDevice->pMgmt;
|
PSMgmtObject pMgmt = pDevice->pMgmt;
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
@ -77,17 +67,15 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) {
|
||||||
SCmdLinkStatus sLinkStatus;
|
SCmdLinkStatus sLinkStatus;
|
||||||
unsigned char abySuppRates[] = {WLAN_EID_SUPP_RATES, 4, 0x02, 0x04, 0x0B, 0x16};
|
unsigned char abySuppRates[] = {WLAN_EID_SUPP_RATES, 4, 0x02, 0x04, 0x0B, 0x16};
|
||||||
unsigned char abyNullAddr[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
unsigned char abyNullAddr[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||||
unsigned long dwKeyIndex= 0;
|
unsigned long dwKeyIndex = 0;
|
||||||
unsigned char abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
|
unsigned char abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
|
||||||
long ldBm;
|
long ldBm;
|
||||||
|
|
||||||
pReq->wResult = 0;
|
pReq->wResult = 0;
|
||||||
|
|
||||||
switch (pReq->wCmdCode) {
|
switch (pReq->wCmdCode) {
|
||||||
|
|
||||||
case WLAN_CMD_BSS_SCAN:
|
case WLAN_CMD_BSS_SCAN:
|
||||||
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_BSS_SCAN..begin\n");
|
||||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_BSS_SCAN..begin \n");
|
|
||||||
if (copy_from_user(&sScanCmd, pReq->data, sizeof(SCmdScan))) {
|
if (copy_from_user(&sScanCmd, pReq->data, sizeof(SCmdScan))) {
|
||||||
result = -EFAULT;
|
result = -EFAULT;
|
||||||
break;
|
break;
|
||||||
|
@ -121,8 +109,8 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WLAN_CMD_ZONETYPE_SET:
|
case WLAN_CMD_ZONETYPE_SET:
|
||||||
//mike add :cann't support.
|
/* mike add :cann't support. */
|
||||||
result=-EOPNOTSUPP;
|
result = -EOPNOTSUPP;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (copy_from_user(&sZoneTypeCmd, pReq->data, sizeof(SCmdZoneTypeSet))) {
|
if (copy_from_user(&sZoneTypeCmd, pReq->data, sizeof(SCmdZoneTypeSet))) {
|
||||||
|
@ -130,37 +118,30 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sZoneTypeCmd.bWrite==true) {
|
if (sZoneTypeCmd.bWrite == true) {
|
||||||
//////write zonetype
|
/* write zonetype */
|
||||||
if(sZoneTypeCmd.ZoneType == ZoneType_USA) {
|
if (sZoneTypeCmd.ZoneType == ZoneType_USA) {
|
||||||
//set to USA
|
/* set to USA */
|
||||||
printk("set_ZoneType:USA\n");
|
printk("set_ZoneType:USA\n");
|
||||||
}
|
} else if (sZoneTypeCmd.ZoneType == ZoneType_Japan) {
|
||||||
else if(sZoneTypeCmd.ZoneType == ZoneType_Japan) {
|
/* set to Japan */
|
||||||
//set to Japan
|
|
||||||
printk("set_ZoneType:Japan\n");
|
printk("set_ZoneType:Japan\n");
|
||||||
}
|
} else if (sZoneTypeCmd.ZoneType == ZoneType_Europe) {
|
||||||
else if(sZoneTypeCmd.ZoneType == ZoneType_Europe) {
|
/* set to Europe */
|
||||||
//set to Europe
|
|
||||||
printk("set_ZoneType:Europe\n");
|
printk("set_ZoneType:Europe\n");
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
/* read zonetype */
|
||||||
///////read zonetype
|
unsigned char zonetype = 0;
|
||||||
unsigned char zonetype=0;
|
|
||||||
|
|
||||||
|
if (zonetype == 0x00) { /* USA */
|
||||||
if(zonetype == 0x00) { //USA
|
|
||||||
sZoneTypeCmd.ZoneType = ZoneType_USA;
|
sZoneTypeCmd.ZoneType = ZoneType_USA;
|
||||||
}
|
} else if (zonetype == 0x01) { /* Japan */
|
||||||
else if(zonetype == 0x01) { //Japan
|
|
||||||
sZoneTypeCmd.ZoneType = ZoneType_Japan;
|
sZoneTypeCmd.ZoneType = ZoneType_Japan;
|
||||||
}
|
} else if (zonetype == 0x02) { /* Europe */
|
||||||
else if(zonetype == 0x02) { //Europe
|
|
||||||
sZoneTypeCmd.ZoneType = ZoneType_Europe;
|
sZoneTypeCmd.ZoneType = ZoneType_Europe;
|
||||||
}
|
} else { /* Unknown ZoneType */
|
||||||
else { //Unknown ZoneType
|
printk("Error:ZoneType[%x] Unknown ???\n", zonetype);
|
||||||
printk("Error:ZoneType[%x] Unknown ???\n",zonetype);
|
|
||||||
result = -EFAULT;
|
result = -EFAULT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -169,11 +150,9 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WLAN_CMD_BSS_JOIN:
|
case WLAN_CMD_BSS_JOIN:
|
||||||
|
|
||||||
if (pDevice->bMACSuspend == true) {
|
if (pDevice->bMACSuspend == true) {
|
||||||
if (pDevice->bRadioOff == true)
|
if (pDevice->bRadioOff == true)
|
||||||
CARDbRadioPowerOn(pDevice);
|
CARDbRadioPowerOn(pDevice);
|
||||||
|
@ -194,30 +173,26 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) {
|
||||||
if (sJoinCmd.wBSSType == ADHOC) {
|
if (sJoinCmd.wBSSType == ADHOC) {
|
||||||
pMgmt->eConfigMode = WMAC_CONFIG_IBSS_STA;
|
pMgmt->eConfigMode = WMAC_CONFIG_IBSS_STA;
|
||||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ioct set to adhoc mode\n");
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ioct set to adhoc mode\n");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA;
|
pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA;
|
||||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ioct set to STA mode\n");
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ioct set to STA mode\n");
|
||||||
}
|
}
|
||||||
if (sJoinCmd.bPSEnable == true) {
|
if (sJoinCmd.bPSEnable == true) {
|
||||||
pDevice->ePSMode = WMAC_POWER_FAST;
|
pDevice->ePSMode = WMAC_POWER_FAST;
|
||||||
// pDevice->ePSMode = WMAC_POWER_MAX;
|
|
||||||
pMgmt->wListenInterval = 2;
|
pMgmt->wListenInterval = 2;
|
||||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Power Saving On\n");
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Power Saving On\n");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
pDevice->ePSMode = WMAC_POWER_CAM;
|
pDevice->ePSMode = WMAC_POWER_CAM;
|
||||||
pMgmt->wListenInterval = 1;
|
pMgmt->wListenInterval = 1;
|
||||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Power Saving Off \n");
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Power Saving Off\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sJoinCmd.bShareKeyAuth == true){
|
if (sJoinCmd.bShareKeyAuth == true) {
|
||||||
pMgmt->bShareKeyAlgorithm = true;
|
pMgmt->bShareKeyAlgorithm = true;
|
||||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Share Key \n");
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Share Key\n");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
pMgmt->bShareKeyAlgorithm = false;
|
pMgmt->bShareKeyAlgorithm = false;
|
||||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Open System \n");
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Open System\n");
|
||||||
}
|
}
|
||||||
pDevice->uChannel = sJoinCmd.uChannel;
|
pDevice->uChannel = sJoinCmd.uChannel;
|
||||||
netif_stop_queue(pDevice->dev);
|
netif_stop_queue(pDevice->dev);
|
||||||
|
@ -229,8 +204,8 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WLAN_CMD_SET_WEP:
|
case WLAN_CMD_SET_WEP:
|
||||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_WEP Key. \n");
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_WEP Key.\n");
|
||||||
memset(&sWEPCmd, 0 ,sizeof(SCmdSetWEP));
|
memset(&sWEPCmd, 0, sizeof(SCmdSetWEP));
|
||||||
if (copy_from_user(&sWEPCmd, pReq->data, sizeof(SCmdSetWEP))) {
|
if (copy_from_user(&sWEPCmd, pReq->data, sizeof(SCmdSetWEP))) {
|
||||||
result = -EFAULT;
|
result = -EFAULT;
|
||||||
break;
|
break;
|
||||||
|
@ -239,17 +214,14 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) {
|
||||||
pDevice->bEncryptionEnable = false;
|
pDevice->bEncryptionEnable = false;
|
||||||
pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
|
pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
|
||||||
MACvDisableDefaultKey(pDevice->PortOffset);
|
MACvDisableDefaultKey(pDevice->PortOffset);
|
||||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WEP function disable. \n");
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WEP function disable.\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ii = 0; ii < WLAN_WEP_NKEYS; ii ++) {
|
for (ii = 0; ii < WLAN_WEP_NKEYS; ii++) {
|
||||||
if (sWEPCmd.bWepKeyAvailable[ii]) {
|
if (sWEPCmd.bWepKeyAvailable[ii]) {
|
||||||
if (ii == sWEPCmd.byKeyIndex)
|
if (ii == sWEPCmd.byKeyIndex)
|
||||||
//2006-1123-02,<Modify> by EinsnLiu
|
dwKeyIndex = ii | (1 << 31);
|
||||||
//Evaluate the "dwKeyIndex" error
|
|
||||||
// dwKeyIndex |= (1 << 31);
|
|
||||||
dwKeyIndex =ii|(1 << 31);
|
|
||||||
else
|
else
|
||||||
dwKeyIndex = ii;
|
dwKeyIndex = ii;
|
||||||
|
|
||||||
|
@ -267,11 +239,10 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) {
|
||||||
pDevice->bTransmitKey = true;
|
pDevice->bTransmitKey = true;
|
||||||
pDevice->bEncryptionEnable = true;
|
pDevice->bEncryptionEnable = true;
|
||||||
pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
|
pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WLAN_CMD_GET_LINK:
|
case WLAN_CMD_GET_LINK:
|
||||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_GET_LINK status. \n");
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_GET_LINK status.\n");
|
||||||
|
|
||||||
memset(sLinkStatus.abySSID, 0 , WLAN_SSID_MAXLEN + 1);
|
memset(sLinkStatus.abySSID, 0 , WLAN_SSID_MAXLEN + 1);
|
||||||
|
|
||||||
|
@ -292,9 +263,8 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) {
|
||||||
memcpy(sLinkStatus.abySSID, pItemSSID->abySSID, pItemSSID->len);
|
memcpy(sLinkStatus.abySSID, pItemSSID->abySSID, pItemSSID->len);
|
||||||
memcpy(sLinkStatus.abyBSSID, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN);
|
memcpy(sLinkStatus.abyBSSID, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN);
|
||||||
sLinkStatus.uLinkRate = pMgmt->sNodeDBTable[0].wTxDataRate;
|
sLinkStatus.uLinkRate = pMgmt->sNodeDBTable[0].wTxDataRate;
|
||||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Link Success ! \n");
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Link Success!\n");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sLinkStatus.bLink = false;
|
sLinkStatus.bLink = false;
|
||||||
sLinkStatus.uLinkRate = 0;
|
sLinkStatus.uLinkRate = 0;
|
||||||
}
|
}
|
||||||
|
@ -302,7 +272,6 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) {
|
||||||
result = -EFAULT;
|
result = -EFAULT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WLAN_CMD_GET_LISTLEN:
|
case WLAN_CMD_GET_LISTLEN:
|
||||||
|
@ -340,7 +309,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) {
|
||||||
pList->sBSSIDList[ii].uChannel = pBSS->uChannel;
|
pList->sBSSIDList[ii].uChannel = pBSS->uChannel;
|
||||||
pList->sBSSIDList[ii].wBeaconInterval = pBSS->wBeaconInterval;
|
pList->sBSSIDList[ii].wBeaconInterval = pBSS->wBeaconInterval;
|
||||||
pList->sBSSIDList[ii].wCapInfo = pBSS->wCapInfo;
|
pList->sBSSIDList[ii].wCapInfo = pBSS->wCapInfo;
|
||||||
// pList->sBSSIDList[ii].uRSSI = pBSS->uRSSI;
|
/* pList->sBSSIDList[ii].uRSSI = pBSS->uRSSI; */
|
||||||
RFvRSSITodBm(pDevice, (unsigned char)(pBSS->uRSSI), &ldBm);
|
RFvRSSITodBm(pDevice, (unsigned char)(pBSS->uRSSI), &ldBm);
|
||||||
pList->sBSSIDList[ii].uRSSI = (unsigned int)ldBm;
|
pList->sBSSIDList[ii].uRSSI = (unsigned int)ldBm;
|
||||||
memcpy(pList->sBSSIDList[ii].abyBSSID, pBSS->abyBSSID, WLAN_BSSID_LEN);
|
memcpy(pList->sBSSIDList[ii].abyBSSID, pBSS->abyBSSID, WLAN_BSSID_LEN);
|
||||||
|
@ -349,17 +318,15 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) {
|
||||||
memcpy(pList->sBSSIDList[ii].abySSID, pItemSSID->abySSID, pItemSSID->len);
|
memcpy(pList->sBSSIDList[ii].abySSID, pItemSSID->abySSID, pItemSSID->len);
|
||||||
if (WLAN_GET_CAP_INFO_ESS(pBSS->wCapInfo)) {
|
if (WLAN_GET_CAP_INFO_ESS(pBSS->wCapInfo)) {
|
||||||
pList->sBSSIDList[ii].byNetType = INFRA;
|
pList->sBSSIDList[ii].byNetType = INFRA;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
pList->sBSSIDList[ii].byNetType = ADHOC;
|
pList->sBSSIDList[ii].byNetType = ADHOC;
|
||||||
}
|
}
|
||||||
if (WLAN_GET_CAP_INFO_PRIVACY(pBSS->wCapInfo)) {
|
if (WLAN_GET_CAP_INFO_PRIVACY(pBSS->wCapInfo)) {
|
||||||
pList->sBSSIDList[ii].bWEPOn = true;
|
pList->sBSSIDList[ii].bWEPOn = true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
pList->sBSSIDList[ii].bWEPOn = false;
|
pList->sBSSIDList[ii].bWEPOn = false;
|
||||||
}
|
}
|
||||||
ii ++;
|
ii++;
|
||||||
if (ii >= pList->uItem)
|
if (ii >= pList->uItem)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -386,8 +353,8 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WLAN_CMD_STOP_MAC:
|
|
||||||
|
|
||||||
|
case WLAN_CMD_STOP_MAC:
|
||||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_STOP_MAC\n");
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_STOP_MAC\n");
|
||||||
netif_stop_queue(pDevice->dev);
|
netif_stop_queue(pDevice->dev);
|
||||||
|
|
||||||
|
@ -404,11 +371,9 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) {
|
||||||
pDevice->bMACSuspend = true;
|
pDevice->bMACSuspend = true;
|
||||||
MACvIntDisable(pDevice->PortOffset);
|
MACvIntDisable(pDevice->PortOffset);
|
||||||
spin_unlock_irq(&pDevice->lock);
|
spin_unlock_irq(&pDevice->lock);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WLAN_CMD_START_MAC:
|
case WLAN_CMD_START_MAC:
|
||||||
|
|
||||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_START_MAC\n");
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_START_MAC\n");
|
||||||
|
|
||||||
if (pDevice->bMACSuspend == true) {
|
if (pDevice->bMACSuspend == true) {
|
||||||
|
@ -422,7 +387,6 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WLAN_CMD_SET_HOSTAPD:
|
case WLAN_CMD_SET_HOSTAPD:
|
||||||
|
|
||||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_HOSTAPD\n");
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_HOSTAPD\n");
|
||||||
|
|
||||||
if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) {
|
if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) {
|
||||||
|
@ -430,28 +394,23 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (sValue.dwValue == 1) {
|
if (sValue.dwValue == 1) {
|
||||||
if (vt6655_hostap_set_hostapd(pDevice, 1, 1) == 0){
|
if (vt6655_hostap_set_hostapd(pDevice, 1, 1) == 0) {
|
||||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable HOSTAP\n");
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable HOSTAP\n");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
result = -EFAULT;
|
result = -EFAULT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
vt6655_hostap_set_hostapd(pDevice, 0, 1);
|
vt6655_hostap_set_hostapd(pDevice, 0, 1);
|
||||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable HOSTAP\n");
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable HOSTAP\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WLAN_CMD_SET_HOSTAPD_STA:
|
case WLAN_CMD_SET_HOSTAPD_STA:
|
||||||
|
|
||||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_HOSTAPD_STA\n");
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_HOSTAPD_STA\n");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case WLAN_CMD_SET_802_1X:
|
|
||||||
|
|
||||||
|
case WLAN_CMD_SET_802_1X:
|
||||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_802_1X\n");
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_802_1X\n");
|
||||||
if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) {
|
if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) {
|
||||||
result = -EFAULT;
|
result = -EFAULT;
|
||||||
|
@ -461,17 +420,13 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) {
|
||||||
if (sValue.dwValue == 1) {
|
if (sValue.dwValue == 1) {
|
||||||
pDevice->bEnable8021x = true;
|
pDevice->bEnable8021x = true;
|
||||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable 802.1x\n");
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable 802.1x\n");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
pDevice->bEnable8021x = false;
|
pDevice->bEnable8021x = false;
|
||||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable 802.1x\n");
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable 802.1x\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case WLAN_CMD_SET_HOST_WEP:
|
case WLAN_CMD_SET_HOST_WEP:
|
||||||
|
|
||||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_HOST_WEP\n");
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_HOST_WEP\n");
|
||||||
if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) {
|
if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) {
|
||||||
result = -EFAULT;
|
result = -EFAULT;
|
||||||
|
@ -481,12 +436,10 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) {
|
||||||
if (sValue.dwValue == 1) {
|
if (sValue.dwValue == 1) {
|
||||||
pDevice->bEnableHostWEP = true;
|
pDevice->bEnableHostWEP = true;
|
||||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable HostWEP\n");
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable HostWEP\n");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
pDevice->bEnableHostWEP = false;
|
pDevice->bEnableHostWEP = false;
|
||||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable HostWEP\n");
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable HostWEP\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WLAN_CMD_SET_WPA:
|
case WLAN_CMD_SET_WPA:
|
||||||
|
@ -500,16 +453,13 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) {
|
||||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "up wpadev\n");
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "up wpadev\n");
|
||||||
memcpy(pDevice->wpadev->dev_addr, pDevice->dev->dev_addr, ETH_ALEN);
|
memcpy(pDevice->wpadev->dev_addr, pDevice->dev->dev_addr, ETH_ALEN);
|
||||||
pDevice->bWPADEVUp = true;
|
pDevice->bWPADEVUp = true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "close wpadev\n");
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "close wpadev\n");
|
||||||
pDevice->bWPADEVUp = false;
|
pDevice->bWPADEVUp = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WLAN_CMD_AP_START:
|
case WLAN_CMD_AP_START:
|
||||||
|
|
||||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_AP_START\n");
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_AP_START\n");
|
||||||
if (pDevice->bRadioOff == true) {
|
if (pDevice->bRadioOff == true) {
|
||||||
CARDbRadioPowerOn(pDevice);
|
CARDbRadioPowerOn(pDevice);
|
||||||
|
@ -525,21 +475,17 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) {
|
||||||
if (sStartAPCmd.wBSSType == AP) {
|
if (sStartAPCmd.wBSSType == AP) {
|
||||||
pMgmt->eConfigMode = WMAC_CONFIG_AP;
|
pMgmt->eConfigMode = WMAC_CONFIG_AP;
|
||||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ioct set to AP mode\n");
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ioct set to AP mode\n");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ioct BSS type not set to AP mode\n");
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ioct BSS type not set to AP mode\n");
|
||||||
result = -EFAULT;
|
result = -EFAULT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (sStartAPCmd.wBBPType == PHY80211g) {
|
if (sStartAPCmd.wBBPType == PHY80211g) {
|
||||||
pMgmt->byAPBBType = PHY_TYPE_11G;
|
pMgmt->byAPBBType = PHY_TYPE_11G;
|
||||||
}
|
} else if (sStartAPCmd.wBBPType == PHY80211a) {
|
||||||
else if (sStartAPCmd.wBBPType == PHY80211a) {
|
|
||||||
pMgmt->byAPBBType = PHY_TYPE_11A;
|
pMgmt->byAPBBType = PHY_TYPE_11A;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
pMgmt->byAPBBType = PHY_TYPE_11B;
|
pMgmt->byAPBBType = PHY_TYPE_11B;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -547,7 +493,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) {
|
||||||
memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
|
memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
|
||||||
memcpy(pMgmt->abyDesireSSID, pItemSSID, pItemSSID->len + WLAN_IEHDR_LEN);
|
memcpy(pMgmt->abyDesireSSID, pItemSSID, pItemSSID->len + WLAN_IEHDR_LEN);
|
||||||
|
|
||||||
if ((sStartAPCmd.uChannel > 0)&&(sStartAPCmd.uChannel <= 14))
|
if ((sStartAPCmd.uChannel > 0) && (sStartAPCmd.uChannel <= 14))
|
||||||
pDevice->uChannel = sStartAPCmd.uChannel;
|
pDevice->uChannel = sStartAPCmd.uChannel;
|
||||||
|
|
||||||
if ((sStartAPCmd.uBeaconInt >= 20) && (sStartAPCmd.uBeaconInt <= 1000))
|
if ((sStartAPCmd.uBeaconInt >= 20) && (sStartAPCmd.uBeaconInt <= 1000))
|
||||||
|
@ -555,13 +501,12 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) {
|
||||||
else
|
else
|
||||||
pMgmt->wIBSSBeaconPeriod = 100;
|
pMgmt->wIBSSBeaconPeriod = 100;
|
||||||
|
|
||||||
if (sStartAPCmd.bShareKeyAuth == true){
|
if (sStartAPCmd.bShareKeyAuth == true) {
|
||||||
pMgmt->bShareKeyAlgorithm = true;
|
pMgmt->bShareKeyAlgorithm = true;
|
||||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Share Key \n");
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Share Key\n");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
pMgmt->bShareKeyAlgorithm = false;
|
pMgmt->bShareKeyAlgorithm = false;
|
||||||
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Open System \n");
|
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Open System\n");
|
||||||
}
|
}
|
||||||
memcpy(pMgmt->abyIBSSSuppRates, abySuppRates, 6);
|
memcpy(pMgmt->abyIBSSSuppRates, abySuppRates, 6);
|
||||||
|
|
||||||
|
@ -570,17 +515,17 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) {
|
||||||
pMgmt->abyIBSSSuppRates[3] |= BIT7;
|
pMgmt->abyIBSSSuppRates[3] |= BIT7;
|
||||||
pMgmt->abyIBSSSuppRates[4] |= BIT7;
|
pMgmt->abyIBSSSuppRates[4] |= BIT7;
|
||||||
pMgmt->abyIBSSSuppRates[5] |= BIT7;
|
pMgmt->abyIBSSSuppRates[5] |= BIT7;
|
||||||
}else if (sStartAPCmd.byBasicRate & BIT2) {
|
} else if (sStartAPCmd.byBasicRate & BIT2) {
|
||||||
pMgmt->abyIBSSSuppRates[2] |= BIT7;
|
pMgmt->abyIBSSSuppRates[2] |= BIT7;
|
||||||
pMgmt->abyIBSSSuppRates[3] |= BIT7;
|
pMgmt->abyIBSSSuppRates[3] |= BIT7;
|
||||||
pMgmt->abyIBSSSuppRates[4] |= BIT7;
|
pMgmt->abyIBSSSuppRates[4] |= BIT7;
|
||||||
}else if (sStartAPCmd.byBasicRate & BIT1) {
|
} else if (sStartAPCmd.byBasicRate & BIT1) {
|
||||||
pMgmt->abyIBSSSuppRates[2] |= BIT7;
|
pMgmt->abyIBSSSuppRates[2] |= BIT7;
|
||||||
pMgmt->abyIBSSSuppRates[3] |= BIT7;
|
pMgmt->abyIBSSSuppRates[3] |= BIT7;
|
||||||
}else if (sStartAPCmd.byBasicRate & BIT1) {
|
} else if (sStartAPCmd.byBasicRate & BIT1) {
|
||||||
pMgmt->abyIBSSSuppRates[2] |= BIT7;
|
pMgmt->abyIBSSSuppRates[2] |= BIT7;
|
||||||
}else {
|
} else {
|
||||||
//default 1,2M
|
/* default 1,2M */
|
||||||
pMgmt->abyIBSSSuppRates[2] |= BIT7;
|
pMgmt->abyIBSSSuppRates[2] |= BIT7;
|
||||||
pMgmt->abyIBSSSuppRates[3] |= BIT7;
|
pMgmt->abyIBSSSuppRates[3] |= BIT7;
|
||||||
}
|
}
|
||||||
|
@ -589,8 +534,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) {
|
||||||
pMgmt->abyIBSSSuppRates[2],
|
pMgmt->abyIBSSSuppRates[2],
|
||||||
pMgmt->abyIBSSSuppRates[3],
|
pMgmt->abyIBSSSuppRates[3],
|
||||||
pMgmt->abyIBSSSuppRates[4],
|
pMgmt->abyIBSSSuppRates[4],
|
||||||
pMgmt->abyIBSSSuppRates[5]
|
pMgmt->abyIBSSSuppRates[5]);
|
||||||
);
|
|
||||||
|
|
||||||
netif_stop_queue(pDevice->dev);
|
netif_stop_queue(pDevice->dev);
|
||||||
spin_lock_irq(&pDevice->lock);
|
spin_lock_irq(&pDevice->lock);
|
||||||
|
@ -599,7 +543,6 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WLAN_CMD_GET_NODE_CNT:
|
case WLAN_CMD_GET_NODE_CNT:
|
||||||
|
|
||||||
cbListCount = 0;
|
cbListCount = 0;
|
||||||
pNode = &(pMgmt->sNodeDBTable[0]);
|
pNode = &(pMgmt->sNodeDBTable[0]);
|
||||||
for (ii = 0; ii < (MAX_NODE_NUM + 1); ii++) {
|
for (ii = 0; ii < (MAX_NODE_NUM + 1); ii++) {
|
||||||
|
@ -618,7 +561,6 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WLAN_CMD_GET_NODE_LIST:
|
case WLAN_CMD_GET_NODE_LIST:
|
||||||
|
|
||||||
if (copy_from_user(&sNodeList, pReq->data, sizeof(SNodeList))) {
|
if (copy_from_user(&sNodeList, pReq->data, sizeof(SNodeList))) {
|
||||||
result = -EFAULT;
|
result = -EFAULT;
|
||||||
break;
|
break;
|
||||||
|
@ -648,13 +590,12 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) {
|
||||||
pNodeList->sNodeList[jj].abyWepKey[1],
|
pNodeList->sNodeList[jj].abyWepKey[1],
|
||||||
pNodeList->sNodeList[jj].abyWepKey[2],
|
pNodeList->sNodeList[jj].abyWepKey[2],
|
||||||
pNodeList->sNodeList[jj].abyWepKey[3],
|
pNodeList->sNodeList[jj].abyWepKey[3],
|
||||||
pNodeList->sNodeList[jj].abyWepKey[4]
|
pNodeList->sNodeList[jj].abyWepKey[4]);
|
||||||
);
|
|
||||||
pNodeList->sNodeList[jj].bIsInFallback = pNode->bIsInFallback;
|
pNodeList->sNodeList[jj].bIsInFallback = pNode->bIsInFallback;
|
||||||
pNodeList->sNodeList[jj].uTxFailures = pNode->uTxFailures;
|
pNodeList->sNodeList[jj].uTxFailures = pNode->uTxFailures;
|
||||||
pNodeList->sNodeList[jj].uTxAttempts = pNode->uTxAttempts;
|
pNodeList->sNodeList[jj].uTxAttempts = pNode->uTxAttempts;
|
||||||
pNodeList->sNodeList[jj].wFailureRatio = (unsigned short)pNode->uFailureRatio;
|
pNodeList->sNodeList[jj].wFailureRatio = (unsigned short)pNode->uFailureRatio;
|
||||||
jj ++;
|
jj++;
|
||||||
if (jj >= pNodeList->uItem)
|
if (jj >= pNodeList->uItem)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -669,7 +610,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) {
|
||||||
|
|
||||||
#ifdef WPA_SM_Transtatus
|
#ifdef WPA_SM_Transtatus
|
||||||
case 0xFF:
|
case 0xFF:
|
||||||
memset(wpa_Result.ifname,0,sizeof(wpa_Result.ifname));
|
memset(wpa_Result.ifname, 0, sizeof(wpa_Result.ifname));
|
||||||
wpa_Result.proto = 0;
|
wpa_Result.proto = 0;
|
||||||
wpa_Result.key_mgmt = 0;
|
wpa_Result.key_mgmt = 0;
|
||||||
wpa_Result.eap_type = 0;
|
wpa_Result.eap_type = 0;
|
||||||
|
@ -680,8 +621,8 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(wpa_Result.authenticated==true) {
|
if (wpa_Result.authenticated == true) {
|
||||||
#ifdef SndEvt_ToAPI
|
#ifdef SndEvt_ToAPI
|
||||||
{
|
{
|
||||||
union iwreq_data wrqu;
|
union iwreq_data wrqu;
|
||||||
|
|
||||||
|
@ -689,20 +630,12 @@ if(wpa_Result.authenticated==true) {
|
||||||
|
|
||||||
memset(&wrqu, 0, sizeof(wrqu));
|
memset(&wrqu, 0, sizeof(wrqu));
|
||||||
wrqu.data.flags = RT_WPACONNECTED_EVENT_FLAG;
|
wrqu.data.flags = RT_WPACONNECTED_EVENT_FLAG;
|
||||||
wrqu.data.length =pItemSSID->len;
|
wrqu.data.length = pItemSSID->len;
|
||||||
wireless_send_event(pDevice->dev, IWEVCUSTOM, &wrqu, pItemSSID->abySSID);
|
wireless_send_event(pDevice->dev, IWEVCUSTOM, &wrqu, pItemSSID->abySSID);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
pDevice->fWPA_Authened = true; //is successful peer to wpa_Result.authenticated?
|
pDevice->fWPA_Authened = true; /* is successful peer to wpa_Result.authenticated? */
|
||||||
}
|
}
|
||||||
|
|
||||||
//printk("get private wpa_supplicant announce WPA SM\n");
|
|
||||||
//printk("wpa-->ifname=%s\n",wpa_Result.ifname);
|
|
||||||
//printk("wpa-->proto=%d\n",wpa_Result.proto);
|
|
||||||
//printk("wpa-->key-mgmt=%d\n",wpa_Result.key_mgmt);
|
|
||||||
//printk("wpa-->eap_type=%d\n",wpa_Result.eap_type);
|
|
||||||
//printk("wpa-->authenticated is %s\n",(wpa_Result.authenticated==true)?"true":"false");
|
|
||||||
|
|
||||||
pReq->wResult = 0;
|
pReq->wResult = 0;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
@ -713,41 +646,3 @@ if(wpa_Result.authenticated==true) {
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
void
|
|
||||||
vConfigWEPKey (
|
|
||||||
PSDevice pDevice,
|
|
||||||
unsigned long dwKeyIndex,
|
|
||||||
unsigned char *pbyKey,
|
|
||||||
unsigned long uKeyLength
|
|
||||||
)
|
|
||||||
{
|
|
||||||
int ii;
|
|
||||||
|
|
||||||
|
|
||||||
memset(&pDevice->abyWepKey[dwKeyIndex][0], 0, WLAN_WEPMAX_KEYLEN);
|
|
||||||
memcpy(&pDevice->abyWepKey[dwKeyIndex][0], pbyKey, uKeyLength);
|
|
||||||
|
|
||||||
pDevice->bWepKeyAvailable[dwKeyIndex] = true;
|
|
||||||
pDevice->auWepKeyLength[dwKeyIndex] = uKeyLength;
|
|
||||||
|
|
||||||
MACvSetDefaultKeyEntry(pDevice->PortOffset, uKeyLength, dwKeyIndex,
|
|
||||||
(unsigned long *) &(pDevice->abyWepKey[dwKeyIndex][0]), pDevice->byLocalID);
|
|
||||||
|
|
||||||
if (pDevice->eEncryptionStatus < Ndis802_11EncryptionNotSupported) {
|
|
||||||
for(ii=0; ii<MAX_GROUP_KEY; ii++) {
|
|
||||||
if ((pDevice->bWepKeyAvailable[ii] == true) &&
|
|
||||||
(pDevice->auWepKeyLength[ii] == WLAN_WEP232_KEYLEN)) {
|
|
||||||
pDevice->uCurrentWEPMode = TX_WEP_SW232;
|
|
||||||
MACvDisableDefaultKey(pDevice->PortOffset);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((ii == MAX_GROUP_KEY) &&
|
|
||||||
(pDevice->eEncryptionStatus < Ndis802_11EncryptionNotSupported)) {
|
|
||||||
MACvEnableDefaultKey(pDevice->PortOffset, pDevice->byLocalID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue