Ralink Technology, Corp.: Rt2070 Linux Station Release Notes and User'S Guide
Ralink Technology, Corp.: Rt2070 Linux Station Release Notes and User'S Guide
NOTE: THIS DOCUMENT CONTAINS SENSITIVE INFORMATION AND HAS RESTRICTED DISTRIBUTION.
The confidential Information, technology or any Intellectual Property embodied therein, including without
limitation, specifications, product features, data, source code, object code, computer programs, drawings,
schematics, know-how, notes, models, reports, contracts, schedules and samples, constitute the Proprietary
Information of Ralink (hereinafter "Proprietary Information")
All the Proprietary Information is provided "AS IS". No Warranty of any kind, whether express or implied, is
given hereunder with regards to any Proprietary Information or the use, performance or function thereof.
Ralink hereby disclaims any warranties, including but not limited warranties of non-infringement,
merchantability, completeness, accuracy, fitness for any particular purpose, functionality and any warranty
related to course of performance or dealing of Proprietary Information. In no event shall Ralink be liable for
any special, indirect or consequential damages associated with or arising from use of the Proprietary
Information in any way, including any loss of use, data or profits.
Ralink retains all right, title or interest in any Proprietary Information or any Intellectual Property embodied
therein. The Proprietary Information shall not in whole or in part be reversed, decompiled or disassembled,
nor reproduced or sublicensed or disclosed to any third party without Ralink's prior written consent.
Ralink reserves the right, at its own discretion, to update or revise the Proprietary Information from time to
time, of which Ralink is not obligated to inform or send notice. Please check back if you have any question.
Information or items marked as "not yet supported" shall not be relied on, nor taken as any warranty
or permission of use.
http://www.ralinktech.com/
2/94
RT2870 Linux Station Release Notes and User’s Guide
Contents
1 VERSION HISTORY........................................................5 4.1.16 ENCRYPTYPE: ......................................................21
4.1.17 DEFAULTKEYID: ..................................................21
2 README ......................................................................5
4.1.18 KEY1 .................................................................21
3 CONFIGURATION .........................................................8 4.1.19 KEY2 .................................................................21
4.1.20 KEY3 .................................................................21
3.1 CONFIGURATION FILE : RT2870STA.DAT ....................... 8
4.1.21 KEY4 .................................................................22
3.2 USAGE ..................................................................... 9
4.1.22 WPAPSK...........................................................22
3.2.1 COUNTRYREGION .................................................. 9
4.1.23 WMMCAPABLE ...................................................22
3.2.2 COUNTRYREGIONFORABAND ................................ 10
4.1.24 IEEE80211H .....................................................22
3.2.3 SSID................................................................. 10
4.1.25 PSMODE ...........................................................23
3.2.4 WIRELESSMODE ................................................. 10
4.1.26 RESETCOUNTER ...................................................23
3.2.5 CHANNEL ........................................................... 11
4.1.27 DEBUG...............................................................23
3.2.6 BGPROTECTION .................................................. 11
4.1.28 FIXEDTXMODE ....................................................23
3.2.7 TXPREAMBLE ...................................................... 11
4.1.29 LONGRETRY ........................................................24
3.2.8 RTSTHRESHOLD .................................................. 11
4.1.30 SHORTRETRY.......................................................24
3.2.9 FRAGTHRESHOLD ................................................ 11
4.2 IWPRIV RA0 SHOW USAGE ..........................................25
3.2.10 TXBURST ........................................................... 11
4.2.1 CONNSTATUS ......................................................25
3.2.11 PKTAGGREGATE .................................................. 11
4.2.2 DRIVERVER .........................................................25
3.2.12 NETWORKTYPE ................................................... 12
4.2.3 BAINFO ..............................................................25
3.2.13 AUTHMODE ....................................................... 12
4.2.4 RXBULK ..............................................................25
3.2.14 ENCRYPTYPE ...................................................... 12
4.2.5 TXBULK ..............................................................25
3.2.15 DEFAULTKEYID ................................................... 12
4.3 IWPRIV RA0 USAGE ...................................................25
3.2.16 WEP KEYTYPE .................................................... 12
4.3.1 RADIO_OFF .........................................................25
3.2.17 WEP HEX KEY .................................................... 13
4.3.2 RADIO_ON ..........................................................26
3.2.18 WEP KEY STRING ................................................ 13
4.4 IWPRIV EXAMPLES.....................................................26
3.2.19 WPAPSK .......................................................... 13
4.4.1 INFRASTRUCTURE .................................................26
3.2.20 WMMCAPABLE ................................................... 13
4.4.1.1 OPEN/NONE ....................................................26
3.2.21 IEEE80211H..................................................... 14
4.4.1.2 SHARED/WEP ..................................................26
3.2.22 PSMODE ........................................................... 14
4.4.1.3 WPAPSK/TKIP ..................................................26
3.2.23 FASTROAMING ................................................... 14
4.4.1.4 WPAPSK/AES ...................................................26
3.2.24 ROAMTHRESHOLD ............................................... 14
4.4.1.5 WPA2PSK/TKIP ................................................27
3.2.25 CARRIERDETECT .................................................. 14
4.4.2 AD-HOC.............................................................27
3.2.26 APSDCAPABLE ................................................... 14
4.4.2.1 OPEN/NONE ....................................................27
3.2.27 APSDAC........................................................... 15
4.4.2.2 WPANONE/TKIP ..............................................27
3.2.28 WIRELESSEVENT ................................................. 15
4.4.3 GET SITE SURVEY ..................................................28
3.2.29 CARRIERDETECT .................................................. 15
4.4.4 GET STATISTICS ...................................................28
3.2.30 ANTDIVERSITY .................................................... 15
4.4.5 ANY SSID..........................................................28
3.3 MORE INFORMATION .......................................... 15
4.5 IWLIST ....................................................................28
4 WIRELESS TOOLS........................................................ 17 4.6 IWCONFIG ...............................................................28
4.1 IWPRIV RA0 SET USAGE ............................................. 17 5 WPS – WI-FI PROTECTED SETUP..................................30
4.1.1 DRIVERVERSION .................................................. 17
5.1 IWPRIV USAGE .........................................................30
4.1.2 COUNTRYREGION ................................................ 17
5.1.1 WSC_CONF_MODE ...............................................30
4.1.3 COUNTRYREGIONABAND ...................................... 18
5.1.2 WSC_MODE ........................................................31
4.1.4 SSID................................................................. 18
5.1.3 WSC_PIN ............................................................31
4.1.5 WIRELESSMODE ................................................. 18
5.1.4 WSC_ SSID ..........................................................31
4.1.6 TXBURST: .......................................................... 19
5.1.5 WSC_START ........................................................31
4.1.7 PKTAGGREGATE: ................................................. 19
5.1.6 WSC_ STOP .........................................................31
4.1.8 TXPREAMBLE:..................................................... 19
5.1.7 WSC_GEN_PINCODE .............................................32
4.1.9 TXPOWER:......................................................... 19
5.1.8 WSC_CRED_COUNT ..............................................32
4.1.10 CHANNEL ........................................................... 20
5.1.9 WSC_CRED_SSID ..................................................32
4.1.11 BGPROTECTION:................................................. 20
5.1.10 WSC_CRED_AUTH ................................................32
4.1.12 RTSTHRESHOLD:................................................. 20
5.1.11 WSC_CRED_ENCR ................................................33
4.1.13 FRAGTHRESHOLD: ............................................... 20
5.1.12 WSC_CRED_KEYIDX ..............................................33
4.1.14 NETWORKTYPE: .................................................. 20
5.1.13 WSC_CRED_KEY ...................................................33
4.1.15 AUTHMODE:...................................................... 21
3/94
RT2870 Linux Station Release Notes and User’s Guide
4/94
RT2870 Linux Station Release Notes and User’s Guide
1 VERSION HISTORY
Version 2.1.0.0
5. Support kthread.
Version 2.0.1.0
2. Fix one bug for ATE TX power handling and ATE frequency offset bug.
Version 2.0.0.0
2 README
Model Name
Supporting Kernel
Driver Name
5/94
RT2870 Linux Station Release Notes and User’s Guide
Description
This is a Linux device driver for Ralink RT2070 ABGN WLAN Card.
Features
6/94
RT2870 Linux Station Release Notes and User’s Guide
Build Instructions
go to "./yyyy_mmdd_RT2070_Linux_STA_x.x.x.x" directory.
2. In Makefile
a. set the "MODE = STA" in Makefile
b. choose the TARGET to Linux by set "TARGET = LINUX"
c. define the Linux kernel source include file path LINUX_SRC modify to meet your need.
3. In os/linux/config.mk
$make
5. $cp RT2870STA.dat /etc/Wireless/RT2870STA/RT2870STA.dat
#[kernel 2.4]
# $/sbin/insmod rt2070sta.o
#[kernel 2.6]
# $/sbin/insmod rt2070sta.ko
$/sbin/rmmod rt2070sta
7/94
RT2870 Linux Station Release Notes and User’s Guide
3 CONFIGURATION
• configuration file
• "iwconfig" command
• "iwpriv" command
Note:
This file is a binary file and will be read on loading rt.o module. Use "vi -b RT2870STA.dat" to modify settings
according to your need. Set the NetworkType to "Adhoc" for using Adhoc-mode, or Infrastructure. Set Channel
to "0" for auto-select on Infrastructure mode. set SSID for connecting to your Accss-point.
AuthMode
• WEPAUTO
• OPEN
• SHARED
• WPAPSK
• WPA2PSK
• WPANONE
EncrypType
• NONE
• WEP
• TKIP
• AES
Default
NetworkType=Infra TxPower=100
CountryRegion=5
WirelessMode=9 BGProtection=0
CountryRegionABand=
7 Channel=0 TxPreamble=0
8/94
RT2870 Linux Station Release Notes and User’s Guide
Key1Type=0 FastRoaming=0
NOTE:
WMM parameters
• AckPolicy1~4 Ack policy which supports normal Ack or no Ack (AC_BK, AC_BE, AC_VI, AC_VO)
All WMM parameters do not support iwpriv command but ‘WmmCapable’’, please store all parameter to
RT2870STA.dat, and restart driver.
3.2 Usage
SectionNumber Param
Value
...
...
...
3.2.1 CountryRegion
value
Region Channels
0 1-11
1 1-13
2 10-11
3 10-13
4 14
9/94
RT2870 Linux Station Release Notes and User’s Guide
5 1-14
6 3-9
7 5-13
3.2.2 CountryRegionForABand
value
Region Channels
0 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165
1 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140
7 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165
9 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165
11 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 149, 153, 157, 161
3.2.3 SSID
value
3.2.4 WirelessMode
value
// and RfIcType=2(id=RFIC_5325)
// and RfIcType=2(id=RFIC_5325)
10/94
RT2870 Linux Station Release Notes and User’s Guide
3.2.5 Channel
value
3.2.6 BGProtection
value
0: Auto
1: Always on
2: Always off
3.2.7 TxPreamble
value
0:Preamble Long
1:Preamble Short
2:Auto
3.2.8 RTSThreshold
value
1~2347
3.2.9 FragThreshold
value
256~2346
3.2.10 TxBurst
value
0: Disable
1: Enable
3.2.11 PktAggregate
value
0: Disable
1: Enable
11/94
RT2870 Linux Station Release Notes and User’s Guide
3.2.12 NetworkType
value
3.2.13 AuthMode
value
WPA
WPA2
3.2.14 EncrypType
value
3.2.15 DefaultKeyID
value
1~4
Key1Type=vaule
Key2Type=value
Key3Type=vaule
Key4Type=vaule
12/94
RT2870 Linux Station Release Notes and User’s Guide
value
0 hexadecimal type
1 assic type
Key1=value
Key2=value
Key3=value
Key4=value
value
Key1Str=value
Key2Str=value
Key3Str=vaule
Key4Str=vaule
value
3.2.19 WPAPSK
value
8~63 ASCII or
64 HEX characters
3.2.20 WmmCapable
value
13/94
RT2870 Linux Station Release Notes and User’s Guide
0: Disable WMM
1: Enable WMM
3.2.21 IEEE80211H
Value:
0:Disable
1:Enable
3.2.22 PSMode
value
3.2.23 FastRoaming
value
0: Disabled
1: Enabled
3.2.24 RoamThreshold
value
0 ~ 255
3.2.25 CarrierDetect
value
0: Disabled
1: Enabled
3.2.26 APSDCapable
value
0: Disabled
1: Enabled
14/94
RT2870 Linux Station Release Notes and User’s Guide
3.2.27 APSDAC
Value
0: Disabled
1: Enabled
3.2.28 WirelessEvent
value
0: Disabled
3.2.29 CarrierDetect
value
0: Disabled
1: Enabled
3.2.30 AntDiversity
value
0: Disabled
1: Enabled
A) choose ra0 for first RT2070 WLAN card, ra1 for second RT2070 WLAN card, etc.
DEVICE='ra0'
ONBOOT='yes'
NOTE:
15/94
RT2870 Linux Station Release Notes and User’s Guide
BOOTPROTO='dhcp'
GATEWAY=x.x.x.x
in /etc/sysconfig/network
16/94
RT2870 Linux Station Release Notes and User’s Guide
4 WIRELESS TOOLS
Before reading this document, make sure you already read README.
NOTE:
4.1.1 DriverVersion
Range:
Any value
Value:
4.1.2 CountryRegion
Range:
{0~7}
Value:
Region Channels
0 1-11
1 1-13
2 10-11
3 10-13
4 14
5 1-14
6 3-9
7 5-13
17/94
RT2870 Linux Station Release Notes and User’s Guide
4.1.3 CountryRegionABand
Range:
{0~11}
Value:
Region Channels
0 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165
1 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140
7 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165
9 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165
11 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 149, 153, 157, 161
4.1.4 SSID
Set AP SSID
Range:
Value:
4.1.5 WirelessMode
Range:
{0~10}
Value:
18/94
RT2870 Linux Station Release Notes and User’s Guide
4.1.6 TxBurst:
Range:
{0,1}
Value:
0:Disable,
1:Enable
4.1.7 PktAggregate:
Range:
{0,1}
Value:
0:Disable,
1:Enable
4.1.8 TxPreamble:
Set TxPreamble
Range:
{0~2}
Value:
0:Preamble Long,
1:Preamble Short,
2:Auto
4.1.9 TxPower:
19/94
RT2870 Linux Station Release Notes and User’s Guide
Range:
{0~100}
Value:
4.1.10 Channel
4.1.11 BGProtection:
Range:
{0~2}
Value:
0:Auto,
1:Always on,
2:Always off
4.1.12 RTSThreshold:
Range:
{1~2347}
Value:
4.1.13 FragThreshold:
Range:
{256~2346}
Value:
4.1.14 NetworkType:
Range:
{Infra,Adhoc}
Value:
20/94
RT2870 Linux Station Release Notes and User’s Guide
4.1.15 AuthMode:
Range:
{OPEN,SHARED,WEPAUTO,WPAPSK,WPA2PSK,WPANONE}
Value:
4.1.16 EncrypType:
Range:
{NONE,WEP,TKIP,AES}
Value:
4.1.17 DefaultKeyID:
Range:
{1~4}
Value:
4.1.18 Key1
Range:
Value:
4.1.19 Key2
Range:
Value:
4.1.20 Key3
21/94
RT2870 Linux Station Release Notes and User’s Guide
Range:
Value:
4.1.21 Key4
Range:
Value:
4.1.22 WPAPSK
Range:
Value:
4.1.23 WmmCapable
Range:
{0,1}
Value:
0:Disable WMM,
1:Enable WMM
4.1.24 IEEE80211H
Range:
{0,1}
Value:
22/94
RT2870 Linux Station Release Notes and User’s Guide
0:Disable
1:Enable
4.1.25 PSMode
Range:
Value:
4.1.26 ResetCounter
Range:
Any vlaue
Value:
4.1.27 Debug
Range:
{0 ~ 5}
Value:
4.1.28 FixedTxMode
value
Mode = CCK
23/94
RT2870 Linux Station Release Notes and User’s Guide
Mode = OFDM
4.1.29 LongRetry
USAGE:
value :
0~255
4.1.30 ShortRetry
USAGE:
value :
0~255
24/94
RT2870 Linux Station Release Notes and User’s Guide
Before reading this document, make sure you already read README.
4.2.1 connStatus
4.2.2 driverVer
4.2.3 bainfo
4.2.4 rxbulk
4.2.5 txbulk
Before reading this document, make sure you already read README.
4.3.1 radio_off
25/94
RT2870 Linux Station Release Notes and User’s Guide
4.3.2 radio_on
4.4.1 Infrastructure
4.4.1.1 OPEN/NONE
4.4.1.2 SHARED/WEP
4.4.1.3 WPAPSK/TKIP
4.4.1.4 WPAPSK/AES
26/94
RT2870 Linux Station Release Notes and User’s Guide
4.4.1.5 WPA2PSK/TKIP
4.4.2 Ad-Hoc
4.4.2.1 OPEN/NONE
4.4.2.2 WPANONE/TKIP
27/94
RT2870 Linux Station Release Notes and User’s Guide
usage:
usage:
Link with an AP which is the largest strength, set ANY SSID (ssidLen=0)
usage:
or
4.5 iwlist
4.6 iwconfig
28/94
RT2870 Linux Station Release Notes and User’s Guide
11) iwconfig ra0 power {period N|timeout N} ; set power management modes
NOTE:
Wireless extension usage, please refer to man page of 'iwconfig', 'iwlist' and 'iwpriv'.
29/94
RT2870 Linux Station Release Notes and User’s Guide
This section presents a high-level description of the Simple Config architecture. Much of the material
is taken directly from the Simple Config specification.
Figure 1 depicts the major components and their interfaces as defined by Wi-Fi Simple Config Spec.
There are three logical components involved: the Registrar, the access point (AP), and the Enrollee.
The Enrollee is a device seeking to join a WLAN domain. Once an Enrollee obtains a
valid credential, it becomes a member.
A Registrar is an entity with the authority to issue and revoke domain credentials. A
registrar can be integrated into an AP.
Registration initiation is ordinarily accomplished by a user action such as powering up the Enrollee
and, optionally, running a setup wizard on the Registrar (PC).
Before reading this document, make sure you already read README.
NOTE:
5.1.1 wsc_conf_mode
Range:
{0, 1, 2}
30/94
RT2870 Linux Station Release Notes and User’s Guide
Value:
0: WPS Disabled
1: Enrollee
2: Registrar
5.1.2 wsc_mode
Range:
{1, 2}
Value:
1: PIN
2: PBC
5.1.3 wsc_pin
Range:
{00000000 ~ 99999999}
Value:
Range:
Value:
5.1.5 wsc_start
Range:
NULL
Value:
31/94
RT2870 Linux Station Release Notes and User’s Guide
Range:
NULL
Value:
5.1.7 wsc_gen_pincode
Range:
NULL
Value:
5.1.8 wsc_cred_count
Set count of WPS credential, only support one credential for M8 in Registrar mode.
Range:
{1 ~ 8}
Value:
5.1.9 wsc_cred_ssid
Range:
{"idx ssid_str"}
Value:
idx: 0 ~ 7
Example:
5.1.10 wsc_cred_auth
Range:
{"idx auth_str"}
Value:
idx: 0 ~ 7
32/94
RT2870 Linux Station Release Notes and User’s Guide
Example:
5.1.11 wsc_cred_encr
Range:
{"idx encr_str"}
Value:
idx: 0 ~ 7
Example:
5.1.12 wsc_cred_keyIdx
Range:
{"idx key_index"}
Value:
idx: 0 ~ 7
key_index: 1 ~ 4
Example:
5.1.13 wsc_cred_key
Range:
{"idx key"}
Value:
idx: 0 ~ 7
OR
33/94
RT2870 Linux Station Release Notes and User’s Guide
Example:
5.1.14 wsc_cred_mac
Range:
{"idx mac_str"}
Value:
idx: 0 ~ 7
mac_str: xx:xx:xx:xx:xx:xx
Example:
5.1.15 wsc_conn_by_idx
Range:
{0 ~ 7}
Value:
idx: 0 ~ 7
5.1.16 wsc_auto_conn
Range:
{0, 1}
Value:
34/94
RT2870 Linux Station Release Notes and User’s Guide
[AP+Registrar]<----EAP--->[Enrollee Client]
Note:
Enter the Enrollee PinCode on the Registrar and start WPS on the Registrar.
Note:
How to get the Enrollee PinCode? Use 'iwpriv ra0 stat' on the Enrollee.
(ii) [RT2070 Linux WPS STA]
(iii) If the registration is successful, the Enrollee will be re-configured with the new parameters,
and will connect to the AP with these new parameters.
[AP+Registrar]<----EAP--->[Client]
35/94
RT2870 Linux Station Release Notes and User’s Guide
(i) [AP+Registrar]
[Unconfigured AP]<----EAP--->[Registrar]
Configured AP]<----EAP--->[Registrar]
(i) [AP]
in case 'a':
The Registrar will be re-configured with the new parameters, and will connect to the AP
with these new parameters;
in case 'b':
The Registrar will be re-configured with AP's configurations, and will connect to the AP
with these new parameters.
36/94
RT2870 Linux Station Release Notes and User’s Guide
[Unconfigured AP]<----EAP--->[Registrar]
Configured AP]<----EAP--->[Registrar]
(i) [AP]
in case 'a':
The Registrar will be re-configured with the new parameters, and will connect to the AP
with these new parameters;
in case 'b':
The Registrar will be re-configured with AP's configurations, and will connect to the AP
with these new parameters.
37/94
RT2870 Linux Station Release Notes and User’s Guide
Detail parameters and arguments, please refer to above section for detail.
Example:
memset(&lwreq, 0, sizeof(lwreq));
lwreq.u.mode = WSC_STOP;
return -1;
Example:
memset(&lwreq, 0, sizeof(lwreq));
lwreq.u.data.length = 1;
38/94
RT2870 Linux Station Release Notes and User’s Guide
cred_count = 1;
offset = sizeof(int);
lwreq.u.mode = WSC_CREDENTIAL_COUNT;
return -1;
Example:
memset(&lwreq, 0, sizeof(lwreq));
memset(buffer, 0, 2048);
lwreq.u.data.length = strlen(buffer) + 1;
lwreq.u.data.flags = WSC_CREDENTIAL_SSID;
39/94
RT2870 Linux Station Release Notes and User’s Guide
return -1;
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <fcntl.h>
#include <time.h>
#include <sys/times.h>
#include <unistd.h>
#include <sys/stat.h>
#include <err.h>
#include <errno.h>
#include <asm/types.h>
#include </usr/include/linux/wireless.h>
#include <sys/ioctl.h>
#define IFNAMSIZ 16
40/94
RT2870 Linux Station Release Notes and User’s Guide
enum {
WSC_CREDENTIAL_COUNT = 1,
WSC_CREDENTIAL_SSID = 2,
WSC_CREDENTIAL_AUTH_MODE = 3,
WSC_CREDENTIAL_ENCR_TYPE = 4,
WSC_CREDENTIAL_KEY_INDEX = 5,
WSC_CREDENTIAL_KEY = 6,
WSC_CREDENTIAL_MAC = 7,
WSC_SET_DRIVER_CONNECT_BY_CREDENTIAL_IDX = 8,
WSC_SET_DRIVER_AUTO_CONNECT = 9,
WSC_SET_PIN = 12,
WSC_SET_SSID = 13,
WSC_START = 14,
WSC_STOP = 15,
WSC_GEN_PIN_CODE = 16,
};
int main()
int cred_count;
if (skfd < 0)
return -1;
41/94
RT2870 Linux Station Release Notes and User’s Guide
memset(&lwreq, 0, sizeof(lwreq));
lwreq.u.mode = WSC_STOP;
return -1;
///////////////////////////////////
memset(&lwreq, 0, sizeof(lwreq));
lwreq.u.data.length = 1;
cred_count = 1;
offset = sizeof(int);
lwreq.u.mode = WSC_CREDENTIAL_COUNT;
return -1;
42/94
RT2870 Linux Station Release Notes and User’s Guide
///////////////////////////////////
memset(&lwreq, 0, sizeof(lwreq));
memset(buffer, 0, 2048);
lwreq.u.data.length = strlen(buffer) + 1;
lwreq.u.data.flags = WSC_CREDENTIAL_SSID;
return -1;
///////////////////////////////////
close(skfd);
return 0;
43/94
RT2870 Linux Station Release Notes and User’s Guide
If you are not familiar with hardware, it is recommanded not to modify hardware default value.
44/94
RT2870 Linux Station Release Notes and User’s Guide
Syntax: Example
Value: Value:
0: … 1:
1: … 2:
.: … .:
6.1.1 ATE
Value:
6.1.2 ATEDA
Value:
xx:xx:xx:xx:xx:xx ; hex
6.1.3 ATESA
Value:
xx:xx:xx:xx:xx:xx ; hex
6.1.4 ATEBSSID
45/94
RT2870 Linux Station Release Notes and User’s Guide
Value:
xx:xx:xx:xx:xx:xx ; hex
6.1.5 ATECHANNEL
Value:
6.1.6 ATETXPOW0
Value:
6.1.7 ATETXPOW1
Value:
6.1.8 ATETXFREQOFFSET
Value:
6.1.9 ATETXLEN
Value:
24 ~ 1500 ; decimal
6.1.10 ATETXCNT
Value:
1~ ; 32-bit, decimal
46/94
RT2870 Linux Station Release Notes and User’s Guide
Value:
0: CCK 802.11b
1: OFDM 802.11g
2: HT_MIX 802.11b/g/n
Value:
0: 20MHz
1: 40MHz
Value:
0: Long
1: Short
Value:
0 ~ 15
6.1.15 ATETXANT
Value:
0: All
1: Antenna one
2: Antenna two
6.1.16 ATERXANT
47/94
RT2870 Linux Station Release Notes and User’s Guide
Value:
0: All
1: Antenna one
2: Antenna two
3: Antenna three
6.1.17 ATERXFER
Value:
6.1.18 ATESHOW
Value:
6.1.19 ATEHELP
Value:
6.1.20 ResetCounter
Value:
6.1.21 ATERRF
Value:
6.1.22 ATEWRF1
48/94
RT2870 Linux Station Release Notes and User’s Guide
Value:
6.1.23 ATEWRF2
Value:
6.1.24 ATEWRF3
Value:
6.1.25 ATEWRF4
Value:
49/94
RT2870 Linux Station Release Notes and User’s Guide
MCS = 3 18Mbps
MCS = 4 24Mbps
MCS = 5 36Mbps
MCS = 6 48Mbps
MCS = 7 54Mbps
Notes:
50/94
RT2870 Linux Station Release Notes and User’s Guide
Notes:
4. When MCS=0~7(1S, One Tx Stream), STBC option is supported. SGI option is supported.
BW option is supported.
5. When MCS=8~15(2S, Two Tx Stream), STBC option is NOT supported. SGI option is
supported. BW option is supported.
6. When MCS=32, only SGI option is supported. BW and STBC option are not supported.
(BW =1, STBC=0)
8. When STBC is supported. Only STBC = 1 is allowed. STBC will extend the transmission
range but will not increase transmission rate.
6.3 Examples
51/94
RT2870 Linux Station Release Notes and User’s Guide
iwpriv ra0 set ATE=TXFRAME ; Start Tx Frame(inform BBP to change, modulation mode)
iwpriv ra0 set ATE=TXCARR ; Start Tx carrier, Measure carrier with instrument
iwpriv ra0 set ATE=TXFRAME ; Start Tx Frame(inform BBP to change, modulation mode)
iwpriv ra0 set ATE=TXCONT ; Start continuous TX, Measure specturm mask with instrument
52/94
RT2870 Linux Station Release Notes and User’s Guide
iwpriv ra0 set ATE=TXCARR ; Start Tx carrier, Measure carrier frequency with instrument
iwpriv ra0 set ATE=ATESTART ; Stop, Store the tuning result to EEPROM
6.3.5 Rx
iwpriv ra0 set ATERXFER=1 ; show RxCnt and RSSI/per-antenna, Transmit test packets
53/94
RT2870 Linux Station Release Notes and User’s Guide
Mode=4
TxPower0=0
TxPower1=0
TxAntennaSel=0
RxAntennaSel=0
BBPCurrentBW=0
GI=0
MCS=7
TxMode=1
Addr1=00:11:22:aa:bb:cc
Addr2=00:11:22:aa:bb:cc
Addr3=00:11:22:aa:bb:cc
Channel=1
TxLength=1024
TxCount=40000
TxRate=11
RFFreqOffset=0
ATEDA
ATESA
ATEBSSID
ATECHANNEL, range:0~14
54/94
RT2870 Linux Station Release Notes and User’s Guide
ATETXMODE, set Mode 0:CCK, 1:OFDM, 2:HT-Mix, 3:GreenField, reference to rate table.
MlmePeriodicExec: Rx AvgRssi=-87
55/94
RT2870 Linux Station Release Notes and User’s Guide
MlmePeriodicExec: Rx AvgRssi=-90
6.4.1 BBPID
BBPID:
0 ~ xx ; decimal, 8-bit
6.4.2 BBPID=Value
BBPID:
0 ~ xx ; decimal, 8-bit
Value:
6.5.1 MAC_OFFSET
MAC_OFFSET:
6.5.2 MAC_OFFSET=Value
MAC_OFFSET:
Value:
56/94
RT2870 Linux Station Release Notes and User’s Guide
6.6.1 EEP_ADDR
EEP_ADDR:
6.6.2 EEP_ADDR=Value
EEP_ADDR:
Value:
6.7 Example
6.7.3 Suggestion:
1. To turn on ATE functionality, you have to add compile flag "RALINK_ATE" to Makefile
57/94
RT2870 Linux Station Release Notes and User’s Guide
3. If you want to test another ATE action, prefer to stop AP & ATE function
Note.
6.8 ated
ated - user space ATE agent program for RT2070 Linux driver, Ralink Tech. Corp.
RT2070 ATE daemon - ated, which comes with RT2070 Linux driver.
The relationship between the Linux driver, Windows QA GUI and RT2070 ATE daemon is explained here.
In addition, this will teach you how to use this ATE daemon.
6.8.1 Introduction
The ated is an optional user space component for RT2070 Linux driver.
It behaves as a proxy between Windows QA GUI and RT2070 Linux driver when ATE process proceeds.
RT2070 Linux driver will leave ATE mode either ated is killed or QA GUI is closed.
1. Connect the platform you want to test directly with a Windows host by ether network line.
1. First you should set both "HAS_ATE=y" and "HAS_28xx_QA=y" in the file
~/Module/os/linux/config.mk and compile the driver.
5. Then type 'make' command to compile the source code of the daemon.
6. After the driver interface "ra0" has started up, attach both of "ra0" and the ethernet
interface to the bridge interface "br0".
58/94
RT2870 Linux Station Release Notes and User’s Guide
7. Manually start ated, type '$ated -bbrX -iraX'.(For further usage of options, type $ated -h)
Note :
The names of WLAN interface(default is "ra0") and Bridge interface(default is "br0") must be
specified manually (for example : '$ated –b br1 –ira2') if your WLAN interface or Bridge
interface is not "ra0" or "br0" respectively !
59/94
RT2870 Linux Station Release Notes and User’s Guide
7 IOCTL
if(OPSTATUS_TEST_FLAG(pAd,fOP_STATUS_MEDIA_STATE_CONNECTED))
erq->flags=1;
Status = copy_to_user(erq->pointer,
else
erq->flags=0;
erq->length=0;
(Hz) wrq->u.freq.e = 0;
wrq->u.freq.i = 0;
erq->length = strlen(pAd->nickn);
60/94
RT2870 Linux Station Release Notes and User’s Guide
wrq->u.rts.fixed = 1;
wrq->u.frag.fixed = 1;
wrq->u.encoding.flags = IW_ENCODE_OPEN;
wrq->u.encoding.flags = IW_ENCODE_RESTRICTED;
wrq->u.encoding.flags |= IW_ENCODE_DISABLED;
else
if(wrq->u.encoding.pointer)
wrq->u.encoding.length = pAd->SharedKey[index].KeyLen;
Status = copy_to_user(wrq->u.encoding.pointer,
pAd->SharedKey[index].Key,
pAd->SharedKey[index].KeyLen);
61/94
RT2870 Linux Station Release Notes and User’s Guide
Mode {
BssType = Ndis802_11IBSS;
wrq->u.mode = IW_MODE_ADHOC;
else if (INFRA_ON(pAd))
BssType = Ndis802_11Infrastructure;
wrq->u.mode = IW_MODE_INFRA;
else
BssType = Ndis802_11AutoUnknown;
wrq->u.mode = IW_MODE_AUTO;
if (erq->flags)
Status = -E2BIG;
break;
else
62/94
RT2870 Linux Station Release Notes and User’s Guide
pAd->CommonCfg.BssType = BSS_INFRA;
pAd->CommonCfg.AuthMode = Ndis802_11AuthModeOpen;
pAd->CommonCfg.WepStatus = Ndis802_11EncryptionDisabled;
pSsid = &Ssid;
if (pAd->Mlme.CntlMachine.CurrState != CNTL_IDLE)
MlmeRestartStateMachine(pAd);
pAd->MlmeAux.CurrReqIsFromNdis = FALSE;
MlmeEnqueue(pAd,
MLME_CNTL_STATE_MACHINE,
OID_802_11_SSID,
sizeof(NDIS_802_11_SSID),
(VOID *)pSsid);
Status = NDIS_STATUS_SUCCESS;
StateMachineTouched = TRUE;
else
pAd->CommonCfg.Channel = chan;
if (erq->flags)
63/94
RT2870 Linux Station Release Notes and User’s Guide
else
Status = -E2BIG;
(bps)
if (wrq->u.rts.disabled)
RtsThresh = MAX_RTS_THRESHOLD;
pAd->CommonCfg.RtsThreshold = (USHORT)RtsThresh;
else if (RtsThresh == 0)
pAd->CommonCfg.RtsThreshold = MAX_RTS_THRESHOLD;
FragThresh = MAX_FRAG_THRESHOLD;
pAd->CommonCfg.FragmentThreshold = (USHORT)FragThresh;
else if (FragThresh == 0)
pAd->CommonCfg.FragmentThreshold = MAX_FRAG_THRESHOLD;
if (pAd->CommonCfg.FragmentThreshold == MAX_FRAG_THRESHOLD)
pAd->CommonCfg.bFragmentZeroDisable = TRUE;
else
pAd->CommonCfg.bFragmentZeroDisable = FALSE;
64/94
RT2870 Linux Station Release Notes and User’s Guide
if(wrq->u.encoding.pointer)
len = wrq->u.encoding.length;
len = WEP_LARGE_KEY_LEN;
Status = copy_from_user(pAd->SharedKey[index].Key,
wrq->u.encoding.pointer, len);
pAd->CommonCfg.WepStatus = Ndis802_11WEPDisabled;
else
pAd->CommonCfg.WepStatus = Ndis802_11WEPEnabled;
pAd->CommonCfg.AuthMode = Ndis802_11AuthModeShared;
else
pAd->CommonCfg.AuthMode = Ndis802_11AuthModeOpen;
if(pAd->CommonCfg.WepStatus == Ndis802_11WEPDisabled)
pAd->CommonCfg.AuthMode = Ndis802_11AuthModeOpen;
if (pAd->Mlme.CntlMachine.CurrState != CNTL_IDLE)
MlmeRestartStateMachine(pAd);
65/94
RT2870 Linux Station Release Notes and User’s Guide
pAd->MlmeAux.CurrReqIsFromNdis = FALSE;
MlmeEnqueue(pAd,
MLME_CNTL_STATE_MACHINE,
OID_802_11_BSSID,
sizeof(NDIS_802_11_MAC_ADDRESS),
(VOID *)&Bssid);
Status = NDIS_STATUS_SUCCESS;
StateMachineTouched = TRUE;
Mode {
if (pAd->CommonCfg.BssType != BSS_ADHOC)
pAd->bConfigChanged = TRUE;
pAd->CommonCfg.BssType = BSS_ADHOC;
if (pAd->CommonCfg.BssType != BSS_INFRA)
pAd->bConfigChanged = TRUE;
pAd->CommonCfg.BssType = BSS_INFRA;
else
Status = -EINVAL;
pAd->CommonCfg.WpaState = SS_NOTUSE;
66/94
RT2870 Linux Station Release Notes and User’s Guide
Parameters:
int socket_id;
Default setting:
wrq.u.data.flags = 0;
Data Structure:
Set Data
strcpy(data, "SSID=RT2870AP”);
strcpy(wrq.ifr_name, name);
wrq.u.data.length = strlen(data);
wrq.u.data.pointer = data;
wrq.u.data.flags = 0;
67/94
RT2870 Linux Station Release Notes and User’s Guide
Get Data
strcpy(data, "stat”);
strcpy(wrq.ifr_name, name);
wrq.u.data.length = strlen(data);
wrq.u.data.pointer = data;
wrq.u.data.flags = 0;
strcpy(data, "get_site_survey”);
strcpy(wrq.ifr_name, name);
wrq.u.data.length = strlen(data);
wrq.u.data.pointer = data;
wrq.u.data.flags = 0;
IOCTL Function
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(UCHAR));
68/94
RT2870 Linux Station Release Notes and User’s Guide
wrq.u.data.length = sizeof(UCHAR);
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_OID_802_11_COUNTRY_REGION;
strcpy(wrq.ifr_name, name);
wrq.u.data.length = 0;
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_BSSID_LIST_SCAN;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(NDIS_802_11_SSID));
wrq.u.data.length = sizeof(NDIS_802_11_SSID);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_SSID;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(NDIS_802_11_MAC_ADDRESS));
wrq.u.data.length = sizeof(NDIS_802_11_MAC_ADDRESS);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_BSSID;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(BOOLEAN));
wrq.u.data.length = sizeof(BOOLEAN);
wrq.u.data.pointer = data;
69/94
RT2870 Linux Station Release Notes and User’s Guide
wrq.u.data.flags = RT_OID_802_11_RADIO;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(RT_802_11_PHY_MODE));
wrq.u.data.length = sizeof(RT_802_11_PHY_MODE);
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_OID_802_11_PHY_MODE;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(RT_802_11_STA_CONFIG));
wrq.u.data.length = sizeof(RT_802_11_STA_CONFIG);
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_OID_802_11_STA_CONFIG;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(NDIS_802_11_RATES));
wrq.u.data.length = sizeof(NDIS_802_11_RATES);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_DESIRED_RATES;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(RT_802_11_PREAMBLE));
wrq.u.data.length = sizeof(RT_802_11_PREAMBLE);
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_OID_802_11_PREAMBLE;
70/94
RT2870 Linux Station Release Notes and User’s Guide
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(NDIS_802_11_WEP_STATUS));
wrq.u.data.length = sizeof(NDIS_802_11_WEP_STATUS);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_WEP_STATUS;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(NDIS_802_11_AUTHENTICATION_MODE));
wrq.u.data.length = sizeof(NDIS_802_11_AUTHENTICATION_MODE);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_AUTHENTICATION_MODE;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(NDIS_802_11_NETWORK_INFRASTRUCTURE));
wrq.u.data.length =
sizeof(NDIS_802_11_NETWORK_INFRASTRUCTURE);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_INFRASTRUCTURE_MODE;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(NDIS_802_11_KEY_INDEX));
wrq.u.data.length = sizeof(NDIS_802_11_KEY_INDEX);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_REMOVE_WEP;
71/94
RT2870 Linux Station Release Notes and User’s Guide
strcpy(wrq.ifr_name, name);
wrq.u.data.length = 0;
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_OID_802_11_RESET_COUNTERS;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(NDIS_802_11_RTS_THRESHOLD));
wrq.u.data.length = sizeof(NDIS_802_11_RTS_THRESHOLD);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_RTS_THRESHOLD;
strcpy(wrq.ifr_name, name);
memset(data, 0,
sizeof(NDIS_802_11_FRAGMENTATION_THRESHOLD));
wrq.u.data.length =
sizeof(NDIS_802_11_FRAGMENTATION_THRESHOLD);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_FRAGMENTATION_THRESHOLD;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(NDIS_802_11_POWER_MODE));
wrq.u.data.length = sizeof(NDIS_802_11_POWER_MODE);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_POWER_MODE;
72/94
RT2870 Linux Station Release Notes and User’s Guide
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(NDIS_802_11_TX_POWER_LEVEL));
wrq.u.data.length = sizeof(NDIS_802_11_TX_POWER_LEVEL);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_TX_POWER_LEVEL;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(ULONG));
wrq.u.data.length = sizeof(ULONG);
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_OID_802_11_TX_POWER_LEVEL_1;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(NDIS_802_11_NETWORK_TYPE));
wrq.u.data.length = / sizeof(NDIS_802_11_NETWORK_TYPE);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_NETWORK_TYPE_IN_USE;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(NDIS_802_11_ANTENNA));
wrq.u.data.length = sizeof(NDIS_802_11_ANTENNA);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_RX_ANTENNA_SELECTED;
73/94
RT2870 Linux Station Release Notes and User’s Guide
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(NDIS_802_11_ANTENNA));
wrq.u.data.length = sizeof(NDIS_802_11_ANTENNA);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_TX_ANTENNA_SELECTED;
strcpy(wrq.ifr_name, name);
memset(data, 0, 32);
wrq.u.data.length = 32;
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_OID_802_11_ADD_WPA;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(NDIS_802_11_REMOVE_KEY));
wrq.u.data.length = sizeof(NDIS_802_11_REMOVE_KEY);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_REMOVE_KEY;
strcpy(wrq.ifr_name, name);
wrq.u.data.length = keylength L;
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_ADD_KEY;
strcpy(wrq.ifr_name, name);
74/94
RT2870 Linux Station Release Notes and User’s Guide
memset(data, 0, sizeof(BOOLEAN));
wrq.u.data.length = sizeof(BOOLEAN);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_SET_IEEE8021X;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(BOOLEAN));
wrq.u.data.length = sizeof(BOOLEAN);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_SET_IEEE8021X_REQUIRE_KEY;
strcpy(wrq.ifr_name, name);
wrq.u.data.length = keylength;
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_OID_802_11_RADIO;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(NDIS_802_11_CONFIGURATION));
wrq.u.data.length = sizeof(NDIS_802_11_CONFIGURATION);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_CONFIGURATION;
strcpy(wrq.ifr_name, name);
wrq.u.data.length = 0;
75/94
RT2870 Linux Station Release Notes and User’s Guide
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_SET_COUNTERMEASURES;
strcpy(wrq.ifr_name, name);
wrq.u.data.length = 0;
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_DISASSOCIATE;
strcpy(wrq.ifr_name, name);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_PMKID;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(BOOLEAN));
wrq.u.data.length = sizeof(BOOLEAN);
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_OID_WPA_SUPPLICANT_SUPPORT;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(ULONG));
wrq.u.data.length = sizeof(ULONG);
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_OID_WPA_SUPPLICANT_SUPPORT;
76/94
RT2870 Linux Station Release Notes and User’s Guide
strcpy(wrq.ifr_name, name);
strcpy(wrq.ifr_name, name);
wrq.u.data.length = 6;
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_SET_DEL_MAC_ENTRY;
IOCTL Function
strcpy(wrq.ifr_name, name);
memset(data, 0, 255);
wrq.u.data.length = 255;
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_OID_DEVICE_NAME;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(RT_VERSION_INFO));
wrq.u.data.length = sizeof(RT_VERSION_INFO);
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_OID_VERSION_INFO;
77/94
RT2870 Linux Station Release Notes and User’s Guide
strcpy(wrq.ifr_name, name);
memset(data, 0, BssLen);
wrq.u.data.length = BssLen;
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_BSSID_LIST;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(CurrentAddress));
wrq.u.data.length = sizeof(CurrentAddress);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_3_CURRENT_ADDRESS;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(NDIS_MEDIA_STATE));
wrq.u.data.length = sizeof(NDIS_MEDIA_STATE);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_GEN_MEDIA_CONNECT_STATUS;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(NDIS_802_11_MAC_ADDRESS));
wrq.u.data.length = sizeof(NDIS_802_11_MAC_ADDRESS);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_BSSID;
78/94
RT2870 Linux Station Release Notes and User’s Guide
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(NDIS_802_11_SSID));
wrq.u.data.length = sizeof(NDIS_802_11_SSID);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_SSID;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(RT_802_11_LINK_STATUS));
wrq.u.data.length = sizeof(RT_802_11_LINK_STATUS);
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_OID_802_11_QUERY_LINK_STATUS;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(NDIS_802_11_CONFIGURATION));
wrq.u.data.length = sizeof(NDIS_802_11_CONFIGURATION);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_CONFIGURATION;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(ulInfo));
wrq.u.data.length = sizeof(ulInfo);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_RSSI_TRIGGER;
strcpy(wrq.ifr_name, name);
79/94
RT2870 Linux Station Release Notes and User’s Guide
memset(data, 0, sizeof(ulInfo));
wrq.u.data.length = sizeof(ulInfo);
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_OID_802_11_RSSI;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(ulInfo));
wrq.u.data.length = sizeof(ulInfo);
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_OID_802_11_RSSI_1;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(ulInfo));
wrq.u.data.length = sizeof(ulInfo);
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_OID_802_11_RSSI_2;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(NDIS_802_11_STATISTICS));
wrq.u.data.length = sizeof(NDIS_802_11_STATISTICS);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_STATISTICS;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(ulInfo));
80/94
RT2870 Linux Station Release Notes and User’s Guide
wrq.u.data.length = sizeof(ulInfo);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_GEN_RCV_OK;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(ulInfo));
wrq.u.data.length = sizeof(ulInfo);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_GEN_RCV_NO_BUFFER;
PHY_11BG_MIXED = 0,
PHY_11B,
PHY_11A,
PHY_11ABG_MIXED,
PHY_11G,
} RT_802_11_PHY_MODE
sprintf(name, "ra0");
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(ulInfo));
wrq.u.data.length = sizeof(ulInfo);
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_OID_802_11_PHY_MODE;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(RT_802_11_STA_CONFIG));
81/94
RT2870 Linux Station Release Notes and User’s Guide
wrq.u.data.length = sizeof(RT_802_11_STA_CONFIG);
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_OID_802_11_STA_CONFIG;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(RtsThresh));
wrq.u.data.length = sizeof(RtsThresh);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_RTS_THRESHOLD;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(FragThresh));
wrq.u.data.length = sizeof(FragThresh);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_FRAGMENTATION_THRESHOLD;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(PowerMode));
wrq.u.data.length = sizeof(PowerMode);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_POWER_MODE;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(RadioState));
wrq.u.data.length = sizeof(RadioState);
82/94
RT2870 Linux Station Release Notes and User’s Guide
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_OID_802_11_RADIO;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(BssType));
wrq.u.data.length = sizeof(BssType);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_INFRASTRUCTURE_MODE;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(PreamType));
wrq.u.data.length = sizeof(PreamType);
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_OID_802_11_PREAMBLE;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(AuthMode));
wrq.u.data.length = sizeof(AuthMode);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_AUTHENTICATION_MODE;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(WepStatus));
wrq.u.data.length = sizeof(WepStatus);
wrq.u.data.pointer = data;
83/94
RT2870 Linux Station Release Notes and User’s Guide
wrq.u.data.flags = OID_802_11_WEP_STATUS;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(ULONG));
wrq.u.data.length = sizeof(ULONG);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_TX_POWER_LEVEL;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(ULONG));
wrq.u.data.length = sizeof(ULONG);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_TX_POWER_LEVEL_1;
strcpy(wrq.ifr_name, name);
memset(data, 0, 16);
wrq.u.data.length = 16;
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_NETWORK_TYPES_SUPPORTED;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(ULONG));
wrq.u.data.length = sizeof(ULONG);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_NETWORK_TYPE_IN_USE;
84/94
RT2870 Linux Station Release Notes and User’s Guide
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(ULONG));
wrq.u.data.length = sizeof(ULONG);
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_OID_802_11_QUERY_EEPROM_VERSION;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(ULONG));
wrq.u.data.length = sizeof(ULONG);
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_OID_802_11_QUERY_FIRMWARE_VERSION;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(UCHAR));
wrq.u.data.length = sizeof(UCHAR);
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_OID_802_11_QUERY_NOISE_LEVEL;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(ULONG));
wrq.u.data.length = sizeof(ULONG);
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_OID_802_11_EXTRA_INFO;
85/94
RT2870 Linux Station Release Notes and User’s Guide
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(ULONG));
wrq.u.data.length = sizeof(ULONG);
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_OID_802_11_QUERY_PIDVID;
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(UINT));
wrq.u.data.length = sizeof(UINT);
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_OID_WE_VERSION_COMPILED;
sprintf(wrq.ifr_name, "ra0");
wrq.u.data.flags = RT_OID_802_11_QUERY_LAST_TX_RATE;
sprintf(wrq.ifr_name, "ra0");
wrq.u.data.flags = RT_OID_802_11_QUERY_LAST_RX_RATE;
sprintf(wrq.ifr_name, "ra0");
wrq.u.data.flags = SHOW_CONN_STATUS;
86/94
RT2870 Linux Station Release Notes and User’s Guide
87/94
RT2870 Linux Station Release Notes and User’s Guide
8 IOCTL HOW TO
u_char buffer[IW_PRIV_SIZE_MASK];
sprintf(wrq.ifr_name, "ra0");
wrq.u.data.flags = SHOW_CONN_STATUS;
u_char buffer[IW_PRIV_SIZE_MASK];
sprintf(wrq.ifr_name, "ra0");
wrq.u.data.flags = 0;
u_char buffer[4096];
sprintf(wrq.ifr_name, "ra0");
wrq.u.data.flags = 0;
88/94
RT2870 Linux Station Release Notes and User’s Guide
u_char buffer[4096];
sprintf(wrq.ifr_name, "ra0");
wrq.u.data.length = 4096;
wrq.u.data.flags = OID_802_11_BSSID_LIST;
u_char buffer[6];
sprintf(wrq.ifr_name, "ra0");
wrq.u.data.flags = OID_802_3_CURRENT_ADDRESS;
#define NdisMediaStateConnected 1
#define NdisMediaStateDisconnected 0
NDIS_MEDIA_STATE MediaState;
sprintf(wrq.ifr_name, "ra0");
wrq.u.data.flags = OID_GEN_MEDIA_CONNECT_STATUS;
char BSSID[6];
sprintf(wrq.ifr_name, "ra0");
89/94
RT2870 Linux Station Release Notes and User’s Guide
wrq.u.data.flags = OID_802_11_BSSID;
NDIS_802_11_SSID SSID;
sprintf(wrq.ifr_name, "ra0");
wrq.u.data.flags = OID_802_11_SSID;
HTTRANSMIT_SETTING tmpHT;
sprintf(wrq.ifr_name, "ra0");
wrq.u.data.flags = RT_OID_802_11_QUERY_LAST_TX_RATE;
HTTRANSMIT_SETTING tmpHT;
sprintf(wrq.ifr_name, "ra0");
wrq.u.data.flags = RT_OID_802_11_QUERY_LAST_RX_RATE;
PHY_11BG_MIXED = 0,
PHY_11B,
90/94
RT2870 Linux Station Release Notes and User’s Guide
PHY_11A,
PHY_11ABG_MIXED,
PHY_11G,
} RT_802_11_PHY_MODE
sprintf(wrq.ifr_name, "ra0");
wrq.u.data.flags = RT_OID_802_11_PHY_MODE;
Ndis802_11IBSS,
Ndis802_11Infrastructure,
Ndis802_11AutoUnknown,
Ndis802_11Monitor,
} NDIS_802_11_NETWORK_INFRASTRUCTURE
NDIS_802_11_NETWORK_INFRASTRUCTURE BssType;
sprintf(wrq.ifr_name, "ra0");
wrq.u.data.flags = OID_802_11_INFRASTRUCTURE_MODE;
91/94
RT2870 Linux Station Release Notes and User’s Guide
Ndis802_11AuthModeOpen,
Ndis802_11AuthModeShared,
Ndis802_11AuthModeAutoSwitch,
Ndis802_11AuthModeWPA,
Ndis802_11AuthModeWPAPSK,
Ndis802_11AuthModeWPANone,
Ndis802_11AuthModeWPA2,
Ndis802_11AuthModeWPA2PSK,
Ndis802_11AuthModeWPA1WPA2,
Ndis802_11AuthModeWPA1PSKWPA2PSK,
} NDIS_802_11_AUTHENTICATION_MODE
NDIS_802_11_AUTHENTICATION_MODE AuthMode;
sprintf(wrq.ifr_name, "ra0");
wrq.u.data.flags = OID_802_11_AUTHENTICATION_MODE;
Ndis802_11WEPEnabled,
Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled,
Ndis802_11WEPDisabled,
Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled,
Ndis802_11WEPKeyAbsent,
Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent,
Ndis802_11WEPNotSupported,
92/94
RT2870 Linux Station Release Notes and User’s Guide
Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported,
Ndis802_11Encryption2Enabled,
Ndis802_11Encryption2KeyAbsent,
Ndis802_11Encryption3Enabled,
Ndis802_11Encryption3KeyAbsent,
Ndis802_11Encryption4KeyAbsent,
} NDIS_802_11_WEP_STATUS, *PNDIS_802_11_WEP_STATUS,
NDIS_802_11_WEP_STATUS WepStatus;
sprintf(wrq.ifr_name, "ra0");
wrq.u.data.flags = OID_802_11_WEP_STATUS;
long rssi_0
sprintf(wrq.ifr_name, "ra0");
wrq.u.data.flags = RT_OID_802_11_RSSI;
long rssi_1
sprintf(wrq.ifr_name, "ra0");
wrq.u.data.flags = RT_OID_802_11_RSSI_1;
93/94
RT2870 Linux Station Release Notes and User’s Guide
long rssi_2
sprintf(wrq.ifr_name, "ra0");
wrq.u.data.flags = RT_OID_802_11_RSSI_2;
sprintf(wrq.ifr_name, "ra0");
wrq.u.data.flags = RT_OID_WE_VERSION_COMPILED;
94/94