aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/vt6656
diff options
context:
space:
mode:
authorJesper Juhl <jj@chaosbits.net>2012-06-24 19:57:48 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-06-25 14:20:36 -0400
commit8c3337fec4c78f796767459de6429eecf2dc35c9 (patch)
treeb2d77b0e128ac94fd12596c658146dbba001dc10 /drivers/staging/vt6656
parent37f0777fb134794b39ce6d7f7443d5a932b87ab8 (diff)
staging: vt6656: iwctl: Clean up braces on 'if' statements
Clean up braces on 'if' statements to (mostly) match coding style. A few other bits, like removing a few blank lines and such may have snug in. Signed-off-by: Jesper Juhl <jj@chaosbits.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/vt6656')
-rw-r--r--drivers/staging/vt6656/iwctl.c145
1 files changed, 61 insertions, 84 deletions
diff --git a/drivers/staging/vt6656/iwctl.c b/drivers/staging/vt6656/iwctl.c
index 6307c6a68f7..dc240962c59 100644
--- a/drivers/staging/vt6656/iwctl.c
+++ b/drivers/staging/vt6656/iwctl.c
@@ -132,7 +132,7 @@ int iwctl_siwscan(struct net_device *dev, struct iw_request_info *info,
132 132
133 // mike add: active scan OR passive scan OR desire_ssid scan 133 // mike add: active scan OR passive scan OR desire_ssid scan
134 if (wrq->length == sizeof(struct iw_scan_req)) { 134 if (wrq->length == sizeof(struct iw_scan_req)) {
135 if (wrq->flags & IW_SCAN_THIS_ESSID) { // desire_ssid scan 135 if (wrq->flags & IW_SCAN_THIS_ESSID) { // desire_ssid scan
136 memset(abyScanSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); 136 memset(abyScanSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
137 pItemSSID = (PWLAN_IE_SSID)abyScanSSID; 137 pItemSSID = (PWLAN_IE_SSID)abyScanSSID;
138 pItemSSID->byElementID = WLAN_EID_SSID; 138 pItemSSID->byElementID = WLAN_EID_SSID;
@@ -150,12 +150,10 @@ int iwctl_siwscan(struct net_device *dev, struct iw_request_info *info,
150 spin_unlock_irq(&pDevice->lock); 150 spin_unlock_irq(&pDevice->lock);
151 151
152 return 0; 152 return 0;
153 } 153 } else if (req->scan_type == IW_SCAN_TYPE_PASSIVE) { // passive scan
154 else if (req->scan_type == IW_SCAN_TYPE_PASSIVE) { // passive scan
155 pMgmt->eScanType = WMAC_SCAN_PASSIVE; 154 pMgmt->eScanType = WMAC_SCAN_PASSIVE;
156 } 155 }
157 } 156 } else { // active scan
158 else { // active scan
159 pMgmt->eScanType = WMAC_SCAN_ACTIVE; 157 pMgmt->eScanType = WMAC_SCAN_ACTIVE;
160 } 158 }
161 159
@@ -216,12 +214,10 @@ int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info,
216 // ADD mode 214 // ADD mode
217 memset(&iwe, 0, sizeof(iwe)); 215 memset(&iwe, 0, sizeof(iwe));
218 iwe.cmd = SIOCGIWMODE; 216 iwe.cmd = SIOCGIWMODE;
219 if (WLAN_GET_CAP_INFO_ESS(pBSS->wCapInfo)) { 217 if (WLAN_GET_CAP_INFO_ESS(pBSS->wCapInfo))
220 iwe.u.mode = IW_MODE_INFRA; 218 iwe.u.mode = IW_MODE_INFRA;
221 } 219 else
222 else {
223 iwe.u.mode = IW_MODE_ADHOC; 220 iwe.u.mode = IW_MODE_ADHOC;
224 }
225 iwe.len = IW_EV_UINT_LEN; 221 iwe.len = IW_EV_UINT_LEN;
226 current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_UINT_LEN); 222 current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_UINT_LEN);
227 // ADD frequency 223 // ADD frequency
@@ -248,13 +244,12 @@ int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info,
248 iwe.u.qual.level = ldBm; 244 iwe.u.qual.level = ldBm;
249 iwe.u.qual.noise = 0; 245 iwe.u.qual.noise = 0;
250 246
251 if (-ldBm<50){ 247 if (-ldBm<50)
252 iwe.u.qual.qual = 100; 248 iwe.u.qual.qual = 100;
253 }else if (-ldBm > 90) { 249 else if (-ldBm > 90)
254 iwe.u.qual.qual = 0; 250 iwe.u.qual.qual = 0;
255 }else { 251 else
256 iwe.u.qual.qual = (40 - (-ldBm - 50)) * 100 / 40; 252 iwe.u.qual.qual = (40 - (-ldBm - 50)) * 100 / 40;
257 }
258 iwe.u.qual.updated = 7; 253 iwe.u.qual.updated = 7;
259 254
260 current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_QUAL_LEN); 255 current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_QUAL_LEN);
@@ -262,11 +257,10 @@ int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info,
262 memset(&iwe, 0, sizeof(iwe)); 257 memset(&iwe, 0, sizeof(iwe));
263 iwe.cmd = SIOCGIWENCODE; 258 iwe.cmd = SIOCGIWENCODE;
264 iwe.u.data.length = 0; 259 iwe.u.data.length = 0;
265 if (WLAN_GET_CAP_INFO_PRIVACY(pBSS->wCapInfo)) { 260 if (WLAN_GET_CAP_INFO_PRIVACY(pBSS->wCapInfo))
266 iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; 261 iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
267 }else { 262 else
268 iwe.u.data.flags = IW_ENCODE_DISABLED; 263 iwe.u.data.flags = IW_ENCODE_DISABLED;
269 }
270 current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, pItemSSID->abySSID); 264 current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, pItemSSID->abySSID);
271 265
272 memset(&iwe, 0, sizeof(iwe)); 266 memset(&iwe, 0, sizeof(iwe));
@@ -329,8 +323,7 @@ int iwctl_siwfreq(struct net_device *dev, struct iw_request_info *info,
329 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFREQ \n"); 323 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFREQ \n");
330 324
331 // If setting by frequency, convert to a channel 325 // If setting by frequency, convert to a channel
332 if ((wrq->e == 1) && 326 if ((wrq->e == 1) && (wrq->m >= (int)2.412e8) &&
333 (wrq->m >= (int)2.412e8) &&
334 (wrq->m <= (int)2.487e8)) { 327 (wrq->m <= (int)2.487e8)) {
335 int f = wrq->m / 100000; 328 int f = wrq->m / 100000;
336 int c = 0; 329 int c = 0;
@@ -340,9 +333,9 @@ int iwctl_siwfreq(struct net_device *dev, struct iw_request_info *info,
340 wrq->m = c + 1; 333 wrq->m = c + 1;
341 } 334 }
342 // Setting by channel number 335 // Setting by channel number
343 if ((wrq->m > 14) || (wrq->e > 0)) 336 if ((wrq->m > 14) || (wrq->e > 0)) {
344 rc = -EOPNOTSUPP; 337 rc = -EOPNOTSUPP;
345 else { 338 } else {
346 int channel = wrq->m; 339 int channel = wrq->m;
347 if ((channel < 1) || (channel > 14)) { 340 if ((channel < 1) || (channel > 14)) {
348 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: New channel value of %d is invalid!\n", dev->name, wrq->m); 341 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: New channel value of %d is invalid!\n", dev->name, wrq->m);
@@ -353,7 +346,6 @@ int iwctl_siwfreq(struct net_device *dev, struct iw_request_info *info,
353 pDevice->uChannel = channel; 346 pDevice->uChannel = channel;
354 } 347 }
355 } 348 }
356
357 return rc; 349 return rc;
358} 350}
359 351
@@ -404,9 +396,8 @@ int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info,
404 case IW_MODE_ADHOC: 396 case IW_MODE_ADHOC:
405 if (pMgmt->eConfigMode != WMAC_CONFIG_IBSS_STA) { 397 if (pMgmt->eConfigMode != WMAC_CONFIG_IBSS_STA) {
406 pMgmt->eConfigMode = WMAC_CONFIG_IBSS_STA; 398 pMgmt->eConfigMode = WMAC_CONFIG_IBSS_STA;
407 if (pDevice->flags & DEVICE_FLAGS_OPENED) { 399 if (pDevice->flags & DEVICE_FLAGS_OPENED)
408 pDevice->bCommit = TRUE; 400 pDevice->bCommit = TRUE;
409 }
410 } 401 }
411 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to ad-hoc \n"); 402 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to ad-hoc \n");
412 break; 403 break;
@@ -414,9 +405,8 @@ int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info,
414 case IW_MODE_INFRA: 405 case IW_MODE_INFRA:
415 if (pMgmt->eConfigMode != WMAC_CONFIG_ESS_STA) { 406 if (pMgmt->eConfigMode != WMAC_CONFIG_ESS_STA) {
416 pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA; 407 pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA;
417 if (pDevice->flags & DEVICE_FLAGS_OPENED) { 408 if (pDevice->flags & DEVICE_FLAGS_OPENED)
418 pDevice->bCommit = TRUE; 409 pDevice->bCommit = TRUE;
419 }
420 } 410 }
421 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to infrastructure \n"); 411 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to infrastructure \n");
422 break; 412 break;
@@ -428,9 +418,8 @@ int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info,
428 418
429 if (pMgmt->eConfigMode != WMAC_CONFIG_AP) { 419 if (pMgmt->eConfigMode != WMAC_CONFIG_AP) {
430 pMgmt->eConfigMode = WMAC_CONFIG_AP; 420 pMgmt->eConfigMode = WMAC_CONFIG_AP;
431 if (pDevice->flags & DEVICE_FLAGS_OPENED) { 421 if (pDevice->flags & DEVICE_FLAGS_OPENED)
432 pDevice->bCommit = TRUE; 422 pDevice->bCommit = TRUE;
433 }
434 } 423 }
435 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to Access Point \n"); 424 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to Access Point \n");
436 break; 425 break;
@@ -617,9 +606,8 @@ int iwctl_siwap(struct net_device *dev, struct iw_request_info *info,
617 } 606 }
618 } 607 }
619 608
620 if (pDevice->flags & DEVICE_FLAGS_OPENED) { 609 if (pDevice->flags & DEVICE_FLAGS_OPENED)
621 pDevice->bCommit = TRUE; 610 pDevice->bCommit = TRUE;
622 }
623 } 611 }
624 return rc; 612 return rc;
625} 613}
@@ -640,9 +628,8 @@ int iwctl_giwap(struct net_device *dev, struct iw_request_info *info,
640 if ((pDevice->bLinkPass == FALSE) && (pMgmt->eCurrMode != WMAC_MODE_ESS_AP)) 628 if ((pDevice->bLinkPass == FALSE) && (pMgmt->eCurrMode != WMAC_MODE_ESS_AP))
641 memset(wrq->sa_data, 0, 6); 629 memset(wrq->sa_data, 0, 6);
642 630
643 if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { 631 if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)
644 memcpy(wrq->sa_data, pMgmt->abyCurrBSSID, 6); 632 memcpy(wrq->sa_data, pMgmt->abyCurrBSSID, 6);
645 }
646 633
647 wrq->sa_family = ARPHRD_ETHER; 634 wrq->sa_family = ARPHRD_ETHER;
648 return 0; 635 return 0;
@@ -731,9 +718,9 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info,
731 if (pItemSSID->abySSID[wrq->length - 1] == '\0') { 718 if (pItemSSID->abySSID[wrq->length - 1] == '\0') {
732 if (wrq->length>0) 719 if (wrq->length>0)
733 pItemSSID->len = wrq->length - 1; 720 pItemSSID->len = wrq->length - 1;
734 } 721 } else {
735 else
736 pItemSSID->len = wrq->length; 722 pItemSSID->len = wrq->length;
723 }
737 PRINT_K("set essid to %s \n", pItemSSID->abySSID); 724 PRINT_K("set essid to %s \n", pItemSSID->abySSID);
738 725
739 // mike: need clear desiredBSSID 726 // mike: need clear desiredBSSID
@@ -767,8 +754,7 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info,
767 bScheduleCommand((void *)pDevice, 754 bScheduleCommand((void *)pDevice,
768 WLAN_CMD_SSID, 755 WLAN_CMD_SSID,
769 pMgmt->abyDesireSSID); 756 pMgmt->abyDesireSSID);
770 } 757 } else { // mike: to find out if that desired SSID is a
771 else { // mike: to find out if that desired SSID is a
772 // hidden-ssid AP, by means of judging if there 758 // hidden-ssid AP, by means of judging if there
773 // are two same BSSID exist in list ? 759 // are two same BSSID exist in list ?
774 for (ii = 0; ii < MAX_BSS_NUM; ii++) { 760 for (ii = 0; ii < MAX_BSS_NUM; ii++) {
@@ -797,9 +783,9 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info,
797 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set essid = %s \n", pItemSSID->abySSID); 783 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set essid = %s \n", pItemSSID->abySSID);
798 } 784 }
799 785
800 if (pDevice->flags & DEVICE_FLAGS_OPENED) { 786 if (pDevice->flags & DEVICE_FLAGS_OPENED)
801 pDevice->bCommit = TRUE; 787 pDevice->bCommit = TRUE;
802 } 788
803 return 0; 789 return 0;
804} 790}
805 791
@@ -892,8 +878,7 @@ int iwctl_siwrate(struct net_device *dev, struct iw_request_info *info,
892 pDevice->bFixRate = TRUE; 878 pDevice->bFixRate = TRUE;
893 if ((pDevice->byBBType == BB_TYPE_11B) && (brate > 3)) { 879 if ((pDevice->byBBType == BB_TYPE_11B) && (brate > 3)) {
894 pDevice->uConnectionRate = 3; 880 pDevice->uConnectionRate = 3;
895 } 881 } else {
896 else {
897 pDevice->uConnectionRate = brate; 882 pDevice->uConnectionRate = brate;
898 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fixed to Rate %d \n", pDevice->uConnectionRate); 883 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fixed to Rate %d \n", pDevice->uConnectionRate);
899 } 884 }
@@ -925,7 +910,7 @@ void iwctl_giwrate(struct net_device *dev, struct iw_request_info *info,
925 910
926 if (pDevice->uConnectionRate < 13) { 911 if (pDevice->uConnectionRate < 13) {
927 brate = abySupportedRates[pDevice->uConnectionRate]; 912 brate = abySupportedRates[pDevice->uConnectionRate];
928 }else { 913 } else {
929 if (pDevice->byBBType == BB_TYPE_11B) 914 if (pDevice->byBBType == BB_TYPE_11B)
930 brate = 0x16; 915 brate = 0x16;
931 if (pDevice->byBBType == BB_TYPE_11G) 916 if (pDevice->byBBType == BB_TYPE_11G)
@@ -933,7 +918,6 @@ void iwctl_giwrate(struct net_device *dev, struct iw_request_info *info,
933 if (pDevice->byBBType == BB_TYPE_11A) 918 if (pDevice->byBBType == BB_TYPE_11A)
934 brate = 0x6C; 919 brate = 0x6C;
935 } 920 }
936
937 if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { 921 if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
938 if (pDevice->byBBType == BB_TYPE_11B) 922 if (pDevice->byBBType == BB_TYPE_11B)
939 brate = 0x16; 923 brate = 0x16;
@@ -1001,7 +985,7 @@ int iwctl_siwfrag(struct net_device *dev, struct iw_request_info *info,
1001 fthr = 2312; 985 fthr = 2312;
1002 if ((fthr < 256) || (fthr > 2312)) { 986 if ((fthr < 256) || (fthr > 2312)) {
1003 rc = -EINVAL; 987 rc = -EINVAL;
1004 }else { 988 } else {
1005 fthr &= ~0x1; // Get an even value 989 fthr &= ~0x1; // Get an even value
1006 pDevice->wFragmentationThreshold = (u16)fthr; 990 pDevice->wFragmentationThreshold = (u16)fthr;
1007 } 991 }
@@ -1041,19 +1025,18 @@ int iwctl_siwretry(struct net_device *dev, struct iw_request_info *info,
1041 } 1025 }
1042 1026
1043 if (wrq->flags & IW_RETRY_LIMIT) { 1027 if (wrq->flags & IW_RETRY_LIMIT) {
1044 if (wrq->flags & IW_RETRY_MAX) 1028 if (wrq->flags & IW_RETRY_MAX) {
1045 pDevice->byLongRetryLimit = wrq->value; 1029 pDevice->byLongRetryLimit = wrq->value;
1046 else if (wrq->flags & IW_RETRY_MIN) 1030 } else if (wrq->flags & IW_RETRY_MIN) {
1047 pDevice->byShortRetryLimit = wrq->value; 1031 pDevice->byShortRetryLimit = wrq->value;
1048 else { 1032 } else {
1049 // No modifier : set both 1033 // No modifier : set both
1050 pDevice->byShortRetryLimit = wrq->value; 1034 pDevice->byShortRetryLimit = wrq->value;
1051 pDevice->byLongRetryLimit = wrq->value; 1035 pDevice->byLongRetryLimit = wrq->value;
1052 } 1036 }
1053 } 1037 }
1054 if (wrq->flags & IW_RETRY_LIFETIME) { 1038 if (wrq->flags & IW_RETRY_LIFETIME)
1055 pDevice->wMaxTransmitMSDULifetime = wrq->value; 1039 pDevice->wMaxTransmitMSDULifetime = wrq->value;
1056 }
1057 return rc; 1040 return rc;
1058} 1041}
1059 1042
@@ -1118,20 +1101,17 @@ int iwctl_siwencode(struct net_device *dev, struct iw_request_info *info,
1118 1101
1119 if (wrq->length == WLAN_WEP232_KEYLEN) { 1102 if (wrq->length == WLAN_WEP232_KEYLEN) {
1120 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 232 bit wep key\n"); 1103 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 232 bit wep key\n");
1121 } 1104 } else if (wrq->length == WLAN_WEP104_KEYLEN) {
1122 else if (wrq->length == WLAN_WEP104_KEYLEN) {
1123 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 104 bit wep key\n"); 1105 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 104 bit wep key\n");
1124 } 1106 } else if (wrq->length == WLAN_WEP40_KEYLEN) {
1125 else if (wrq->length == WLAN_WEP40_KEYLEN) {
1126 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 40 bit wep key, index= %d\n", (int)dwKeyIndex); 1107 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 40 bit wep key, index= %d\n", (int)dwKeyIndex);
1127 } 1108 }
1128 memset(pDevice->abyKey, 0, WLAN_WEP232_KEYLEN); 1109 memset(pDevice->abyKey, 0, WLAN_WEP232_KEYLEN);
1129 memcpy(pDevice->abyKey, extra, wrq->length); 1110 memcpy(pDevice->abyKey, extra, wrq->length);
1130 1111
1131 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"abyKey: "); 1112 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"abyKey: ");
1132 for (ii = 0; ii < wrq->length; ii++) { 1113 for (ii = 0; ii < wrq->length; ii++)
1133 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", pDevice->abyKey[ii]); 1114 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", pDevice->abyKey[ii]);
1134 }
1135 1115
1136 if (pDevice->flags & DEVICE_FLAGS_OPENED) { 1116 if (pDevice->flags & DEVICE_FLAGS_OPENED) {
1137 spin_lock_irq(&pDevice->lock); 1117 spin_lock_irq(&pDevice->lock);
@@ -1151,7 +1131,7 @@ int iwctl_siwencode(struct net_device *dev, struct iw_request_info *info,
1151 pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; 1131 pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
1152 1132
1153 // Do we want to just set the transmit key index? 1133 // Do we want to just set the transmit key index?
1154 if ( index < 4 ) { 1134 if (index < 4) {
1155 pDevice->byKeyIndex = index; 1135 pDevice->byKeyIndex = index;
1156 } else if (!(wrq->flags & IW_ENCODE_MODE)) { 1136 } else if (!(wrq->flags & IW_ENCODE_MODE)) {
1157 rc = -EINVAL; 1137 rc = -EINVAL;
@@ -1159,8 +1139,7 @@ int iwctl_siwencode(struct net_device *dev, struct iw_request_info *info,
1159 } 1139 }
1160 } 1140 }
1161 // Read the flags 1141 // Read the flags
1162 if (wrq->flags & IW_ENCODE_DISABLED){ 1142 if (wrq->flags & IW_ENCODE_DISABLED) {
1163
1164 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable WEP function\n"); 1143 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable WEP function\n");
1165 pMgmt->bShareKeyAlgorithm = FALSE; 1144 pMgmt->bShareKeyAlgorithm = FALSE;
1166 pDevice->bEncryptionEnable = FALSE; 1145 pDevice->bEncryptionEnable = FALSE;
@@ -1199,16 +1178,16 @@ int iwctl_giwencode(struct net_device *dev, struct iw_request_info *info,
1199 1178
1200 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWENCODE\n"); 1179 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWENCODE\n");
1201 1180
1202 if (index > WLAN_WEP_NKEYS) { 1181 if (index > WLAN_WEP_NKEYS)
1203 return -EINVAL; 1182 return -EINVAL;
1204 }
1205 if (index < 1) { // get default key 1183 if (index < 1) { // get default key
1206 if (pDevice->byKeyIndex < WLAN_WEP_NKEYS){ 1184 if (pDevice->byKeyIndex < WLAN_WEP_NKEYS)
1207 index = pDevice->byKeyIndex; 1185 index = pDevice->byKeyIndex;
1208 } else 1186 else
1209 index = 0; 1187 index = 0;
1210 }else 1188 } else {
1211 index--; 1189 index--;
1190 }
1212 1191
1213 memset(abyKey, 0, WLAN_WEP232_KEYLEN); 1192 memset(abyKey, 0, WLAN_WEP232_KEYLEN);
1214 // Check encryption mode 1193 // Check encryption mode
@@ -1232,7 +1211,7 @@ int iwctl_giwencode(struct net_device *dev, struct iw_request_info *info,
1232 memcpy(abyKey, pKey->abyKey, pKey->uKeyLength); 1211 memcpy(abyKey, pKey->abyKey, pKey->uKeyLength);
1233 memcpy(extra, abyKey, WLAN_WEP232_KEYLEN); 1212 memcpy(extra, abyKey, WLAN_WEP232_KEYLEN);
1234 } 1213 }
1235 } else if (KeybGetKey(&(pDevice->sKey), pDevice->abyBroadcastAddr, (BYTE)index, &pKey)){ 1214 } else if (KeybGetKey(&(pDevice->sKey), pDevice->abyBroadcastAddr, (BYTE)index, &pKey)) {
1236 wrq->length = pKey->uKeyLength; 1215 wrq->length = pKey->uKeyLength;
1237 memcpy(abyKey, pKey->abyKey, pKey->uKeyLength); 1216 memcpy(abyKey, pKey->abyKey, pKey->uKeyLength);
1238 memcpy(extra, abyKey, WLAN_WEP232_KEYLEN); 1217 memcpy(extra, abyKey, WLAN_WEP232_KEYLEN);
@@ -1329,8 +1308,7 @@ int iwctl_giwsens(struct net_device *dev, struct iw_request_info *info,
1329 if (pDevice->bLinkPass == TRUE) { 1308 if (pDevice->bLinkPass == TRUE) {
1330 RFvRSSITodBm(pDevice, (BYTE)(pDevice->uCurrRSSI), &ldBm); 1309 RFvRSSITodBm(pDevice, (BYTE)(pDevice->uCurrRSSI), &ldBm);
1331 wrq->value = ldBm; 1310 wrq->value = ldBm;
1332 } 1311 } else {
1333 else {
1334 wrq->value = 0; 1312 wrq->value = 0;
1335 } 1313 }
1336 wrq->disabled = (wrq->value == 0); 1314 wrq->disabled = (wrq->value == 0);
@@ -1355,11 +1333,9 @@ int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info,
1355 wpa_version = wrq->value; 1333 wpa_version = wrq->value;
1356 if (wrq->value == IW_AUTH_WPA_VERSION_DISABLED) { 1334 if (wrq->value == IW_AUTH_WPA_VERSION_DISABLED) {
1357 PRINT_K("iwctl_siwauth:set WPADEV to disable at 1??????\n"); 1335 PRINT_K("iwctl_siwauth:set WPADEV to disable at 1??????\n");
1358 } 1336 } else if (wrq->value == IW_AUTH_WPA_VERSION_WPA) {
1359 else if (wrq->value == IW_AUTH_WPA_VERSION_WPA) {
1360 PRINT_K("iwctl_siwauth:set WPADEV to WPA1******\n"); 1337 PRINT_K("iwctl_siwauth:set WPADEV to WPA1******\n");
1361 } 1338 } else {
1362 else {
1363 PRINT_K("iwctl_siwauth:set WPADEV to WPA2******\n"); 1339 PRINT_K("iwctl_siwauth:set WPADEV to WPA2******\n");
1364 } 1340 }
1365 break; 1341 break;
@@ -1368,22 +1344,23 @@ int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info,
1368 PRINT_K("iwctl_siwauth:set pairwise=%d\n", pairwise); 1344 PRINT_K("iwctl_siwauth:set pairwise=%d\n", pairwise);
1369 if (pairwise == IW_AUTH_CIPHER_CCMP){ 1345 if (pairwise == IW_AUTH_CIPHER_CCMP){
1370 pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled; 1346 pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled;
1371 }else if (pairwise == IW_AUTH_CIPHER_TKIP){ 1347 } else if (pairwise == IW_AUTH_CIPHER_TKIP) {
1372 pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled; 1348 pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled;
1373 } else if (pairwise == IW_AUTH_CIPHER_WEP40 || 1349 } else if (pairwise == IW_AUTH_CIPHER_WEP40 ||
1374 pairwise == IW_AUTH_CIPHER_WEP104) { 1350 pairwise == IW_AUTH_CIPHER_WEP104) {
1375 pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; 1351 pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
1376 }else if (pairwise == IW_AUTH_CIPHER_NONE){ 1352 } else if (pairwise == IW_AUTH_CIPHER_NONE) {
1377 // do nothing, einsn liu 1353 // do nothing, einsn liu
1378 } else pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; 1354 } else {
1379 1355 pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
1356 }
1380 break; 1357 break;
1381 case IW_AUTH_CIPHER_GROUP: 1358 case IW_AUTH_CIPHER_GROUP:
1382 PRINT_K("iwctl_siwauth:set GROUP=%d\n", wrq->value); 1359 PRINT_K("iwctl_siwauth:set GROUP=%d\n", wrq->value);
1383 if (wpa_version == IW_AUTH_WPA_VERSION_DISABLED) 1360 if (wpa_version == IW_AUTH_WPA_VERSION_DISABLED)
1384 break; 1361 break;
1385 if (pairwise == IW_AUTH_CIPHER_NONE){ 1362 if (pairwise == IW_AUTH_CIPHER_NONE) {
1386 if (wrq->value == IW_AUTH_CIPHER_CCMP){ 1363 if (wrq->value == IW_AUTH_CIPHER_CCMP) {
1387 pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled; 1364 pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled;
1388 }else { 1365 }else {
1389 pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled; 1366 pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled;
@@ -1399,9 +1376,10 @@ int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info,
1399 } else if (wpa_version == IW_AUTH_WPA_VERSION_WPA) { 1376 } else if (wpa_version == IW_AUTH_WPA_VERSION_WPA) {
1400 if (wrq->value == 0){ 1377 if (wrq->value == 0){
1401 pMgmt->eAuthenMode = WMAC_AUTH_WPANONE; 1378 pMgmt->eAuthenMode = WMAC_AUTH_WPANONE;
1402 }else if (wrq->value == IW_AUTH_KEY_MGMT_PSK) 1379 } else if (wrq->value == IW_AUTH_KEY_MGMT_PSK)
1403 pMgmt->eAuthenMode = WMAC_AUTH_WPAPSK; 1380 pMgmt->eAuthenMode = WMAC_AUTH_WPAPSK;
1404 else pMgmt->eAuthenMode = WMAC_AUTH_WPA; 1381 } else {
1382 pMgmt->eAuthenMode = WMAC_AUTH_WPA;
1405 } 1383 }
1406 break; 1384 break;
1407 case IW_AUTH_TKIP_COUNTERMEASURES: 1385 case IW_AUTH_TKIP_COUNTERMEASURES:
@@ -1410,11 +1388,10 @@ int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info,
1410 break; 1388 break;
1411 case IW_AUTH_80211_AUTH_ALG: 1389 case IW_AUTH_80211_AUTH_ALG:
1412 PRINT_K("iwctl_siwauth:set AUTH_ALG=%d\n", wrq->value); 1390 PRINT_K("iwctl_siwauth:set AUTH_ALG=%d\n", wrq->value);
1413 if (wrq->value==IW_AUTH_ALG_OPEN_SYSTEM){ 1391 if (wrq->value == IW_AUTH_ALG_OPEN_SYSTEM)
1414 pMgmt->bShareKeyAlgorithm = FALSE; 1392 pMgmt->bShareKeyAlgorithm = FALSE;
1415 } else if (wrq->value==IW_AUTH_ALG_SHARED_KEY) { 1393 else if (wrq->value == IW_AUTH_ALG_SHARED_KEY)
1416 pMgmt->bShareKeyAlgorithm=TRUE; 1394 pMgmt->bShareKeyAlgorithm = TRUE;
1417 }
1418 break; 1395 break;
1419 case IW_AUTH_WPA_ENABLED: 1396 case IW_AUTH_WPA_ENABLED:
1420 break; 1397 break;
@@ -1425,7 +1402,7 @@ int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info,
1425 break; 1402 break;
1426 case IW_AUTH_PRIVACY_INVOKED: 1403 case IW_AUTH_PRIVACY_INVOKED:
1427 pDevice->bEncryptionEnable = !!wrq->value; 1404 pDevice->bEncryptionEnable = !!wrq->value;
1428 if (pDevice->bEncryptionEnable == FALSE){ 1405 if (pDevice->bEncryptionEnable == FALSE) {
1429 wpa_version = 0; 1406 wpa_version = 0;
1430 pairwise = 0; 1407 pairwise = 0;
1431 pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; 1408 pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
@@ -1487,7 +1464,7 @@ int iwctl_giwgenie(struct net_device *dev, struct iw_request_info *info,
1487 int space = wrq->length; 1464 int space = wrq->length;
1488 1465
1489 wrq->length = 0; 1466 wrq->length = 0;
1490 if (pMgmt->wWPAIELen > 0){ 1467 if (pMgmt->wWPAIELen > 0) {
1491 wrq->length = pMgmt->wWPAIELen; 1468 wrq->length = pMgmt->wWPAIELen;
1492 if (pMgmt->wWPAIELen <= space) { 1469 if (pMgmt->wWPAIELen <= space) {
1493 if (copy_to_user(extra, pMgmt->abyWPAIE, pMgmt->wWPAIELen)) { 1470 if (copy_to_user(extra, pMgmt->abyWPAIE, pMgmt->wWPAIELen)) {
@@ -1638,14 +1615,14 @@ int iwctl_siwmlme(struct net_device *dev, struct iw_request_info *info,
1638 struct iw_mlme *mlme = (struct iw_mlme *)extra; 1615 struct iw_mlme *mlme = (struct iw_mlme *)extra;
1639 int ret = 0; 1616 int ret = 0;
1640 1617
1641 if (memcmp(pMgmt->abyCurrBSSID, mlme->addr.sa_data, ETH_ALEN)){ 1618 if (memcmp(pMgmt->abyCurrBSSID, mlme->addr.sa_data, ETH_ALEN)) {
1642 ret = -EINVAL; 1619 ret = -EINVAL;
1643 return ret; 1620 return ret;
1644 } 1621 }
1645 switch (mlme->cmd){ 1622 switch (mlme->cmd){
1646 case IW_MLME_DEAUTH: 1623 case IW_MLME_DEAUTH:
1647 case IW_MLME_DISASSOC: 1624 case IW_MLME_DISASSOC:
1648 if (pDevice->bLinkPass == TRUE){ 1625 if (pDevice->bLinkPass == TRUE) {
1649 PRINT_K("iwctl_siwmlme--->send DISASSOCIATE\n"); 1626 PRINT_K("iwctl_siwmlme--->send DISASSOCIATE\n");
1650 bScheduleCommand((void *)pDevice, 1627 bScheduleCommand((void *)pDevice,
1651 WLAN_CMD_DISASSOCIATE, 1628 WLAN_CMD_DISASSOCIATE,