Commit 883aeecc authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman

Staging: vt6656: whitespace cleanups in ioctl.c

The indents on this file didn't line up so it was hard to work with.
I changed other white space issues as I came across them.  I also
deleted or changed some couple comments and the comment style.
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 4fb544c9
...@@ -40,666 +40,597 @@ ...@@ -40,666 +40,597 @@
#include "rndis.h" #include "rndis.h"
#include "rf.h" #include "rf.h"
/*--------------------- Static Definitions -------------------------*/ SWPAResult wpa_Result;
static int msglevel = MSG_LEVEL_INFO;
/*--------------------- Static Classes ----------------------------*/
int private_ioctl(PSDevice pDevice, struct ifreq *rq)
/*--------------------- Static Variables --------------------------*/ {
//static int msglevel =MSG_LEVEL_DEBUG;
static int msglevel =MSG_LEVEL_INFO; PSCmdRequest pReq = (PSCmdRequest)rq;
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
SWPAResult wpa_Result; int result = 0;
PWLAN_IE_SSID pItemSSID;
/*--------------------- Static Functions --------------------------*/ SCmdBSSJoin sJoinCmd;
SCmdZoneTypeSet sZoneTypeCmd;
/*--------------------- Export Variables --------------------------*/ SCmdScan sScanCmd;
SCmdStartAP sStartAPCmd;
int private_ioctl(PSDevice pDevice, struct ifreq *rq) { SCmdSetWEP sWEPCmd;
SCmdValue sValue;
PSCmdRequest pReq = (PSCmdRequest)rq; SBSSIDList sList;
PSMgmtObject pMgmt = &(pDevice->sMgmtObj); SNodeList sNodeList;
int result = 0; PSBSSIDList pList;
PWLAN_IE_SSID pItemSSID; PSNodeList pNodeList;
SCmdBSSJoin sJoinCmd; unsigned int cbListCount;
SCmdZoneTypeSet sZoneTypeCmd; PKnownBSS pBSS;
SCmdScan sScanCmd; PKnownNodeDB pNode;
SCmdStartAP sStartAPCmd; unsigned int ii, jj;
SCmdSetWEP sWEPCmd; SCmdLinkStatus sLinkStatus;
SCmdValue sValue; BYTE abySuppRates[] = {WLAN_EID_SUPP_RATES, 4, 0x02, 0x04, 0x0B, 0x16};
SBSSIDList sList; BYTE abyNullAddr[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
SNodeList sNodeList; DWORD dwKeyIndex = 0;
PSBSSIDList pList; BYTE abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
PSNodeList pNodeList; signed long ldBm;
unsigned int cbListCount;
PKnownBSS pBSS; pReq->wResult = 0;
PKnownNodeDB pNode;
unsigned int ii, jj; switch (pReq->wCmdCode) {
SCmdLinkStatus sLinkStatus; case WLAN_CMD_BSS_SCAN:
BYTE abySuppRates[] = {WLAN_EID_SUPP_RATES, 4, 0x02, 0x04, 0x0B, 0x16}; if (copy_from_user(&sScanCmd, pReq->data, sizeof(SCmdScan))) {
BYTE abyNullAddr[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
DWORD dwKeyIndex= 0;
BYTE abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
signed long ldBm;
pReq->wResult = 0;
switch(pReq->wCmdCode) {
case WLAN_CMD_BSS_SCAN:
if (copy_from_user(&sScanCmd, pReq->data, sizeof(SCmdScan))) {
result = -EFAULT; result = -EFAULT;
break; break;
} }
pItemSSID = (PWLAN_IE_SSID)sScanCmd.ssid; pItemSSID = (PWLAN_IE_SSID)sScanCmd.ssid;
if (pItemSSID->len != 0) { if (pItemSSID->len != 0) {
memset(abyScanSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); memset(abyScanSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
memcpy(abyScanSSID, pItemSSID, pItemSSID->len + WLAN_IEHDR_LEN); memcpy(abyScanSSID, pItemSSID, pItemSSID->len + WLAN_IEHDR_LEN);
} }
spin_lock_irq(&pDevice->lock); spin_lock_irq(&pDevice->lock);
if (memcmp(pMgmt->abyCurrBSSID, &abyNullAddr[0], 6) == 0) if (memcmp(pMgmt->abyCurrBSSID, &abyNullAddr[0], 6) == 0)
BSSvClearBSSList((void *) pDevice, FALSE); BSSvClearBSSList((void *)pDevice, FALSE);
else else
BSSvClearBSSList((void *) pDevice, pDevice->bLinkPass); BSSvClearBSSList((void *)pDevice, pDevice->bLinkPass);
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 (pItemSSID->len != 0) if (pItemSSID->len != 0)
bScheduleCommand((void *) pDevice, bScheduleCommand((void *)pDevice,
WLAN_CMD_BSSID_SCAN, WLAN_CMD_BSSID_SCAN,
abyScanSSID); abyScanSSID);
else else
bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, NULL); bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, NULL);
spin_unlock_irq(&pDevice->lock); spin_unlock_irq(&pDevice->lock);
break; break;
case WLAN_CMD_ZONETYPE_SET: case WLAN_CMD_ZONETYPE_SET:
//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))) {
result = -EFAULT; result = -EFAULT;
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) {
} /* set to Europe */
else if(sZoneTypeCmd.ZoneType == ZoneType_Europe) { printk("set_ZoneType:Europe\n");
//set to Europe }
printk("set_ZoneType:Europe\n"); } else {
} /* read zonetype */
} BYTE zonetype = 0;
else {
///////read zonetype if (zonetype == 0x00) { /* USA */
BYTE zonetype=0; sZoneTypeCmd.ZoneType = ZoneType_USA;
} else if (zonetype == 0x01) { /* Japan */
sZoneTypeCmd.ZoneType = ZoneType_Japan;
if(zonetype == 0x00) { //USA } else if (zonetype == 0x02) { /* Europe */
sZoneTypeCmd.ZoneType = ZoneType_USA; sZoneTypeCmd.ZoneType = ZoneType_Europe;
} } else { /* Unknown ZoneType */
else if(zonetype == 0x01) { //Japan printk("Error:ZoneType[%x] Unknown ???\n", zonetype);
sZoneTypeCmd.ZoneType = ZoneType_Japan; result = -EFAULT;
} break;
else if(zonetype == 0x02) { //Europe }
sZoneTypeCmd.ZoneType = ZoneType_Europe;
} if (copy_to_user(pReq->data, &sZoneTypeCmd,
else { //Unknown ZoneType sizeof(SCmdZoneTypeSet))) {
printk("Error:ZoneType[%x] Unknown ???\n",zonetype); result = -EFAULT;
result = -EFAULT; break;
}
}
break; break;
} case WLAN_CMD_BSS_JOIN:
if (copy_to_user(pReq->data, &sZoneTypeCmd, sizeof(SCmdZoneTypeSet))) { if (copy_from_user(&sJoinCmd, pReq->data, sizeof(SCmdBSSJoin))) {
result = -EFAULT; result = -EFAULT;
break; break;
} }
}
break; pItemSSID = (PWLAN_IE_SSID)sJoinCmd.ssid;
memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
memcpy(pMgmt->abyDesireSSID, pItemSSID, pItemSSID->len + WLAN_IEHDR_LEN);
if (sJoinCmd.wBSSType == ADHOC) {
pMgmt->eConfigMode = WMAC_CONFIG_IBSS_STA;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ioct set to adhoc mode\n");
} else {
pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ioct set to STA mode\n");
}
if (sJoinCmd.bPSEnable == TRUE) {
pDevice->ePSMode = WMAC_POWER_FAST;
pMgmt->wListenInterval = 2;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Power Saving On\n");
} else {
pDevice->ePSMode = WMAC_POWER_CAM;
pMgmt->wListenInterval = 1;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Power Saving Off\n");
}
if (sJoinCmd.bShareKeyAuth == TRUE) {
pMgmt->bShareKeyAlgorithm = TRUE;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Share Key\n");
} else {
pMgmt->bShareKeyAlgorithm = FALSE;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Open System\n");
}
case WLAN_CMD_BSS_JOIN: pDevice->uChannel = sJoinCmd.uChannel;
netif_stop_queue(pDevice->dev);
spin_lock_irq(&pDevice->lock);
pMgmt->eCurrState = WMAC_STATE_IDLE;
bScheduleCommand((void *) pDevice,
WLAN_CMD_BSSID_SCAN,
pMgmt->abyDesireSSID);
bScheduleCommand((void *) pDevice, WLAN_CMD_SSID, NULL);
spin_unlock_irq(&pDevice->lock);
break;
if (copy_from_user(&sJoinCmd, pReq->data, sizeof(SCmdBSSJoin))) { case WLAN_CMD_SET_WEP:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_WEP Key.\n");
memset(&sWEPCmd, 0, sizeof(SCmdSetWEP));
if (copy_from_user(&sWEPCmd, pReq->data, sizeof(SCmdSetWEP))) {
result = -EFAULT; result = -EFAULT;
break; break;
} }
if (sWEPCmd.bEnableWep != TRUE) {
pItemSSID = (PWLAN_IE_SSID)sJoinCmd.ssid; int uu;
memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
memcpy(pMgmt->abyDesireSSID, pItemSSID, pItemSSID->len + WLAN_IEHDR_LEN); pDevice->bEncryptionEnable = FALSE;
if (sJoinCmd.wBSSType == ADHOC) { pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
pMgmt->eConfigMode = WMAC_CONFIG_IBSS_STA; spin_lock_irq(&pDevice->lock);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ioct set to adhoc mode\n"); for (uu = 0; uu < MAX_KEY_TABLE; uu++)
} MACvDisableKeyEntry(pDevice, uu);
else { spin_unlock_irq(&pDevice->lock);
pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WEP function disable.\n");
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ioct set to STA mode\n");
}
if (sJoinCmd.bPSEnable == TRUE) {
pDevice->ePSMode = WMAC_POWER_FAST;
// pDevice->ePSMode = WMAC_POWER_MAX;
pMgmt->wListenInterval = 2;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Power Saving On\n");
}
else {
pDevice->ePSMode = WMAC_POWER_CAM;
pMgmt->wListenInterval = 1;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Power Saving Off \n");
}
if (sJoinCmd.bShareKeyAuth == TRUE){
pMgmt->bShareKeyAlgorithm = TRUE;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Share Key \n");
}
else {
pMgmt->bShareKeyAlgorithm = FALSE;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Open System \n");
}
pDevice->uChannel = sJoinCmd.uChannel;
netif_stop_queue(pDevice->dev);
spin_lock_irq(&pDevice->lock);
pMgmt->eCurrState = WMAC_STATE_IDLE;
bScheduleCommand((void *) pDevice,
WLAN_CMD_BSSID_SCAN,
pMgmt->abyDesireSSID);
bScheduleCommand((void *) pDevice, WLAN_CMD_SSID, NULL);
spin_unlock_irq(&pDevice->lock);
break;
case WLAN_CMD_SET_WEP:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_WEP Key. \n");
memset(&sWEPCmd, 0 ,sizeof(SCmdSetWEP));
if (copy_from_user(&sWEPCmd, pReq->data, sizeof(SCmdSetWEP))) {
result = -EFAULT;
break; break;
} }
if (sWEPCmd.bEnableWep != TRUE) {
int uu; for (ii = 0; ii < WLAN_WEP_NKEYS; ii++) {
if (sWEPCmd.bWepKeyAvailable[ii]) {
pDevice->bEncryptionEnable = FALSE; if (ii == sWEPCmd.byKeyIndex)
pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; dwKeyIndex = ii | (1 << 31);
spin_lock_irq(&pDevice->lock); else
for (uu = 0; uu < MAX_KEY_TABLE; uu++) dwKeyIndex = ii;
MACvDisableKeyEntry(pDevice, uu); spin_lock_irq(&pDevice->lock);
spin_unlock_irq(&pDevice->lock); KeybSetDefaultKey(pDevice, &(pDevice->sKey),
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WEP function disable.\n"); dwKeyIndex,
break; sWEPCmd.auWepKeyLength[ii],
} NULL,
(PBYTE)&sWEPCmd.abyWepKey[ii][0],
for (ii = 0; ii < WLAN_WEP_NKEYS; ii ++) { KEY_CTL_WEP);
if (sWEPCmd.bWepKeyAvailable[ii]) { spin_unlock_irq(&pDevice->lock);
if (ii == sWEPCmd.byKeyIndex) }
//2006-1207-01<Modify>by Einsn Liu }
// dwKeyIndex|= (1 << 31); pDevice->byKeyIndex = sWEPCmd.byKeyIndex;
dwKeyIndex=ii|(1 << 31); pDevice->bTransmitKey = TRUE;
else pDevice->bEncryptionEnable = TRUE;
dwKeyIndex = ii; pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
spin_lock_irq(&pDevice->lock); break;
KeybSetDefaultKey( pDevice,
&(pDevice->sKey), case WLAN_CMD_GET_LINK:
dwKeyIndex, DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_GET_LINK status.\n");
sWEPCmd.auWepKeyLength[ii],
NULL, memset(sLinkStatus.abySSID, 0, WLAN_SSID_MAXLEN + 1);
(PBYTE)&sWEPCmd.abyWepKey[ii][0],
KEY_CTL_WEP if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA)
); sLinkStatus.wBSSType = ADHOC;
spin_unlock_irq(&pDevice->lock); else
sLinkStatus.wBSSType = INFRA;
}
} if (pMgmt->eCurrState == WMAC_STATE_JOINTED)
pDevice->byKeyIndex = sWEPCmd.byKeyIndex; sLinkStatus.byState = ADHOC_JOINTED;
pDevice->bTransmitKey = TRUE; else
pDevice->bEncryptionEnable = TRUE; sLinkStatus.byState = ADHOC_STARTED;
pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
sLinkStatus.uChannel = pMgmt->uCurrChannel;
break; if (pDevice->bLinkPass == TRUE) {
sLinkStatus.bLink = TRUE;
case WLAN_CMD_GET_LINK: pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_GET_LINK status. \n"); memcpy(sLinkStatus.abySSID, pItemSSID->abySSID, pItemSSID->len);
memcpy(sLinkStatus.abyBSSID, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN);
memset(sLinkStatus.abySSID, 0 , WLAN_SSID_MAXLEN + 1); sLinkStatus.uLinkRate = pMgmt->sNodeDBTable[0].wTxDataRate;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Link Success!\n");
if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) } else {
sLinkStatus.wBSSType = ADHOC; sLinkStatus.bLink = FALSE;
else sLinkStatus.uLinkRate = 0;
sLinkStatus.wBSSType = INFRA; }
if (copy_to_user(pReq->data, &sLinkStatus,
if (pMgmt->eCurrState == WMAC_STATE_JOINTED) sizeof(SCmdLinkStatus))) {
sLinkStatus.byState = ADHOC_JOINTED;
else
sLinkStatus.byState = ADHOC_STARTED;
sLinkStatus.uChannel = pMgmt->uCurrChannel;
if (pDevice->bLinkPass == TRUE) {
sLinkStatus.bLink = TRUE;
pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID;
memcpy(sLinkStatus.abySSID, pItemSSID->abySSID, pItemSSID->len);
memcpy(sLinkStatus.abyBSSID, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN);
sLinkStatus.uLinkRate = pMgmt->sNodeDBTable[0].wTxDataRate;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Link Success ! \n");
}
else {
sLinkStatus.bLink = FALSE;
sLinkStatus.uLinkRate = 0;
}
if (copy_to_user(pReq->data, &sLinkStatus, sizeof(SCmdLinkStatus))) {
result = -EFAULT; result = -EFAULT;
break; break;
} }
break;
break; case WLAN_CMD_GET_LISTLEN:
case WLAN_CMD_GET_LISTLEN:
cbListCount = 0; cbListCount = 0;
pBSS = &(pMgmt->sBSSList[0]); pBSS = &(pMgmt->sBSSList[0]);
for (ii = 0; ii < MAX_BSS_NUM; ii++) { for (ii = 0; ii < MAX_BSS_NUM; ii++) {
pBSS = &(pMgmt->sBSSList[ii]); pBSS = &(pMgmt->sBSSList[ii]);
if (!pBSS->bActive) if (!pBSS->bActive)
continue; continue;
cbListCount++; cbListCount++;
} }
sList.uItem = cbListCount; sList.uItem = cbListCount;
if (copy_to_user(pReq->data, &sList, sizeof(SBSSIDList))) { if (copy_to_user(pReq->data, &sList, sizeof(SBSSIDList))) {
result = -EFAULT; result = -EFAULT;
break; break;
} }
pReq->wResult = 0; pReq->wResult = 0;
break; break;
case WLAN_CMD_GET_LIST: case WLAN_CMD_GET_LIST:
if (copy_from_user(&sList, pReq->data, sizeof(SBSSIDList))) { if (copy_from_user(&sList, pReq->data, sizeof(SBSSIDList))) {
result = -EFAULT; result = -EFAULT;
break; break;
} }
pList = (PSBSSIDList)kmalloc(sizeof(SBSSIDList) + (sList.uItem * sizeof(SBSSIDItem)), (int)GFP_ATOMIC); pList = (PSBSSIDList)kmalloc(sizeof(SBSSIDList) + (sList.uItem * sizeof(SBSSIDItem)), (int)GFP_ATOMIC);
if (pList == NULL) { if (pList == NULL) {
result = -ENOMEM; result = -ENOMEM;
break; break;
} }
pList->uItem = sList.uItem; pList->uItem = sList.uItem;
pBSS = &(pMgmt->sBSSList[0]); pBSS = &(pMgmt->sBSSList[0]);
for (ii = 0, jj = 0; jj < MAX_BSS_NUM ; jj++) { for (ii = 0, jj = 0; jj < MAX_BSS_NUM ; jj++) {
pBSS = &(pMgmt->sBSSList[jj]); pBSS = &(pMgmt->sBSSList[jj]);
if (pBSS->bActive) { if (pBSS->bActive) {
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;
RFvRSSITodBm(pDevice, (BYTE)(pBSS->uRSSI), &ldBm); RFvRSSITodBm(pDevice, (BYTE)(pBSS->uRSSI), &ldBm);
pList->sBSSIDList[ii].uRSSI = (unsigned int) ldBm; pList->sBSSIDList[ii].uRSSI = (unsigned int) ldBm;
// pList->sBSSIDList[ii].uRSSI = pBSS->uRSSI; /* pList->sBSSIDList[ii].uRSSI = pBSS->uRSSI; */
memcpy(pList->sBSSIDList[ii].abyBSSID, pBSS->abyBSSID, WLAN_BSSID_LEN); memcpy(pList->sBSSIDList[ii].abyBSSID, pBSS->abyBSSID, WLAN_BSSID_LEN);
pItemSSID = (PWLAN_IE_SSID)pBSS->abySSID; pItemSSID = (PWLAN_IE_SSID)pBSS->abySSID;
memset(pList->sBSSIDList[ii].abySSID, 0, WLAN_SSID_MAXLEN + 1); memset(pList->sBSSIDList[ii].abySSID, 0, WLAN_SSID_MAXLEN + 1);
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 {
} pList->sBSSIDList[ii].bWEPOn = FALSE;
else { }
pList->sBSSIDList[ii].bWEPOn = FALSE; ii++;
} if (ii >= pList->uItem)
ii ++; break;
if (ii >= pList->uItem) }
break; }
}
} if (copy_to_user(pReq->data, pList, sizeof(SBSSIDList) + (sList.uItem * sizeof(SBSSIDItem)))) {
if (copy_to_user(pReq->data, pList, sizeof(SBSSIDList) + (sList.uItem * sizeof(SBSSIDItem)))) {
result = -EFAULT; result = -EFAULT;
break; break;
} }
kfree(pList); kfree(pList);
pReq->wResult = 0; pReq->wResult = 0;
break; break;
case WLAN_CMD_GET_MIB: case WLAN_CMD_GET_MIB:
if (copy_to_user(pReq->data, &(pDevice->s802_11Counter), sizeof(SDot11MIBCount))) { if (copy_to_user(pReq->data, &(pDevice->s802_11Counter), sizeof(SDot11MIBCount))) {
result = -EFAULT; result = -EFAULT;
break; break;
} }
break; break;
case WLAN_CMD_GET_STAT: case WLAN_CMD_GET_STAT:
if (copy_to_user(pReq->data, &(pDevice->scStatistic), sizeof(SStatCounter))) { if (copy_to_user(pReq->data, &(pDevice->scStatistic), sizeof(SStatCounter))) {
result = -EFAULT; result = -EFAULT;
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"); /* Todo xxxxxx */
// Todo xxxxxx netif_stop_queue(pDevice->dev);
netif_stop_queue(pDevice->dev); spin_lock_irq(&pDevice->lock);
spin_lock_irq(&pDevice->lock); if (pDevice->bRadioOff == FALSE) {
if (pDevice->bRadioOff == FALSE) { CARDbRadioPowerOff(pDevice);
CARDbRadioPowerOff(pDevice); }
} pDevice->bLinkPass = FALSE;
pDevice->bLinkPass = FALSE; ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_SLOW);
ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_SLOW); memset(pMgmt->abyCurrBSSID, 0, 6);
memset(pMgmt->abyCurrBSSID, 0, 6); pMgmt->eCurrState = WMAC_STATE_IDLE;
pMgmt->eCurrState = WMAC_STATE_IDLE; /* del_timer(&pDevice->sTimerCommand); */
// del_timer(&pDevice->sTimerCommand); /* del_timer(&pMgmt->sTimerSecondCallback); */
// del_timer(&pMgmt->sTimerSecondCallback); pDevice->bCmdRunning = FALSE;
pDevice->bCmdRunning = FALSE; spin_unlock_irq(&pDevice->lock);
spin_unlock_irq(&pDevice->lock); break;
break;
case WLAN_CMD_START_MAC:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_START_MAC\n");
// Todo xxxxxxx
if (pDevice->bRadioOff == TRUE)
CARDbRadioPowerOn(pDevice);
break;
case WLAN_CMD_SET_HOSTAPD: case WLAN_CMD_START_MAC:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_START_MAC\n");
/* Todo xxxxxxx */
if (pDevice->bRadioOff == TRUE)
CARDbRadioPowerOn(pDevice);
break;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_HOSTAPD\n"); case WLAN_CMD_SET_HOSTAPD:
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))) {
result = -EFAULT; result = -EFAULT;
break; break;
} }
if (sValue.dwValue == 1) { if (sValue.dwValue == 1) {
if (vt6656_hostap_set_hostapd(pDevice, 1, 1) == 0){ if (vt6656_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 { vt6656_hostap_set_hostapd(pDevice, 0, 1);
vt6656_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:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_HOSTAPD_STA\n");
break; case WLAN_CMD_SET_HOSTAPD_STA:
case WLAN_CMD_SET_802_1X: DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_HOSTAPD_STA\n");
break;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_802_1X\n"); case WLAN_CMD_SET_802_1X:
if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_802_1X\n");
if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) {
result = -EFAULT; result = -EFAULT;
break; break;
} }
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:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_HOST_WEP\n"); case WLAN_CMD_SET_HOST_WEP:
if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_HOST_WEP\n");
if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) {
result = -EFAULT; result = -EFAULT;
break; break;
} }
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:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_WPA\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_WPA\n");
if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) { if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) {
result = -EFAULT; result = -EFAULT;
break; break;
} }
if (sValue.dwValue == 1) { if (sValue.dwValue == 1) {
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, memcpy(pDevice->wpadev->dev_addr, pDevice->dev->dev_addr,
pDevice->dev->dev_addr, ETH_ALEN);
ETH_ALEN); pDevice->bWPADEVUp = TRUE;
pDevice->bWPADEVUp = TRUE; } else {
} DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "close wpadev\n");
else { pDevice->bWPADEVUp = FALSE;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "close wpadev\n"); }
pDevice->bWPADEVUp = FALSE; break;
}
case WLAN_CMD_AP_START:
break; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_AP_START\n");
if (pDevice->bRadioOff == TRUE) {
case WLAN_CMD_AP_START: CARDbRadioPowerOn(pDevice);
add_timer(&pMgmt->sTimerSecondCallback);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_AP_START\n"); }
if (pDevice->bRadioOff == TRUE) { if (copy_from_user(&sStartAPCmd, pReq->data, sizeof(SCmdStartAP))) {
CARDbRadioPowerOn(pDevice);
add_timer(&pMgmt->sTimerSecondCallback);
}
if (copy_from_user(&sStartAPCmd, pReq->data, sizeof(SCmdStartAP))) {
result = -EFAULT; result = -EFAULT;
break; break;
} }
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 {
} pMgmt->byAPBBType = PHY_TYPE_11B;
else { }
pMgmt->byAPBBType = PHY_TYPE_11B;
}
pItemSSID = (PWLAN_IE_SSID)sStartAPCmd.ssid; pItemSSID = (PWLAN_IE_SSID)sStartAPCmd.ssid;
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))
pMgmt->wIBSSBeaconPeriod = sStartAPCmd.uBeaconInt; pMgmt->wIBSSBeaconPeriod = sStartAPCmd.uBeaconInt;
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);
if (sStartAPCmd.byBasicRate & BIT3) {
if (sStartAPCmd.byBasicRate & BIT3) { pMgmt->abyIBSSSuppRates[2] |= BIT7;
pMgmt->abyIBSSSuppRates[2] |= BIT7; 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; }
}
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Support Rate= %x %x %x %x\n",
pMgmt->abyIBSSSuppRates[2],
pMgmt->abyIBSSSuppRates[3],
pMgmt->abyIBSSSuppRates[4],
pMgmt->abyIBSSSuppRates[5]
);
netif_stop_queue(pDevice->dev);
spin_lock_irq(&pDevice->lock);
bScheduleCommand((void *) pDevice, WLAN_CMD_RUN_AP, NULL);
spin_unlock_irq(&pDevice->lock);
break;
case WLAN_CMD_GET_NODE_CNT:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Support Rate= %x %x %x %x\n",
pMgmt->abyIBSSSuppRates[2],
pMgmt->abyIBSSSuppRates[3],
pMgmt->abyIBSSSuppRates[4],
pMgmt->abyIBSSSuppRates[5]);
netif_stop_queue(pDevice->dev);
spin_lock_irq(&pDevice->lock);
bScheduleCommand((void *)pDevice, WLAN_CMD_RUN_AP, NULL);
spin_unlock_irq(&pDevice->lock);
break;
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++) {
pNode = &(pMgmt->sNodeDBTable[ii]); pNode = &(pMgmt->sNodeDBTable[ii]);
if (!pNode->bActive) if (!pNode->bActive)
continue; continue;
cbListCount++; cbListCount++;
} }
sNodeList.uItem = cbListCount; sNodeList.uItem = cbListCount;
if (copy_to_user(pReq->data, &sNodeList, sizeof(SNodeList))) { if (copy_to_user(pReq->data, &sNodeList, sizeof(SNodeList))) {
result = -EFAULT; result = -EFAULT;
break; break;
} }
pReq->wResult = 0; pReq->wResult = 0;
break; break;
case WLAN_CMD_GET_NODE_LIST:
if (copy_from_user(&sNodeList, pReq->data, sizeof(SNodeList))) { case WLAN_CMD_GET_NODE_LIST:
if (copy_from_user(&sNodeList, pReq->data, sizeof(SNodeList))) {
result = -EFAULT; result = -EFAULT;
break; break;
} }
pNodeList = (PSNodeList)kmalloc(sizeof(SNodeList) + (sNodeList.uItem * sizeof(SNodeItem)), (int)GFP_ATOMIC); pNodeList = (PSNodeList)kmalloc(sizeof(SNodeList) + (sNodeList.uItem * sizeof(SNodeItem)), (int)GFP_ATOMIC);
if (pNodeList == NULL) { if (pNodeList == NULL) {
result = -ENOMEM; result = -ENOMEM;
break; break;
} }
pNodeList->uItem = sNodeList.uItem; pNodeList->uItem = sNodeList.uItem;
pNode = &(pMgmt->sNodeDBTable[0]); pNode = &(pMgmt->sNodeDBTable[0]);
for (ii = 0, jj = 0; ii < (MAX_NODE_NUM + 1); ii++) { for (ii = 0, jj = 0; ii < (MAX_NODE_NUM + 1); ii++) {
pNode = &(pMgmt->sNodeDBTable[ii]); pNode = &(pMgmt->sNodeDBTable[ii]);
if (pNode->bActive) { if (pNode->bActive) {
pNodeList->sNodeList[jj].wAID = pNode->wAID; pNodeList->sNodeList[jj].wAID = pNode->wAID;
memcpy(pNodeList->sNodeList[jj].abyMACAddr, pNode->abyMACAddr, WLAN_ADDR_LEN); memcpy(pNodeList->sNodeList[jj].abyMACAddr, pNode->abyMACAddr, WLAN_ADDR_LEN);
pNodeList->sNodeList[jj].wTxDataRate = pNode->wTxDataRate; pNodeList->sNodeList[jj].wTxDataRate = pNode->wTxDataRate;
pNodeList->sNodeList[jj].wInActiveCount = (WORD)pNode->uInActiveCount; pNodeList->sNodeList[jj].wInActiveCount = (WORD)pNode->uInActiveCount;
pNodeList->sNodeList[jj].wEnQueueCnt = (WORD)pNode->wEnQueueCnt; pNodeList->sNodeList[jj].wEnQueueCnt = (WORD)pNode->wEnQueueCnt;
pNodeList->sNodeList[jj].wFlags = (WORD)pNode->dwFlags; pNodeList->sNodeList[jj].wFlags = (WORD)pNode->dwFlags;
pNodeList->sNodeList[jj].bPWBitOn = pNode->bPSEnable; pNodeList->sNodeList[jj].bPWBitOn = pNode->bPSEnable;
pNodeList->sNodeList[jj].byKeyIndex = pNode->byKeyIndex; pNodeList->sNodeList[jj].byKeyIndex = pNode->byKeyIndex;
pNodeList->sNodeList[jj].wWepKeyLength = pNode->uWepKeyLength; pNodeList->sNodeList[jj].wWepKeyLength = pNode->uWepKeyLength;
memcpy(&(pNodeList->sNodeList[jj].abyWepKey[0]), &(pNode->abyWepKey[0]), WEP_KEYMAXLEN); memcpy(&(pNodeList->sNodeList[jj].abyWepKey[0]), &(pNode->abyWepKey[0]), WEP_KEYMAXLEN);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "key= %2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n", DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "key= %2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
pNodeList->sNodeList[jj].abyWepKey[0], pNodeList->sNodeList[jj].abyWepKey[0],
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 = (WORD)pNode->uFailureRatio;
pNodeList->sNodeList[jj].wFailureRatio = (WORD)pNode->uFailureRatio; jj++;
jj ++; if (jj >= pNodeList->uItem)
if (jj >= pNodeList->uItem) break;
break; }
} }
} if (copy_to_user(pReq->data, pNodeList, sizeof(SNodeList) + (sNodeList.uItem * sizeof(SNodeItem)))) {
if (copy_to_user(pReq->data, pNodeList, sizeof(SNodeList) + (sNodeList.uItem * sizeof(SNodeItem)))) {
result = -EFAULT; result = -EFAULT;
break; break;
} }
kfree(pNodeList); kfree(pNodeList);
pReq->wResult = 0; pReq->wResult = 0;
break; break;
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;
wpa_Result.authenticated = FALSE; wpa_Result.authenticated = FALSE;
pDevice->fWPA_Authened = FALSE; pDevice->fWPA_Authened = FALSE;
if (copy_from_user(&wpa_Result, pReq->data, sizeof(wpa_Result))) { if (copy_from_user(&wpa_Result, pReq->data, sizeof(wpa_Result))) {
result = -EFAULT; result = -EFAULT;
break; break;
} }
//DavidWang for some AP maybe good authenticate /* for some AP maybe good authenticate */
if(wpa_Result.key_mgmt==0x20) if (wpa_Result.key_mgmt == 0x20)
pMgmt->Cisco_cckm =1; pMgmt->Cisco_cckm = 1;
else else
pMgmt->Cisco_cckm =0; pMgmt->Cisco_cckm = 0;
if (wpa_Result.authenticated == TRUE) {
if(wpa_Result.authenticated==TRUE) { {
{ union iwreq_data wrqu;
union iwreq_data wrqu;
pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID;
pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; memset(&wrqu, 0, sizeof(wrqu));
wrqu.data.flags = RT_WPACONNECTED_EVENT_FLAG;
memset(&wrqu, 0, sizeof(wrqu)); wrqu.data.length = pItemSSID->len;
wrqu.data.flags = RT_WPACONNECTED_EVENT_FLAG; wireless_send_event(pDevice->dev, IWEVCUSTOM, &wrqu, pItemSSID->abySSID);
wrqu.data.length =pItemSSID->len; }
wireless_send_event(pDevice->dev, IWEVCUSTOM, &wrqu, pItemSSID->abySSID);
}
pDevice->fWPA_Authened = TRUE; //is successful peer to wpa_Result.authenticated?
}
//printk("get private wpa_supplicant announce WPA SM\n"); pDevice->fWPA_Authened = TRUE; /* is successful peer to wpa_Result.authenticated? */
//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;
default: default:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Private command not support..\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Private command not support..\n");
} }
return result; return result;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment