MTK Wi-Fi STA Software Programming Guide v1.1
MTK Wi-Fi STA Software Programming Guide v1.1
US AL
EO
om TI
y.c N
ra IDE
MTK Wi-Fi STA Software Programming Guide
em F
og ON
@ C
01 K
02 TE
Version: 1.1
50 A
N
US AL
EO
Revision Date Author Description
1.0 2012/10/29 Pan Liu Initial Version
1.1 2012/10/31 Pan Liu Add sample code
om TI
y.c N
ra IDE
em F
og ON
@ C
01 K
02 TE
50 A
29 DI
E
FO M
R
N
Document Revision History .................................................................................................................. 2
US AL
EO
Table of Contents ................................................................................................................................... 3
1 Introduction................................................................................................................................... 8
2 Wi-Fi STA driver Profile Default Setting ..................................................................................... 9
om TI
2.1 WLAN Profile Description ................................................................................................... 10
2.1.1 CountryRegion ................................................................................................... 10
2.1.2 CountryRegionForABand ................................................................................... 11
y.c N
2.1.3 CountryCode ...................................................................................................... 11
2.1.4 ChannelGeography ............................................................................................ 11
ra IDE
2.1.5 SSID ................................................................................................................... 11
2.1.6 NetworkType ...................................................................................................... 12
2.1.7 WirelessMode ..................................................................................................... 12
2.1.8 Channel .............................................................................................................. 12
2.1.9 BeaconPeriod ..................................................................................................... 12
em F
2.1.10 TxPower ............................................................................................................. 13
2.1.11 BGProtection ...................................................................................................... 13
og ON
N
2.1.43 HT_AutoBA ........................................................................................................ 19
2.1.44 HT_AMSDU ........................................................................................................ 19
US AL
EO
2.1.45 HT_BAWinSize ................................................................................................... 19
2.1.46 HT_GI ................................................................................................................. 20
2.1.47 HT_MCS ............................................................................................................. 20
2.1.48 HT_MIMOPSMode ............................................................................................. 20
om TI
2.1.49 HT_DisallowTKIP ............................................................................................... 20
2.1.50 HT_STBC ........................................................................................................... 20
2.1.51 IEEE80211H ....................................................................................................... 21
y.c N
2.1.52 WirelessEvent .................................................................................................... 21
2.1.53 CarrierDetect ...................................................................................................... 21
ra IDE
2.1.54 AntDiversity ........................................................................................................ 21
2.1.55 BeaconLostTime ................................................................................................ 21
2.1.56 PSP_XLINK_MODE ........................................................................................... 22
2.1.57 WscManufacturer ............................................................................................... 22
2.1.58 WscModelName ................................................................................................. 22
em F
2.1.59 WscDeviceName ................................................................................................ 22
og ON
2.1.60 WscModelNumber .............................................................................................. 22
2.1.61 WscSerialNumber .............................................................................................. 22
2.1.62 RadioOn ............................................................................................................. 23
2.1.63 Wsc4digitPinCode .............................................................................................. 23
@ C
3.9 TxPower.............................................................................................................................. 26
3.10 Channel .............................................................................................................................. 26
29 DI
3.21 HtBaWinSize....................................................................................................................... 28
3.22 HtRdg .................................................................................................................................. 29
3.23 HtAmsdu ............................................................................................................................. 29
MediaTek Confidential © 2012 MediaTek Inc. Page 4 of 82
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
N
3.27 HtMimoPs ........................................................................................................................... 30
3.28 HtDisallowTKIP ................................................................................................................... 30
US AL
EO
3.29 HtBssCoex .......................................................................................................................... 30
3.30 PktAggregate ...................................................................................................................... 30
3.31 WmmCapable ..................................................................................................................... 30
3.32 IEEE80211H ....................................................................................................................... 31
om TI
3.33 NetworkType....................................................................................................................... 31
3.34 AuthMode ........................................................................................................................... 31
3.35 EncrypType......................................................................................................................... 31
y.c N
3.36 DefaultKeyID....................................................................................................................... 32
3.37 Key1 .................................................................................................................................... 32
ra IDE
3.38 Key2 .................................................................................................................................... 32
3.39 Key3 .................................................................................................................................... 32
3.40 Key4 .................................................................................................................................... 32
3.41 WPAPSK ............................................................................................................................ 32
3.42 ResetCounter...................................................................................................................... 33
em F
3.43 PSMode .............................................................................................................................. 33
og ON
3.44 FixedTXMode ..................................................................................................................... 33
3.45 BeaconLostTime ................................................................................................................. 33
3.46 AutoRoaming ...................................................................................................................... 33
3.47 SiteSurvey .......................................................................................................................... 34
3.48 AutoReconnect ................................................................................................................... 34
@ C
N
6.2.2 WPANONE/TKIP ................................................................................................ 40
6.3 Get Site Survey result ......................................................................................................... 40
US AL
EO
6.4 Get WLAN Statistics ........................................................................................................... 40
6.5 To Link with AP ................................................................................................................... 41
7 WPS Wi-Fi PROTECTED SETUP ............................................................................................... 42
om TI
7.1 WPS iwpriv command ........................................................................................................ 42
7.1.1 wsc_conf_mode ................................................................................................. 42
7.1.2 wsc_mode .......................................................................................................... 43
y.c N
7.1.3 wsc_pin .............................................................................................................. 43
7.1.4 wsc_ssid ............................................................................................................. 43
ra IDE
7.1.5 wsc_bssid ........................................................................................................... 43
7.1.6 wsc_start ............................................................................................................ 43
7.1.7 wsc_stop ............................................................................................................ 43
7.1.8 wsc_gen_pincode ............................................................................................... 44
7.1.9 wsc_cred_count ................................................................................................. 44
em F
7.1.10 wsc_cred_ssid .................................................................................................... 44
7.1.11 wsc_cred_auth ................................................................................................... 44
og ON
N
8.1.10 p2pOpCh ............................................................................................................ 54
8.1.11 p2pLink ............................................................................................................... 54
US AL
EO
8.1.12 p2pInv ................................................................................................................. 54
8.1.13 p2pProv .............................................................................................................. 55
8.1.14 p2pCfg ................................................................................................................ 55
8.1.15 p2pStat ............................................................................................................... 55
om TI
8.1.16 p2pReset ............................................................................................................ 55
8.1.17 p2pDefConfMthd ................................................................................................ 55
8.1.18 p2pDevDisc ........................................................................................................ 55
y.c N
8.1.19 p2pLinkDown ...................................................................................................... 56
8.2 P2P Example iwpriv command ........................................................................................... 56
ra IDE
8.2.1 Configure WLAN driver as Autonomous GO ..................................................... 56
8.2.2 Configure WLAN driver as Autonomous GO start WPS PBC ............................ 56
8.2.3 Configure WLAN driver as autonomous GO start WPS PIN-Display ................ 57
8.2.4 Configure WLAN driver as autonomous GO start WPS PIN-KeyPad ............... 57
8.2.5 Configure WLAN driver as P2P device start WPS PIN-Display ......................... 58
em F
8.2.6 Configure WLAN driver as P2P device start WPS PBC .................................... 58
og ON
N
This document is the Software programming guide for Mediatek Wi-Fi STA driver. The Software
US AL
Programming guide covers profile setting, command list, and OID examples to demonstrate how to
EO
programming the WLAN driver.
om TI
y.c N
ra IDE
em F
og ON
@ C
01 K
02 TE
50 A
29 DI
E
FO M
R
N
US AL
EO
#The word of "Default" must not be removed
Default
CountryRegion=5
CountryRegionABand=7
CountryCode=
om TI
ChannelGeography=1
SSID=11n-AP
NetworkType=Infra
y.c N
WirelessMode=5
Channel=0
ra IDE
BeaconPeriod=100
TxPower=100
BGProtection=0
TxPreamble=0
RTSThreshold=2347
FragThreshold=2346
em F
TxBurst=1
PktAggregate=0
og ON
WmmCapable=1
AckPolicy=0;0;0;0
AuthMode=OPEN
EncrypType=NONE
WPAPSK=
@ C
DefaultKeyID=1
Key1Type=0
Key1Str=
01 K
Key2Type=0
Key2Str=
Key3Type=0
02 TE
Key3Str=
Key4Type=0
Key4Str=
PSMode=CAM
50 A
AutoRoaming=0
RoamThreshold=70
APSDCapable=0
29 DI
APSDAC=0;0;0;0
HT_RDG=1
HT_EXTCHA=0
E
HT_OpMode=0
HT_MpduDensity=4
HT_BW=1
FO M
HT_AutoBA=1
HT_BADecline=0
HT_AMSDU=0
HT_BAWinSize=64
HT_GI=1
HT_MCS=33
R
HT_MIMOPSMode=3
HT_DisallowTKIP=1
HT_STBC=0
N
BeaconLostTime=4
PSP_XLINK_MODE=0
US AL
EO
WscManufacturer=
WscModelName=
WscDeviceName=
WscModelNumber=
om TI
WscSerialNumber=
RadioOn=1
Wsc4digitPinCode=0
y.c N
2.1 WLAN Profile Description
ra IDE
Syntax is 'Param'='Value' and describes below.
SectionNumber Param
Value
...
...
em F
...
og ON
The WLAN driver needs to be restart, after WLAN profile has been modified.
Otherwise settings will not take any effect.
2.1.1 CountryRegion
Description: Country region for WLAN radio 2.4G HZ regulation.
02 TE
Value:
CountryRegion=5
50 A
Region Channels
0 1-11
29 DI
1 1-13
2 10-11
E
3 10-13
4 14
FO M
5 1-14
6 3-9
7 5-13
31 1-14
R
N
CountryRegionABand=7
US AL
EO
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
om TI
2 36, 40, 44, 48, 52, 56, 60, 64
y.c N
4 149, 153, 157, 161, 165
ra IDE
6 36, 40, 44, 48
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
em F
10 36, 40, 44, 48, 149, 153, 157, 161, 165
11 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 149, 153, 157, 161
og ON
2.1.3 CountryCode
@ C
Please refer to ISO3166 code list for other countries and can be found at
http://www.iso.org/iso/prods-services/iso3166ma/02iso-3166-code-
lists/country_names_and_code_elements
Note:
50 A
2.1.4 ChannelGeography
E
ChannelGeography=1
0: Outdoor
1: Indoor
2: Both
R
2.1.5 SSID
Description: The target BSSID string name
MediaTek Confidential © 2012 MediaTek Inc. Page 11 of 82
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
N
0~z, 1~32 ASCII characters.
US AL
EO
2.1.6 NetworkType
Description: Network type
Value:
om TI
NetworkType=Infra
y.c N
Adhoc: adhoc mode
ra IDE
2.1.7 WirelessMode
Description: Wireless Mode
Value:
WirelessMode=5
em F
0: legacy 11b/g mixed
og ON
6: 11N only
7: 11GN mixed
8: 11AN mixed
01 K
9: 11BGN mixed
10: 11AGN mixed
11: 11N only in 5G band only
02 TE
2.1.8 Channel
50 A
Channel=0
2.1.9 BeaconPeriod
Description: Beacon period setting (It is SoftAP only)
Value:
BeaconPeriod=100
R
N
TxPower=100
US AL
EO
0~100
om TI
2.1.11 BGProtection
Description: Enable/disable WLAN 11B or 11G protection
Value:
y.c N
BGProtection=0
ra IDE
0: disable
1: enable
2.1.12 TxPreamble
em F
Description: Enable or disable Tx preamble
og ON
Value:
TxPreamble=0
0: disable
@ C
1: enable
01 K
2.1.13 RTSThreshold
Description: Set RTS Threshold
02 TE
Value:
RTSThreshold=2347
50 A
1~2347
29 DI
2.1.14 FragThreshold
Description: Set Fragment threshold
E
Value:
FragThreshold=2346
FO M
256~2346
2.1.15 TxBurst
R
0: disable
N
1: enable
US AL
EO
2.1.16 PktAggregate
Description: Enable or disable Tx Aggregate
om TI
Value:
PktAggregate=0
y.c N
0: disable
1: enable
ra IDE
2.1.17 WmmCapable
Description: Enable or disable WMM QOS function
Value:
em F
WmmCapable=1
og ON
0: disable
1: enable
@ C
2.1.18 AckPolicy
Description: Ack policy supports normal Ack or no Ack (AC_BK, AC_BE, AC_VI, AC_VO)
01 K
Value:
AckPolicy=0;0;0;0
02 TE
0: No ack
1: normal Ack
50 A
2.1.19 AuthMode
29 DI
N
EncrypType=NONE
US AL
EO
NONE For AuthMode=OPEN
WEP For AuthMode=OPEN or AuthMode=SHARED
TKIP For AuthMode=WPAPSK or WPA2PSK
AES For AuthMode=WPAPSK or WPA2PSK
om TI
2.1.21 WPAPSK
y.c N
Description: WLAN Security string for (TKIP/AES)
Value:
ra IDE
WPAPSK=
8~63 ASCII
Or
64 HEX characters
em F
og ON
2.1.22 DefaultKeyID
Description: Default key ID
Value:
DefaultKeyID=1
@ C
1~4
01 K
2.1.23 Key1Type
02 TE
0: Hexadecimal type
29 DI
1: ASCII type
E
2.1.24 Key1Str
Description: Key 1 string
FO M
Value:
Key1Str=
10 or 26 characters (key type=0)
5 or 13 characters (key type=1)
R
2.1.25 Key2Type
Description: Key 2 type
MediaTek Confidential © 2012 MediaTek Inc. Page 15 of 82
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
N
0: Hexadecimal type
1: ASCII type
US AL
EO
2.1.26 Key2Str
Description: Key 2 string
om TI
Value:
Key2Str=
10 or 26 characters (key type=0)
y.c N
5 or 13 characters (key type=1)
ra IDE
2.1.27 Key3Type
Description: Key 3 type
Value:
Key3Type=0
em F
og ON
0: Hexadecimal type
1: ASCII type
2.1.28 Key3Str
@ C
Key3Str=
10 or 26 characters (key type=0)
5 or 13 characters (key type=1)
02 TE
2.1.29 Key4Type
50 A
Key4Type=0
0: Hexadecimal type
E
1: ASCII type
FO M
2.1.30 Key4Str
Description: Key 4 string
Value:
Key4Str=
R
N
PSMode=CAM
US AL
EO
CAM Constantly Awake Mode
Max_PSP Max Power Saving
Fast_PSP Fast Power Saving
Legacy_PSP Legacy Power Saving
om TI
2.1.32 AutoRoaming
y.c N
Description: Enable or disable WLAN driver auto roaming between APs.
Value:
ra IDE
AutoRoaming=0
0: disable
1: enable
em F
2.1.33 RoamThreshold
og ON
2.1.34 APSDCapable
01 K
APSDCapable=0
0: disable
50 A
1: enable
29 DI
2.1.35 APSDAC
Description: Enable or disable APSD access control
E
Value:
APSDAC=0;0;0;0
FO M
0: disable
1: enable
2.1.36 FixedTxMode
R
CCK
N
OFDM
HT
US AL
EO
2.1.37 HT_RDG
om TI
Description: Enable or disable HT Reverse Direction Grant
Value:
HT_RDG=1
y.c N
0: disable
ra IDE
1: enable
2.1.38 HT_EXTCHA
Description: To locate the 40MHz channel in combination with the control
em F
Value:
HT_EXTCHA=0
og ON
0: Below
1: Above
@ C
2.1.39 HT_OpMode
01 K
HT_OpMode=0
0: HT mixed mode
1: HT Greenfield mode
50 A
29 DI
2.1.40 HT_MpduDensity
Description: Minimum separation of MPDUs in an A-MPDU
Value:
E
HT_MpduDensity=4
FO M
0~7
0: no restriction
1: 1/4 μs
2: 1/2 μs
3: 1 μs
4: 2 μs
R
5: 4 μs
6: 8 μs
7: 16 μs
MediaTek Confidential © 2012 MediaTek Inc. Page 18 of 82
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
N
Description: HT channel Bandwidth
US AL
Value:
EO
HT_BW=1
0: 20 MHz
om TI
1: 40 MHz
y.c N
2.1.42 HT_BADecline
Description: Enable or disable decline Block Ack to peer
ra IDE
Value:
HT_BADecline=0
0: disable
1: enable
em F
og ON
2.1.43 HT_AutoBA
Description: Enable or disable auto build Block Ack section with peer
Value:
@ C
HT_AutoBA=1
0: disable
01 K
1: enable
02 TE
2.1.44 HT_AMSDU
Description: Enable or disable AMSDU section
50 A
Value:
HT_AMSDU=0
29 DI
0: disable
1: enable
E
2.1.45 HT_BAWinSize
FO M
1~64
N
HT_GI=1
US AL
EO
0: Long guard interval
1: short guard interval
om TI
2.1.47 HT_MCS
y.c N
Description: WLAN Modulation and Coding Scheme (MCS)
Value:
ra IDE
HT_MCS=33
2.1.49 HT_DisallowTKIP
Description: Enable or disable 11N rate with 11N AP when cipher is TKIP or WEP
50 A
Value:
HT_DisallowTKIP=1
29 DI
0: disable
1: enable
E
FO M
2.1.50 HT_STBC
Description: Enable or disable HT STBC support
Value:
HT_STBC=0
R
0: disable
1: enable
N
Description: Enable or disable IEEE 802.11h function. Spectrum management.
US AL
This field can only be enabled in A band.
EO
Value:
IEEE80211H=0
om TI
0: disable
1: enable
y.c N
2.1.52 WirelessEvent
ra IDE
Description: Enable or disable driver to send Linux Wireless event support.
Value:
WirelessEvent=0
0: disable
em F
1: enable
og ON
2.1.53 CarrierDetect
Description: Enable or disable carrier detection
@ C
Value:
CarrierDetect=0
01 K
0: disable
1: enable
02 TE
2.1.54 AntDiversity
50 A
Description: Enable or disable antenna diversity (only 1x1 support, please confirm HW first)
Value:
29 DI
AntDiversity=0
0: disable
E
1: enable
FO M
2.1.55 BeaconLostTime
Description: Becon lost time = 4 seconds then disconnect with AP.
Value:
BeaconLostTime=4
R
1~60
N
PSP_XLINK_MODE=0
US AL
EO
0: disable
1: enable
om TI
2.1.57 WscManufacturer
Description: WPS manufacturer string
y.c N
Value:
WscManufacturer=
ra IDE
Less than 64 characters
2.1.58 WscModelName
em F
Description: WPS Mode name string
og ON
Value:
WscModelName=
2.1.59 WscDeviceName
01 K
WscDeviceName=
2.1.60 WscModelNumber
Description: WPS Device model number string
Value:
E
WscModelNumber=
FO M
2.1.61 WscSerialNumber
Description: WPS serial number string
R
Value:
WscSerialNumber=
N
2.1.62 RadioOn
US AL
EO
Description: Enable or disable RF
Value:
RadioOn=1
om TI
0: disable
1: enable
y.c N
ra IDE
2.1.63 Wsc4digitPinCode
Description: WPS 4 digit pin code string
Value:
Wsc4digitPinCode=0
em F
4 digit
og ON
@ C
01 K
02 TE
50 A
29 DI
E
FO M
R
N
Syntax is iwpriv ra0 set [parameters]=[Value]
US AL
EO
Note: Execute one iwpriv/set command at a time.
om TI
3.1 Debug
Description: config WLAN driver Debug level.
y.c N
Value:
iwpriv ra0 set Debug=3
ra IDE
0~5
0: Debug Off
1: Debug Error
2: Debug Warning
em F
3: Debug Trace
4: Debug Info
og ON
5: Debug Loud
3.2 DriverVersion
Description: Check driver version by iwpriv command. (Need to enable debug mode)
@ C
Value:
iwpriv ra0 set DriverVersion=0
01 K
Any value
02 TE
3.3 CountryRegion
50 A
Region Channels
E
0 1-11
1 1-13
FO M
2 10-11
3 10-13
4 14
5 1-14
R
6 3-9
7 5-13
N
US AL
EO
3.4 CountryRegionABand
Description: Set Country Region for 5G Hz WLAN regulation
Value:
om TI
iwpriv ra0 set CountryRegionABand=7
y.c N
Region Channels
0 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165
ra IDE
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
@ C
11 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 149, 153, 157, 161
01 K
3.5 SSID
02 TE
3.6 WirelessMode
E
N
11: 11N only in 5G band only
14: 11A/AN/AC mixed 5G band only (Only 11AC chipset support)
US AL
EO
3.7 TxBurst
om TI
Description: Enable or disable Tx Burst
Value:
iwpriv ra0 set TxBurst=1
y.c N
0: disable
ra IDE
1: enable
3.8 TxPreamble
Description: Enable or disable Tx Preamle
Value:
em F
iwpriv ra0 set TxPreamble=0
og ON
0: disable
1: enable
@ C
3.9 TxPower
Description: Set Transmit Power by percentage
01 K
Value:
iwpriv ra0 set TxPower=100
02 TE
0~100
50 A
3.10 Channel
29 DI
3.11 BGProtection
Description: Enable or disable 11B, 11G protection
R
Value:
iwpriv ra0 set BGProtection=0
N
3.12 RTSThreshold
US AL
EO
Description: Set RTS Threshold
Value:
iwpriv ra0 set RTSThreshold=2347
om TI
1~2347
y.c N
3.13 FragThreshold
ra IDE
Description: Set Fragment threshold
Value:
iwpriv ra0 set FragThreshold=2346
em F
256~2346
og ON
3.14 HtBw
Description: Set HT WLAN Bandwidth
Value:
@ C
0: 20 MHz
1: 40MHz
02 TE
3.15 HtMcs
Description: Set WLAN Modulation and Coding Scheme (MCS)
50 A
Value:
iwpriv ra0 set HtMcs=33
29 DI
3.16 HtGi
Description: Set WLAN Guard interval support
Value:
iwpriv ra0 set HtGi=1
R
N
Value:
iwpriv ra0 set HtOpMode=0
US AL
EO
0: HT mixed mode
1: HT Greenfield mode
om TI
3.18 HtStbc
y.c N
Description: Enable or disable HT STBC
Value:
ra IDE
iwpriv ra0 set HtStbc=1
0: disable
1: enable
em F
3.19 HtExtcha
og ON
0: below
1: Above
01 K
3.20 HtMpduDensity
02 TE
0~7
0: no restriction
29 DI
1: 1/4 μs
2: 1/2 μs
3: 1 μs
4: 2 μs
E
5: 4 μs
6: 8 μs
FO M
7: 16 μs
3.21 HtBaWinSize
Description: Block Ack window size
R
Value:
iwpriv ra0 set HtBaWinSize=64
N
3.22 HtRdg
US AL
EO
Description: Enable or disable HT Reverse Direction Grant
Value:
iwpriv ra0 set HtRdg=1
om TI
0: disable
1: enable
y.c N
ra IDE
3.23 HtAmsdu
Description: Enable or disable AMSDU section
Value:
Iwpriv ra0 set HtAmsdu=0
em F
0: disable
og ON
1: enable
3.24 HtAutoBa
@ C
Description: Enable or disable auto build Block Ack section with peer
Value:
01 K
0: disable
02 TE
1: enable
50 A
3.25 HtBaDecline
Description: Enable or disable decline Block Ack to peer
29 DI
Value:
iwpriv ra0 set HtBaDecline=0
E
0: disable
1: enable
FO M
3.26 HtProtect
Description: Enable or disable HT protect
R
Value:
iwpriv ra0 set HtProtect=0
N
3.27 HtMimoPs
US AL
EO
Description: Enable or disable HT MIMO Power saving mode
Value:
iwpriv ra0 set HtMimoPs=0
om TI
0: disable
1: enable
y.c N
ra IDE
3.28 HtDisallowTKIP
Description: Enable or disable 11N rate with 11N AP when cipher is TKIP or WEP
Value:
iwpriv ra0 set HtDisallowTKIP=0
em F
0: disable
og ON
1: enable
3.29 HtBssCoex
@ C
0: disable
02 TE
1: enable
50 A
3.30 PktAggregate
Description: Enable or disable 11B/G packet aggregation
29 DI
Value:
iwpriv ra0 set PktAggregate=1
E
0: disable
1: enable
FO M
3.31 WmmCapable
Description: Enable or disable WMM support
R
Value:
iwpriv ra0 set WmmCapable=1
N
3.32 IEEE80211H
US AL
EO
Description: Enable or disable IEEE 802.11h function. Spectrum management.
This field can only be enabled in A band.
Value:
om TI
iwpriv ra0 set IEEE80211H=0
0: disable
y.c N
1: enable
ra IDE
3.33 NetworkType
Description: Network type
Value:
em F
iwpriv ra0 set NetworkType=Infra
og ON
3.34 AuthMode
@ C
3.35 EncrypType
E
Value:
iwpriv ra0 set EncrypType=NONE
N
Value:
iwpriv ra0 set DefaultKeyID=1
US AL
EO
1~4
om TI
3.37 Key1
Description: Key 1 string
y.c N
Value:
iwpriv ra0 set Key1=aaaaa
ra IDE
10 or 26 characters
5 or 13 characters
3.38 Key2
em F
Description: Key 2 string
og ON
Value:
iwpriv ra0 set Key2=aaaaa
10 or 26 characters
@ C
5 or 13 characters
01 K
3.39 Key3
Description: Key 3 string
02 TE
Value:
iwpriv ra0 set Key3=aaaaa
50 A
10 or 26 characters
5 or 13 characters
29 DI
3.40 Key4
E
10 or 26 characters
5 or 13 characters
R
3.41 WPAPSK
Description: WLAN Security string for (TKIP/AES)
MediaTek Confidential © 2012 MediaTek Inc. Page 32 of 82
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
N
8~63 ASCII
Or
US AL
64 HEX characters
EO
3.42 ResetCounter
om TI
Description: reset WLAN statistic counter
Value:
iwpriv ra0 set ResetCounter=1
y.c N
1
3.43
ra IDE
PSMode
Description: WLAN Power Saving mode
em F
Value:
iwpriv ra0 set PSMode=CAM
og ON
3.44 FixedTXMode
01 K
Value:
iwpriv ra0 set FixedTxMode=ofdm
CCK/cck
50 A
OFDM/ofdm
HT/ht
29 DI
3.45 BeaconLostTime
E
1~60
R
3.46 AutoRoaming
Description: Enable or disable auto roaming
N
0: disable
1: enable
US AL
EO
3.47 SiteSurvey
om TI
Description: Scan with specific SSID after link up
Value:
iwpriv ra0 set SiteSurvey=XXX
y.c N
0~z, 1~32 ACSII characters
ra IDE
3.48 AutoReconnect
Description: Enable or disable auto reconnect
em F
Value:
iwpriv ra0 set AutoReconnect=0
og ON
0: disable
1: enable
@ C
3.49 AdhocN
01 K
0: disable
1: enable
50 A
29 DI
E
FO M
R
N
This section describes parameters set using iwpriv. Please refer to the Readme section for more
US AL
general data.
EO
A detailed explanation of each parameter for iwpriv is shown subsequently. Refer to the Readme
before using this section.
om TI
4.1 connStatus
y.c N
Description: Show WLAN connection status
ra IDE
Value:
iwpriv ra0 connStatus
4.2 driverVer
em F
Description: Show WLAN driver version
og ON
Value:
iwpriv ra0 driverVer
4.3 bainfo
@ C
4.4 rxbulk
Description: Show STA current rxbluk information
50 A
Value:
iwpriv ra0 rxbulk
29 DI
4.5 txbulk
E
Value:
iwpriv ra0 txbulk
4.6 radio_off
R
N
4.7 radio_on
US AL
Description: Turn on Radio
EO
Value:
iwpriv ra0 radio_on
om TI
4.8 get_site_survey
y.c N
Description: get site survey result
Value:
ra IDE
iwpriv ra0 get_site_survey
4.9 stat
Description: Display WLAN static counter
em F
Value:
iwpriv ra0 stat
og ON
//Write bbp
iwpriv ra0 bbp offset=value
Value:
//Display
FO M
//Write mac
iwpriv ra0 mac offset=value
R
N
Value:
//Display
US AL
EO
iwpriv ra0 rf offset
//Write
iwpriv ra0 rf offset=value
om TI
offset = hex address
value= hex value
y.c N
ra IDE
4.13 e2p (Debug only)
Description: Display/Write EEPROM content
Value:
//Display
em F
iwpriv ra0 e2p offset
og ON
//Write EEPROM
iwpriv ra0 e2p offset=value
N
This section describes parameters set using iwpriv. Please refer to the Readme section for more
US AL
general data.
EO
Display parameter which has been currently configured in the WLAN driver.
om TI
[Parameters list]
SSID
WirelessMode
y.c N
TxBurst
TxPreamble
ra IDE
TxPower
Channel
BGProtection
RTSThreshold
FragThreshold
em F
HtBw
og ON
HtMcs
HtGi
HtOpMode
HtExtcha
HtMpduDensity
@ C
HtBaWinSize
HtRdg
01 K
HtAmsdu
HtAutoBa
CountryRegion
02 TE
CountryRegionABand
CountryCode
PktAggregate
50 A
WmmCapable
IEEE80211H
29 DI
NetworkType
WpsApBand
AuthMode
E
EncrypType
DefaultKeyID
FO M
Key1
Key2
Key3
Key4
WPAPSK
R
N
6.1 Infrastructure Security Mode
US AL
EO
WLAN infrastructure Security mode to connect with AP by iwpriv command.
Command sequence must be exact.
om TI
6.1.1 OPEN/NONE
Config STA to link with AP which is OPEN/NONE(Authentication/Encryption)
AP’s SSID string= XXXX
y.c N
iwpriv ra0 set NetworkType=Infra
ra IDE
iwpriv ra0 set AuthMode=OPEN
iwpriv ra0 set EncrypType=NONE
iwpriv ra0 set SSID=”XXXXX”
6.1.2 SHARED/WEP
em F
Config STA to link with AP which is SHARED/WEP(Authentication/Encryption)
AP’s SSID string= XXXX, WEP key=12345
og ON
6.1.3 WPAPSK/TKIP
02 TE
6.1.4 WPAPSK/AES
FO M
N
iwpriv ra0 set NetworkType=Infra
US AL
EO
iwpriv ra0 set AuthMode=WPA2PSK
iwpriv ra0 set EncrypType=TKIP
iwpriv ra0 set SSID=”XXXX”
iwpriv ra0 set WPAPSK=12345678
iwpriv ra0 set SSID="XXXX”
om TI
6.2 Ad-hoc mode
y.c N
WLAN adhoc Security mode to connect with Peer by iwpriv command.
ra IDE
Command sequence must be exact.
6.2.1 OPEN/NONE
Config STA to create/link as adhoc mode, which is OPEN/NONE(Authentication/Encryption)
SSID=XXXX
em F
iwpriv ra0 set NetworkType=Adhoc
og ON
6.2.2 WPANONE/TKIP
Config STA to create/link as adhoc mode, which is WPANONE/TKIP(Authentication/Encryption)
01 K
SSID=XXXX, WPAPSK=12345678
iwlist ra0 sc
FO M
N
6.5 To Link with AP
US AL
iwpriv ra0 set SSID=”AP’s SSID” //Specific AP
EO
or
om TI
iwpriv ra0 set SSID=”” //Any SSID with OPEN/NONE security
y.c N
ra IDE
em F
og ON
@ C
01 K
02 TE
50 A
29 DI
E
FO M
R
N
Simple Config Architectural Overview
US AL
This section presents a high-level description of the Simple Config architecture. Much of the material
EO
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.
om TI
The Enrollee is a device seeking to join a WLAN domain. Once an Enrollee obtains a valid
credential, it becomes a member.
y.c N
A Registrar is an entity with the authority to issue and revoke domain credentials. A registrar can
be integrated into an AP.
ra IDE
The AP can be either a WLAN AP or a wireless router.
em F
og ON
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).
@ C
Note: The WLAN driver needs to set HAS_WSC=y in order to enable WPS functions.
01 K
This section describes parameters set using iwpriv. Please refer to the Readme section for more
general data.
7.1.1 wsc_conf_mode
E
0: WPS Disabled
1: Enrollee
2: Registrar
R
N
iwpriv ra0 wsc_mode 1
US AL
EO
1: PIN Mode
2: PBC Mode
om TI
7.1.3 wsc_pin
Description: set WPS pin code
y.c N
Value:
iwpriv ra0 wsc_pin xxxxxxxx
ra IDE
xxxxxxx = {00000000 ~ 99999999}
7.1.4 wsc_ssid
em F
Description: set WPS AP SSID
og ON
Value:
iwpriv ra0 wsc_ssid xxxxxxx
7.1.5 wsc_bssid
01 K
xx:xx:xx:xx:xx:xx BSSID
50 A
29 DI
7.1.6 wsc_start
Description: Trigger WLAN driver to do WPS process
Value:
E
7.1.7 wsc_stop
Description: Stop WLAN driver to do WPS process
Value:
iwpriv ra0 wsc_stop
R
N
iwpriv ra0 wsc_gen_pincode
US AL
EO
7.1.9 wsc_cred_count
Description: Set count of WPS credential, only support one credential for M8 in Registrar mode.
Value:
om TI
iwpriv ra0 wsc_cred_count 1
1~8
y.c N
ra IDE
7.1.10 wsc_cred_ssid
Description: Set SSID into credtentail[idx].
Value:
iwpriv ra0 wsc_cred_ssid “idx ssid_str”
em F
idx: 0 ~ 7
og ON
Example:
iwpriv ra0 wsc_cred_ssid "0 wps_ap1"
@ C
7.1.11 wsc_cred_auth
01 K
Example:
iwpriv ra0 wsc_cred_auth "0 WPAPSK"
29 DI
7.1.12 wsc_cred_encr
E
idx: 0 ~ 7
encr_str: NONE, WEP, TKIP, AES
R
Example:
iwpriv ra0 wsc_cred_encr "0 TKIP"
N
iwpriv ra0 wsc_cred_keyid “idx key_index”
US AL
EO
idx: 0 ~ 7
key_index: 1 ~ 4
Example:
om TI
iwpriv ra0 wsc_cred_keyIdx "0 1"
y.c N
7.1.14 wsc_cred_key
ra IDE
Description: Set Key into credtentail[idx].
Value:
iwpriv ra0 wsc_cred_key “idx key”
idx: 0 ~ 7
key: ASCII string (wep_key_len(=5,13), passphrase_len(=8~63))
em F
OR
Hex string (wep_key_len(=10,26), passphrase_len(=64))
og ON
Example:
iwpriv ra0 wsc_cred_key "0 12345678" ;; Passphrase
iwpriv ra0 wsc_cred_key "0 abcd" ;; WEP Key
@ C
7.1.15 wsc_cred_mac
01 K
idx: 0 ~ 7
mac_str: xx:xx:xx:xx:xx:xx
50 A
Example:
29 DI
7.1.16 wsc_conn_by_idx
FO M
0~7
R
N
iwpriv ra0 wsc_auto_conn 1
US AL
EO
0: disabled, driver won't re-connect to AP with new configurations.
1: enabled, driver will re-connect to AP with new configurations.
om TI
7.1.18 wsc_ap_band
Description: Setting prefer band to do WPS with dual band WPS AP.
y.c N
Value:
iwpriv ra0 wsc_ap_band 2
ra IDE
0: Prefer 2.4G
1: Prefer 5G
2: Auto (default)
em F
7.1.19 Wsc4digitPinCode
og ON
0: disable
1: enable
01 K
Note: 'EAP' indicates to use wireless medium and 'UPnP' indicates to use wired or wireless
medium.
Enter the Enrollee PinCode on the Registrar and start WPS on the Registrar.
R
Note: How to get the Enrollee PinCode? Use 'iwpriv ra0 stat' on the Enrollee.
N
iwpriv ra0 wsc_start
US AL
EO
(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.
om TI
Running Scenarios (case 'a' only)
y.c N
a. Adding an Enrollee to AP+Registrar (EAP)
[AP+Registrar]<----EAP--->[Client]
ra IDE
(i) [AP+Registrar]
(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.
@ C
(i) [AP]
Start PIN on the Enrollee WPS AP.
In case 'a':
The Registrar will be re-configured with the new parameters, and will connect to the AP with
these new parameters;
MediaTek Confidential © 2012 MediaTek Inc. Page 47 of 82
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
N
US AL
7.3.2 PBC Mode
EO
Running Scenarios (case 'a' and 'b')
a. Configure the un-configured AP
[Unconfigured AP]<----EAP--->[Registrar]
om TI
b. Configure the configured AP
Configured AP]<----EAP--->[Registrar]
y.c N
(i) [AP]
ra IDE
Start PBC on the Enrollee WPS AP.
In case 'a':
The Registrar will be re-configured with the new parameters, and will connect to the AP with
these new parameters;
@ C
In case 'b':
The Registrar will be re-configured with AP's configurations, and will connect to the AP with
these new parameters.
01 K
02 TE
iwpriv command:
29 DI
OID:
FO M
Example:
memset(&lwreq, 0, sizeof(lwreq));
sprintf(lwreq.ifr_name, "ra0", 3);
iwreq.u.mode = WSC_STOP;
/* Perform the private ioctl */
if(ioctl(skfd, RTPRIV_IOCTL_SET_WSC_PROFILE_U32_ITEM, &lwreq) < 0)
R
{
fprintf(stderr, "Interface doesn't accept private ioctl...\n");
N
iwpriv ra0 wsc_cred_count 1
US AL
EO
iwpriv ra0 wsc_conn_by_idx 1
iwpriv ra0 wsc_auto_conn 1
iwpriv ra0 wsc_conf_mode 1
iwpriv ra0 wsc_mode 1
iwpriv ra0 wsc_pin 12345678
om TI
OID:
y.c N
Example:
ra IDE
memset(&lwreq, 0, sizeof(lwreq));
lwreq.u.data.length = 1;
cred_count = 1;
((int *) buffer)[i] = (int) cred_count;
offset = sizeof(int);
sprintf(lwreq.ifr_name, "ra0", 3);
lwreq.u.mode = WSC_CREDENTIAL_COUNT;
em F
memcpy(lwreq.u.name + offset, buffer, IFNAMSIZ - offset);
/* Perform the private ioctl */
og ON
iwpriv command:
02 TE
OID:
E
Example:
FO M
memset(&lwreq, 0, sizeof(lwreq));
memset(buffer, 0, 2048);
sprintf(lwreq.ifr_name, "ra0", 3);
sprintf(buffer, "0 wps_ssid_1");
lwreq.u.data.length = strlen(buffer) + 1;
lwreq.u.data.pointer = (caddr_t) buffer;
R
lwreq.u.data.flags = WSC_CREDENTIAL_SSID;
/* Perform the private ioctl */
if(ioctl(skfd, RTPRIV_IOCTL_SET_WSC_PROFILE_STRING_ITEM, &lwreq) < 0)
{
N
7.5 WPS OID Sample Program
US AL
EO
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
om TI
#include <assert.h>
#include <netinet/in.h> /* for sockaddr_in */
#include <fcntl.h>
#include <time.h>
#include <sys/times.h>
y.c N
#include <unistd.h>
#include <sys/socket.h> /* for connect and socket*/
#include <sys/stat.h>
ra IDE
#include <err.h>
#include <errno.h>
#include <asm/types.h>
#include </usr/include/linux/wireless.h>
#include <sys/ioctl.h>
#define IFNAMSIZ 16
em F
#define RTPRIV_IOCTL_SET_WSC_PROFILE_U32_ITEM (SIOCIWFIRSTPRIV + 0x14)
#define RTPRIV_IOCTL_SET_WSC_PROFILE_STRING_ITEM (SIOCIWFIRSTPRIV + 0x16)
og ON
enum {
WSC_CREDENTIAL_COUNT = 1,
WSC_CREDENTIAL_SSID = 2,
WSC_CREDENTIAL_AUTH_MODE = 3,
WSC_CREDENTIAL_ENCR_TYPE = 4,
WSC_CREDENTIAL_KEY_INDEX = 5,
@ C
WSC_CREDENTIAL_KEY = 6,
WSC_CREDENTIAL_MAC = 7,
WSC_SET_DRIVER_CONNECT_BY_CREDENTIAL_IDX = 8,
WSC_SET_DRIVER_AUTO_CONNECT = 9,
01 K
WSC_SET_SSID = 13,
WSC_START = 14,
WSC_STOP = 15,
WSC_GEN_PIN_CODE = 16,
};
50 A
int main()
{
struct iwreq lwreq;
29 DI
{
fprintf(stderr, "Interface doesn't accept private ioctl...\n");
return -1;
}
///////////////////////////////////
MediaTek Confidential © 2012 MediaTek Inc. Page 50 of 82
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
N
((int *) buffer)[i] = (int) cred_count;
offset = sizeof(int);
US AL
EO
sprintf(lwreq.ifr_name, "ra0", 3);
lwreq.u.mode = WSC_CREDENTIAL_COUNT;
memcpy(lwreq.u.name + offset, buffer, IFNAMSIZ - offset);
om TI
{
fprintf(stderr, "Interface doesn't accept private ioctl...\n");
return -1;
}
y.c N
///////////////////////////////////
ra IDE
memset(&lwreq, 0, sizeof(lwreq));
memset(buffer, 0, 2048);
sprintf(lwreq.ifr_name, "ra0", 3);
sprintf(buffer, "0 wps_ssid_1");
lwreq.u.data.length = strlen(buffer) + 1;
lwreq.u.data.pointer = (caddr_t) buffer;
lwreq.u.data.flags = WSC_CREDENTIAL_SSID;
em F
/* Perform the private ioctl */
if(ioctl(skfd, RTPRIV_IOCTL_SET_WSC_PROFILE_STRING_ITEM, &lwreq) < 0)
{
og ON
close(skfd);
@ C
return 0;
}
01 K
02 TE
50 A
29 DI
E
FO M
R
N
Wifi direct feature makes direct connections to one another quickly and conveniently to do things like print,
US AL
EO
sync, and share content even when an access point or router is unavailable.
om TI
y.c N
ra IDE
em F
og ON
@ C
01 K
8.1.1 P2pOpMode
Description: Set P2P Operation Mode
E
Value:
iwpriv p2p0 set P2pOpMode=1
FO M
0: Device mode
1: Autonomous GO
R
N
iwpriv p2p0 set p2pEnable=1
US AL
EO
0: disable
1: enable
om TI
8.1.3 p2pScan
Description: Start P2P scanning
Value:
y.c N
iwpriv p2p0 set p2pScan=1
ra IDE
0:disable
1:enable
8.1.4 p2pTable
em F
Description: Display p2p scan table in WLAN driver log.
og ON
Value:
iwpriv p2p0 set p2pTable=1
0: disable
@ C
1: enable
01 K
8.1.5 p2pGoInt
Description: set P2P GO intent value
02 TE
Value:
iwpriv p2p0 set p2pGoInt=0
50 A
0~15
29 DI
8.1.6 p2pDevName
Description: set p2p device name
E
Value:
iwpriv p2p0 set p2pDevName=Direct-P2P0
FO M
8.1.7 p2pWscMode
R
1: PIN
N
2: PBC
US AL
EO
8.1.8 p2pWscConf
Description: Set WPS conf method for P2P negotiate
om TI
Value:
iwpriv p2p0 set p2pWscConf=1
y.c N
1: Display
2: KeyPad
ra IDE
3: PBC
8.1.9 p2pLisCh
Description: Set P2P listen Channel
em F
Value:
iwpriv p2p0 set p2pLisCh=1
og ON
1,6,11
@ C
8.1.10 p2pOpCh
Description: Set P2P Operation Channel
01 K
Value:
Depending on country region setting.
02 TE
8.1.11 p2pLink
Description: Set P2P device ID to do GO negotiation
29 DI
Value:
iwpriv p2p0 set p2pLink=1
E
0~29
FO M
8.1.12 p2pInv
Description: Select P2P device ID to Invite
Value:
R
0~29
N
Description: Select P2P device ID to provision
US AL
Value:
EO
iwpriv p2p0 set p2pProv=1
0~29
om TI
8.1.14 p2pCfg
y.c N
Description: Dump out P2P configuration
Value:
ra IDE
iwpriv p2p0 set p2pCfg=1
1
em F
8.1.15 p2pStat
og ON
1
01 K
8.1.16 p2pReset
Description: Reset P2P configuration
02 TE
Value:
iwpriv p2p0 set p2pReset=1
50 A
1
29 DI
8.1.17 p2pDefConfMthd
Description: Set default WPS Config Method to Provision
E
Value:
iwpriv p2p0 set p2pDefConfMthd=3
FO M
1: Display
2: KeyPad
3: PBC
R
8.1.18 p2pDevDisc
Description: Select P2P Device ID for discovery
MediaTek Confidential © 2012 MediaTek Inc. Page 55 of 82
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
N
0~29
US AL
EO
8.1.19 p2pLinkDown
om TI
Description: Disconnect P2P session and turn back to listen state
Value:
iwpriv p2p0 set p2pLinkDown=1
y.c N
1
ra IDE
8.2 P2P Example iwpriv command
# interface init
ifconfig p2p0 down
ifconfig ra0 down
ifconfig ra0 up
iwpriv ra0 set Debug=3
@ C
ifconfig p2p0 up
01 K
# p2p init
iwpriv p2p0 set p2pLinkDown=1
02 TE
N
# p2p init
iwpriv p2p0 set p2pLinkDown=1
US AL
EO
iwpriv p2p0 set p2pReset=1
om TI
iwpriv p2p0 set p2pWscConf=3
iwpriv p2p0 set p2pGoInt=15
y.c N
# p2p scan and link
iwpriv p2p0 set p2pScan=1
ra IDE
sleep 25
iwpriv p2p0 set p2pLink=0
# set p2p ip
ifconfig p2p0 10.10.10.6
em F
og ON
ifconfig p2p0 up
02 TE
# p2p init
iwpriv p2p0 set p2pLinkDown=1
iwpriv p2p0 set p2pReset=1
50 A
# set p2p ip
ifconfig p2p0 10.10.10.222
FO M
# interface init
R
N
# p2p init
US AL
EO
iwpriv p2p0 set p2pLinkDown=1
iwpriv p2p0 set p2pReset=1
om TI
iwpriv p2p0 set p2pWscConf=2
iwpriv p2p0 set p2pGoInt=15
iwpriv p2p0 set p2pEnterPIN=32240979 #Read enrollee PIN code
y.c N
# p2p scan and link
ra IDE
iwpriv p2p0 set p2pScan=1
sleep 25
iwpriv p2p0 set p2pLink=0
# set p2p ip
em F
ifconfig p2p0 10.10.10.6
og ON
# interface init
ifconfig p2p0 down
ifconfig ra0 down
01 K
ifconfig ra0 up
iwpriv ra0 set Debug=3
02 TE
ifconfig p2p0 up
# p2p init
iwpriv p2p0 set p2pLinkDown=1
50 A
# waiting....Win7 (GO)
# Check Win7 PIN code and Set PIN
iwpriv p2p0 set p2pEnterPIN=32240979
R
N
iwpriv ra0 set Debug=3
ifconfig p2p0 up
US AL
EO
# p2p init
iwpriv p2p0 set p2pLinkDown=1
iwpriv p2p0 set p2pReset=1
om TI
# p2p PBC dev WPS
iwpriv p2p0 set p2pWscMode=2
y.c N
iwpriv p2p0 set p2pWscConf=3
iwpriv p2p0 set p2pGoInt=0
ra IDE
iwpriv p2p0 set p2pScan=1
# set p2p ip
ifconfig p2p0 10.10.10.22
em F
og ON
@ C
01 K
02 TE
50 A
29 DI
E
FO M
R
N
Please refer to WLAN driver source code include/oid.h for OID data structure.
US AL
EO
9.1 OID Set Data
om TI
Command and IOCTL Function
Set Data
y.c N
Function Type Command IOCTL
RTPRIV_IOCTL_SET Iwpriv ra0 set sprintf(name, "ra0");
SSID=RT3572AP strcpy(data, "SSID=RT3572AP”);
ra IDE
strcpy(wrq.ifr_name, name);
wrq.u.data.length = strlen(data);
wrq.u.data.pointer = data;
wrq.u.data.flags = 0;
ioctl(socket_id, RTPRIV_IOCTL_SET, &wrq);
em F
9.2 OID Get Data
og ON
wrq.u.data.pointer = data;
wrq.u.data.flags = 0;
ioctl(socket_id, RTPRIV_IOCTL_STATISTICS,
&wrq);
02 TE
wrq.u.data.flags = 0;
ioctl(socket_id,
RTPRIV_IOCTL_GSITESURVEY, &wrq);
29 DI
IOCTL Function
FO M
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_OID_802_11_COUNTRY_REGION;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
OID_802_11_BSSID_LIST_SCAN sprintf(name, "ra0");
N
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
OID_802_11_SSID sprintf(name, "ra0");
strcpy(wrq.ifr_name, name);
US AL
EO
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;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
om TI
OID_802_11_BSSID sprintf(name, "ra0");
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;
y.c N
wrq.u.data.flags = OID_802_11_BSSID;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
RT_OID_802_11_RADIO sprintf(name, "ra0");
ra IDE
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_802_11_RADIO;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
RT_OID_802_11_PHY_MODE sprintf(name, "ra0");
em F
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(RT_802_11_PHY_MODE));
wrq.u.data.length = sizeof(RT_802_11_PHY_MODE);
og ON
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_OID_802_11_PHY_MODE;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
RT_OID_802_11_STA_CONFIG sprintf(name, "ra0");
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(RT_802_11_STA_CONFIG));
@ C
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;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
01 K
wrq.u.data.length = sizeof(NDIS_802_11_RATES);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_DESIRED_RATES;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
RT_OID_802_11_PREAMBLE sprintf(name, "ra0");
50 A
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(RT_802_11_PREAMBLE));
wrq.u.data.length = sizeof(RT_802_11_PREAMBLE);
29 DI
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_OID_802_11_PREAMBLE;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
OID_802_11_WEP_STATUS printf(name, "ra0");
strcpy(wrq.ifr_name, name);
E
memset(data, 0, sizeof(NDIS_802_11_WEP_STATUS));
wrq.u.data.length = sizeof(NDIS_802_11_WEP_STATUS);
wrq.u.data.pointer = data;
FO M
wrq.u.data.flags = OID_802_11_WEP_STATUS;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
OID_802_11_AUTHENTICATION_MODE printf(name, "ra0");
strcpy(wrq.ifr_name, name);
memset(data, 0,
sizeof(NDIS_802_11_AUTHENTICATION_MODE));
wrq.u.data.length =
R
sizeof(NDIS_802_11_AUTHENTICATION_MODE);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_AUTHENTICATION_MODE;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
N
wrq.u.data.length =
sizeof(NDIS_802_11_NETWORK_INFRASTRUCTURE);
wrq.u.data.pointer = data;
US AL
wrq.u.data.flags = OID_802_11_INFRASTRUCTURE_MODE;
EO
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
OID_802_11_REMOVE_WEP printf(name, "ra0");
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(NDIS_802_11_KEY_INDEX));
wrq.u.data.length = sizeof(NDIS_802_11_KEY_INDEX);
om TI
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_REMOVE_WEP;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
RT_OID_802_11_RESET_COUNTERS printf(name, "ra0");
y.c N
strcpy(wrq.ifr_name, name);
wrq.u.data.length = 0;
wrq.u.data.pointer = data;
ra IDE
wrq.u.data.flags = RT_OID_802_11_RESET_COUNTERS;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
OID_802_11_RTS_THRESHOLD printf(name, "ra0");
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;
em F
wrq.u.data.flags = OID_802_11_RTS_THRESHOLD;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
OID_802_11_FRAGMENTATION_THRESHOLD printf(name, "ra0");
og ON
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;
@ C
wrq.u.data.flags =
OID_802_11_FRAGMENTATION_THRESHOLD;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
OID_802_11_POWER_MODE printf(name, "ra0");
01 K
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(NDIS_802_11_POWER_MODE));
wrq.u.data.length = sizeof(NDIS_802_11_POWER_MODE);
02 TE
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_POWER_MODE;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
OID_802_11_TX_POWER_LEVEL printf(name, "ra0");
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(NDIS_802_11_TX_POWER_LEVEL));
50 A
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;
29 DI
wrq.u.data.length = sizeof(ULONG);
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_OID_802_11_TX_POWER_LEVEL_1;
FO M
N
OID_802_11_TX_ANTENNA_SELECTED printf(name, "ra0");
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(NDIS_802_11_ANTENNA));
US AL
EO
wrq.u.data.length = sizeof(NDIS_802_11_ANTENNA);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_TX_ANTENNA_SELECTED;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
RT_OID_802_11_ADD_WPA printf(name, "ra0");
om TI
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;
y.c N
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
OID_802_11_REMOVE_KEY printf(name, "ra0");
strcpy(wrq.ifr_name, name);
ra IDE
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;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
OID_802_11_ADD_KEY printf(name, "ra0");
strcpy(wrq.ifr_name, name);
em F
memset(data, 0, keylength); //5,10,13,26
wrq.u.data.length = keylength L;
wrq.u.data.pointer = data;
og ON
wrq.u.data.flags = OID_802_11_ADD_KEY;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
OID_802_11_SET_IEEE8021X printf(name, "ra0");
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(BOOLEAN));
wrq.u.data.length = sizeof(BOOLEAN);
@ C
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_SET_IEEE8021X;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
01 K
wrq.u.data.pointer = data;
wrq.u.data.flags =
OID_802_11_SET_IEEE8021X_REQUIRE_KEY;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
OID_802_11_ADD_WEP printf(name, "ra0");
50 A
strcpy(wrq.ifr_name, name);
memset(data, 0, keylength); //5,10,13,26
wrq.u.data.length = keylength;
29 DI
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_OID_802_11_RADIO;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
OID_802_11_CONFIGURATION printf(name, "ra0");
strcpy(wrq.ifr_name, name);
E
memset(data, 0, sizeof(NDIS_802_11_CONFIGURATION));
wrq.u.data.length = sizeof(NDIS_802_11_CONFIGURATION);
wrq.u.data.pointer = data;
FO M
wrq.u.data.flags = OID_802_11_CONFIGURATION;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
OID_SET_COUNTERMEASURES printf(name, "ra0");
strcpy(wrq.ifr_name, name);
wrq.u.data.length = 0;
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_SET_COUNTERMEASURES;
R
N
strcpy(wrq.ifr_name, name);
wrq.u.data.length = keylength; //follow your setting
wrq.u.data.pointer = data;
US AL
EO
wrq.u.data.flags = OID_802_11_PMKID;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
RT_OID_WPA_SUPPLICANT_SUPPORT printf(name, "ra0");
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(BOOLEAN));
om TI
wrq.u.data.length = sizeof(BOOLEAN);
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_OID_WPA_SUPPLICANT_SUPPORT;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
y.c N
RT_OID_WPA_SUPPLICANT_SUPPORT printf(name, "ra0");
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(ULONG));
wrq.u.data.length = sizeof(ULONG);
ra IDE
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_OID_WPA_SUPPLICANT_SUPPORT;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
RT_SET_DEL_MAC_ENTRY sprintf(name, "ra0");
strcpy(wrq.ifr_name, name);
memset(data, 0xdd, 6);
strcpy(wrq.ifr_name, name);
em F
wrq.u.data.length = 6;
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_SET_DEL_MAC_ENTRY;
og ON
UCHAR BW;
UCHAR STBC;
UCHAR SHORTGI;
UCHAR rsv;
02 TE
} OID_SET_HT_PHYMODE ;
RT_802_11_PHY_MODE tmp_ht_mode;
sprintf(wrq.ifr_name, "ra0");
wrq.u.data.pointer = (caddr_t) & tmp_ht_mode;
wrq.u.data.length = sizeof(RT_802_11_PHY_MODE);
50 A
wrq.u.data.flags = RT_OID_802_11_SET_HT_PHYMODE |
OID_GET_SET_TOGGLE;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
29 DI
IOCTL Function
E
UCHAR BW;
UCHAR STBC;
UCHAR SHORTGI;
UCHAR rsv;
RT_802_11_PHY_MODE tmp_ht_mode;
sprintf(wrq.ifr_name, "ra0");
N
wrq.u.data.pointer = (caddr_t) & tmp_ht_mode;
wrq.u.data.length = sizeof(RT_802_11_PHY_MODE);
wrq.u.data.flags = RT_OID_802_11_SET_HT_PHYMODE |
US AL
OID_GET_SET_TOGGLE;
EO
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
om TI
IOCTL Function
y.c N
Get Raw Data by I/O Control Interface with Flags
Function Type IOCTL
ra IDE
RT_OID_DEVICE_NAME sprintf(name, "ra0");
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;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
em F
RT_OID_VERSION_INFO sprintf(name, "ra0");
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(RT_VERSION_INFO));
og ON
wrq.u.data.length = sizeof(RT_VERSION_INFO);
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_OID_VERSION_INFO;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
OID_802_11_BSSID_LIST sprintf(name, "ra0");
strcpy(wrq.ifr_name, name);
@ C
memset(data, 0, BssLen);
wrq.u.data.length = BssLen;
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_BSSID_LIST;
01 K
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;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
OID_GEN_MEDIA_CONNECT_STATUS sprintf(name, "ra0");
50 A
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(NDIS_MEDIA_STATE));
wrq.u.data.length = sizeof(NDIS_MEDIA_STATE);
29 DI
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_GEN_MEDIA_CONNECT_STATUS;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
OID_802_11_BSSID sprintf(name, "ra0");
E
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(NDIS_802_11_MAC_ADDRESS));
wrq.u.data.length = sizeof(NDIS_802_11_MAC_ADDRESS);
FO M
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_BSSID;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
OID_802_11_SSID sprintf(name, "ra0");
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;
R
wrq.u.data.flags = OID_802_11_SSID;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
RT_OID_802_11_QUERY_LINK_STATUS sprintf(name, "ra0");
N
wrq.u.data.flags = RT_OID_802_11_QUERY_LINK_STATUS;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
OID_802_11_CONFIGURATION sprintf(name, "ra0");
US AL
EO
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;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
om TI
OID_802_11_RSSI_TRIGGER sprintf(name, "ra0");
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(ulInfo));
wrq.u.data.length = sizeof(ulInfo);
y.c N
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_RSSI_TRIGGER;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
ra IDE
RT_OID_802_11_RSSI 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_RSSI;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
em F
RT_OID_802_11_RSSI_1 sprintf(name, "ra0");
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(ulInfo));
og ON
wrq.u.data.length = sizeof(ulInfo);
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_OID_802_11_RSSI_1;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
RT_OID_802_11_RSSI_2 sprintf(name, "ra0");
strcpy(wrq.ifr_name, name);
@ C
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;
01 K
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;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
50 A
wrq.u.data.length = sizeof(ulInfo);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_GEN_RCV_OK;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
OID_GEN_RCV_NO_BUFFER sprintf(name, "ra0");
E
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(ulInfo));
wrq.u.data.length = sizeof(ulInfo);
FO M
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_GEN_RCV_NO_BUFFER;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
RT_OID_802_11_PHY_MODE typedef enum _RT_802_11_PHY_MODE {
PHY_11BG_MIXED = 0,
PHY_11B,
PHY_11A,
R
PHY_11ABG_MIXED,
PHY_11G,
PHY_11ABGN_MIXED, // both band 5
PHY_11N, // 6
N
} RT_802_11_PHY_MODE
sprintf(name, "ra0");
US AL
strcpy(wrq.ifr_name, name);
EO
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;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
om TI
RT_OID_802_11_STA_CONFIG sprintf(name, "ra0");
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(RT_802_11_STA_CONFIG));
wrq.u.data.length = sizeof(RT_802_11_STA_CONFIG);
y.c N
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_OID_802_11_STA_CONFIG;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
ra IDE
OID_802_11_RTS_THRESHOLD sprintf(name, "ra0");
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;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
em F
OID_802_11_FRAGMENTATION_THRESHOLD sprintf(name, "ra0");
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(FragThresh));
og ON
wrq.u.data.length = sizeof(FragThresh);
wrq.u.data.pointer = data;
wrq.u.data.flags =
OID_802_11_FRAGMENTATION_THRESHOLD;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
OID_802_11_POWER_MODE sprintf(name, "ra0");
@ C
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(PowerMode));
wrq.u.data.length = sizeof(PowerMode);
wrq.u.data.pointer = data;
01 K
wrq.u.data.flags = OID_802_11_POWER_MODE;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
RT_OID_802_11_RADIO sprintf(name, "ra0");
02 TE
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(RadioState));
wrq.u.data.length = sizeof(RadioState);
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_OID_802_11_RADIO;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
50 A
wrq.u.data.length = sizeof(BssType);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_INFRASTRUCTURE_MODE;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
E
wrq.u.data.length = sizeof(PreamType);
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_OID_802_11_PREAMBLE;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
OID_802_11_AUTHENTICATION_MODE sprintf(name, "ra0");
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(AuthMode));
wrq.u.data.length = sizeof(AuthMode);
R
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_AUTHENTICATION_MODE;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
N
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_WEP_STATUS;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
US AL
EO
OID_802_11_TX_POWER_LEVEL sprintf(name, "ra0");
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;
om TI
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
OID_802_11_TX_POWER_LEVEL_1 sprintf(name, "ra0");
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(ULONG));
y.c N
wrq.u.data.length = sizeof(ULONG);
wrq.u.data.pointer = data;
wrq.u.data.flags = OID_802_11_TX_POWER_LEVEL_1;
ra IDE
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
OID_802_11_NETWORK_TYPES_SUPPORTED sprintf(name, "ra0");
strcpy(wrq.ifr_name, name);
memset(data, 0, 16);
wrq.u.data.length = 16;
wrq.u.data.pointer = data;
wrq.u.data.flags =
em F
OID_802_11_NETWORK_TYPES_SUPPORTED;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
OID_802_11_NETWORK_TYPE_IN_USE sprintf(name, "ra0");
og ON
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;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
@ C
wrq.u.data.pointer = data;
wrq.u.data.flags =
RT_OID_802_11_QUERY_EEPROM_VERSION;
02 TE
wrq.u.data.flags =
RT_OID_802_11_QUERY_FIRMWARE_VERSION;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
29 DI
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_OID_802_11_QUERY_NOISE_LEVEL;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
FO M
N
strcpy(wrq.ifr_name, name);
memset(data, 0, sizeof(UINT));
wrq.u.data.length = sizeof(UINT);
US AL
EO
wrq.u.data.pointer = data;
wrq.u.data.flags = RT_OID_WE_VERSION_COMPILED;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
om TI
sprintf(wrq.ifr_name, "ra0");
wrq.u.data.pointer = (caddr_t) & tmpHT;
wrq.u.data.flags = RT_OID_802_11_QUERY_LAST_TX_RATE;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
y.c N
RT_OID_802_11_QUERY_LAST_RX_RATE HTTRANSMIT_SETTING tmpHT;
sprintf(wrq.ifr_name, "ra0");
wrq.u.data.pointer = (caddr_t) & tmpHT;
ra IDE
wrq.u.data.flags = RT_OID_802_11_QUERY_LAST_RX_RATE;
ioctl(socket_id, RT_PRIV_IOCTL, &wrq);
SHOW_CONN_STATUS u_char buffer[IW_PRIV_SIZE_MASK];
sprintf(wrq.ifr_name, "ra0");
wrq.u.data.pointer = (caddr_t) buffer;
wrq.u.data.flags = SHOW_CONN_STATUS;
ioctl(socket_id, RTPRIV_IOCTL_SHOW, &wrq);
em F
og ON
@ C
01 K
02 TE
50 A
29 DI
E
FO M
R
N
10.1 Check connection status
US AL
EO
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
om TI
#include <sys/ioctl.h>
#include <unistd.h> /* for close */
#include <linux/wireless.h>
//=============================================================================
y.c N
#if WIRELESS_EXT <= 11
#ifndef SIOCDEVPRIVATE
ra IDE
#define SIOCDEVPRIVATE 0x8BE0
#endif
#define SIOCIWFIRSTPRIV SIOCDEVPRIVATE
#endif
//SET/GET CONVENTION :
// * ------------------
em F
// * Simplistic summary :
// * o even numbered ioctls are SET, restricted to root, and should not
og ON
// * return arguments (get_args = 0).
// * o odd numbered ioctls are GET, authorised to anybody, and should
// * not expect any arguments (set_args = 0).
//
#define RT_PRIV_IOCTL (SIOCIWFIRSTPRIV + 0x0E)
//---------------------------------------------------------
@ C
#ifndef TRUE
#define TRUE 1
#endif
02 TE
#ifndef FALSE
#define FALSE 0
#endif
50 A
#define NdisMediaStateDisconnected 0
//=============================================================================
int main( int argc, char ** argv )
{
E
int socket_id;
struct iwreq wrq;
int ret = 1, cmd = 0;
char *base;//, *base1;
char *data;
// open socket based on address family: AF_NET ----------------------------
socket_id = socket(AF_INET, SOCK_DGRAM, 0);
R
if(socket_id < 0)
{
printf("\nrtuser::error::Open socket error!\n\n");
N
{
printf("unable to alloc data buffer, size (%d)\n", DATA_BUFFER_SIZE);
US AL
EO
return -1;
}
// set interface name as "ra0" --------------------------------------------
sprintf(name, "ra0");
memset(data, 0, DATA_BUFFER_SIZE);
om TI
//
//example of ioctl function ==========================================
//
base = argv[1];
y.c N
//base1 = argv[2];
if(argc != 2)
ra IDE
goto rtuser_exit;
if(strstr(base, "OID_GEN_MEDIA_CONNECT_STATUS"))
cmd = OID_GEN_MEDIA_CONNECT_STATUS;
switch(cmd)
{
em F
case OID_GEN_MEDIA_CONNECT_STATUS:
{
// Get media connect status
og ON
}
break;
29 DI
default:
printf("\nUnsupported OID type\n");
break;
}
E
rtuser_exit:
if(socket_id >= 0)
FO M
close(socket_id);
if (data != NULL)
free(data);
if(ret)
return ret;
else
return 0;
R
N
#include <string.h>
#include <netinet/in.h> /* for sockaddr_in */
US AL
EO
#include <fcntl.h>
#include <time.h>
#include <sys/times.h>
#include <unistd.h>
#include <sys/socket.h>
om TI
#include <sys/stat.h>
#include <err.h>
#include <errno.h>
y.c N
#include <asm/types.h>
#define IFNAMSIZ 16
ra IDE
#include </usr/include/linux/wireless.h>
#include <sys/ioctl.h>
wrq.u.data.pointer = &data;
wrq.u.data.flags = RT_OID_WSC_QUERY_STATUS ;
ioctl(skfd, RT_PRIV_IOCTL ,&wrq);
DBGPRINT("wsc query status = %d \n", data);
01 K
return data;
}
02 TE
return -1;
if (argc < 2)
{
printf("Usage: %s <# secs to poll wps status> \n", argv[0]);
E
return 1;
}
FO M
num_sec = atoi(argv[1]);
while (num_sec-- > 0)
{
rt_oid_get_wsc_status("ra0", skfd);
sleep(1);
}
return 0;
R
N
#include <errno.h>
#include <sys/socket.h>
US AL
EO
#include <sys/ioctl.h>
#include <unistd.h> /* for close */
#include <linux/wireless.h>
om TI
#define OID_GET_SET_TOGGLE 0x8000
#define OID_802_11_BSSID_LIST_SCAN (0x0508 | OID_GET_SET_TOGGLE)
#define OID_802_11_BSSID_LIST 0x0609
y.c N
#define PACKED __attribute__ ((packed))
//security
ra IDE
#define WPS_OUI_TYPE 0x04F25000
#define WPS_PDID 0x1210
#define WPA_OUI_TYPE 0x01F25000
#define WPA_OUI 0x00F25000
#define WPA2_OUI 0x00AC0F00
#define CISCO_OUI 0x00964000
em F
//===============
og ON
#define NDIS_802_11_LENGTH_SSID 32
#define NDIS_802_11_LENGTH_RATES_EX 16
#define NDIS_802_11_LENGTH_RATES 8
Ndis802_11IBSS,
Ndis802_11Infrastructure,
Ndis802_11AutoUnknown,
Ndis802_11Monitor,
Ndis802_11InfrastructureMax // Not a real value, defined as upper bound
} NDIS_802_11_NETWORK_INFRASTRUCTURE, *PNDIS_802_11_NETWORK_INFRASTRUCTURE;
R
N
typedef struct _NDIS_802_11_CONFIGURATION
US AL
EO
{
unsigned long Length; // Length of structure
unsigned long BeaconPeriod; // units are Kusec
unsigned long ATIMWindow; // units are Kusec
unsigned long DSConfig; // Frequency, units are kHz
om TI
NDIS_802_11_CONFIGURATION_FH FHConfig;
} NDIS_802_11_CONFIGURATION, *PNDIS_802_11_CONFIGURATION;
y.c N
typedef enum _NDIS_802_11_NETWORK_TYPE
{
ra IDE
Ndis802_11FH,
Ndis802_11DS,
Ndis802_11OFDM5,
Ndis802_11OFDM5_N,
Ndis802_11OFDM24,
Ndis802_11OFDM24_N,
em F
Ndis802_11Automode,
Ndis802_11NetworkTypeMax // not a real type, defined as an upper bound
} NDIS_802_11_NETWORK_TYPE, *PNDIS_802_11_NETWORK_TYPE;
og ON
NDIS_802_11_CONFIGURATION Configuration;
NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode;
NDIS_802_11_RATES_EX SupportedRates;
unsigned long IELength;
E
N
typedef struct PACKED
US AL
EO
{
unsigned int NumberOfItems; // in list below, at least 1
NDIS_WLAN_BSSID_EX Bssid[1];
} NDIS_802_11_BSSID_LIST_EX, *PNDIS_802_11_BSSID_LIST_EX;
//===============
om TI
void checkSecurity(PNDIS_WLAN_BSSID_EX pBssid){
y.c N
// work with NDIS_WLAN_BSSID_EX
ra IDE
int bTKIP = 0;
int bAESWRAP = 0;
int bAESCCMP = 0;
int bWPA = 0;
int bWPAPSK = 0;
int bWPANONE = 0;
em F
int bWPA2 = 0;
int bWPA2PSK = 0;
int bWPA2NONE = 0;
og ON
PNDIS_802_11_VARIABLE_IEs pVarIE =
(PNDIS_802_11_VARIABLE_IEs)((char*)pFixIE + sizeof(NDIS_802_11_FIXED_IEs));
lIELoc += sizeof(NDIS_802_11_FIXED_IEs);
02 TE
if(*pOUI != WPA_OUI_TYPE)
{
lIELoc += pVarIE->Length;
lIELoc += 2;
E
pVarIE =
(PNDIS_802_11_VARIABLE_IEs)((char*)pVarIE + pVarIE->Length + 2);
FO M
if(pVarIE->Length <= 0)
break;
continue;
}
unsigned int* plGroupKey;
unsigned short* pdPairKeyCount;
R
N
{
lGroupKey = (*plGroupKey & 0xff000000) >> 0x18;
US AL
EO
if (lGroupKey == 2)
bTKIP = 1;
else if (lGroupKey == 3)
bAESWRAP = 1;
else if (lGroupKey == 4)
om TI
bAESCCMP = 1;
}
else
{
y.c N
lIELoc += pVarIE->Length;
lIELoc += 2;
ra IDE
pVarIE =
(PNDIS_802_11_VARIABLE_IEs)((char*)pVarIE + pVarIE->Length + 2);
if(pVarIE->Length <= 0)
break;
em F
continue;
}
og ON
{
lPairKey = (*plPairwiseKey & 0xff000000) >>
0x18;
02 TE
if(lPairKey == 2){
bTKIP = 1;
}
else if(lPairKey == 3){
bAESWRAP = 1;
50 A
}
else if(lPairKey == 4){
29 DI
bAESCCMP = 1;
}
}
else
E
break;
FO M
++plPairwiseKey;
}
{
unsigned int lAuthenKey = *plAuthenKey & 0x00ffffff;
if(lAuthenKey == CISCO_OUI)
N
{
lAuthenKey = (*plAuthenKey & 0xff000000)
US AL
EO
>> 0x18;
if(lAuthenKey == 1){
bWPA = 1;
}
om TI
else if(lAuthenKey == 0 || lAuthenKey == 2)
{
if(pBssid->InfrastructureMode){
bWPAPSK = 1;
y.c N
}
else
ra IDE
bWPANONE = 1;
}
}
++plAuthenKey;
}
em F
}
else if(pVarIE->ElementID == 48 && pVarIE->Length >= 12)
{
og ON
if(lGroupKey == WPA2_OUI)
{
lGroupKey = (*plGroupKey & 0xff000000) >> 0x18;
02 TE
if(lGroupKey == 2){
bTKIP = 1;
}
else if(lGroupKey == 3){
bAESWRAP = 1;
50 A
}
else if(lGroupKey == 4){
29 DI
bAESCCMP = 1;
}
}
else
E
{
lIELoc += pVarIE->Length;
FO M
lIELoc += 2;
pVarIE =
(PNDIS_802_11_VARIABLE_IEs)((char*)pVarIE + pVarIE->Length + 2);
if(pVarIE->Length <= 0)
break;
continue;
R
N
unsigned int lPairKey = *plPairwiseKey & 0x00ffffff;
if(lPairKey == WPA2_OUI)
US AL
EO
{
lPairKey = (*plPairwiseKey & 0xff000000) >>
0x18;
if(lPairKey == 2){
bTKIP = 1;
om TI
}
else if(lPairKey == 3){
bAESWRAP = 1;
}
y.c N
else if(lPairKey == 4){
bAESCCMP = 1;
ra IDE
}
}
else
break;
++plPairwiseKey;
em F
}
2 + 4 * *pdPairKeyCount);
plAuthenKey = (unsigned int*)((char*)pdAuthenKeyCount + 2);
{
lAuthenKey = (*plAuthenKey & 0xff000000)
>> 0x18;
if(lAuthenKey == 1)
bWPA2 = 1;
50 A
if(pBssid->InfrastructureMode)
bWPA2PSK = 1;
else
bWPA2NONE = 1;
E
}
}
FO M
++plAuthenKey;
}
}
lIELoc += pVarIE->Length;
lIELoc += 2;
R
N
//if(bCCKM)
//printf("CCKM; ");
US AL
EO
if (bWPA)
strcat(strAuth, "WPA");
if (bWPAPSK)
strcat(strAuth, "WPAPSK");
if (bWPANONE)
om TI
strcat(strAuth, "WPA-NONE");
if (bWPA2)
strcat(strAuth, "WPA2");
if (bWPA2PSK)
y.c N
strcat(strAuth, "WPA2PSK");
if (bWPA2NONE)
ra IDE
strcat(strAuth, "WPA2-NONE");
//{
//printf("Unknown 02");
//}
if(bTKIP)
@ C
strcat(strEncry, "TKIP");
if(bAESWRAP || bAESCCMP)
strcat(strEncry, "AES");
01 K
//if(strlen(strEncry) > 0)
02 TE
//{
//strncpy((char *)tmpEncry, strEncry, strlen(strEncry) - 2);
//strcpy(strEncry, (char *)tmpEncry);
//printf("Unknown 03");
//}
50 A
//else
//{
29 DI
if (pBssid->Privacy)
{
if(strlen(strEncry) < 2)
{
E
printf("WEP");
}
FO M
else
{
printf("%s/%s", strAuth,strEncry);
}
}
else
{
R
printf("NONE");
}
//}
N
int main(int argc, char** argv)
{
US AL
EO
int i, socket_id;
struct iwreq wrq, wrq1;
int ret;
unsigned int bufLen = 1024*100;
PNDIS_802_11_BSSID_LIST_EX pBssidList;
om TI
PNDIS_WLAN_BSSID_EX pBssid;
PNDIS_802_11_FIXED_IEs pFixIE;
PNDIS_802_11_VARIABLE_IEs pVarIE;
y.c N
socket_id = socket(AF_INET,SOCK_DGRAM,0);
if(socket_id<0)
ra IDE
{
printf("\n Open socket error!\n");
goto error_exit;
}
//Scanning
em F
strcpy(wrq1.ifr_name, "ra0");
wrq1.u.data.flags = OID_802_11_BSSID_LIST_SCAN;
ret = ioctl(socket_id,RT_PRIV_IOCTL,&wrq1);
og ON
if(ret != 0)
{
printf("\n Scan fail %d\n", ret);
goto error_exit;
}
@ C
//Get List
pBssidList = (PNDIS_802_11_BSSID_LIST_EX)malloc(bufLen); //64k
01 K
strcpy(wrq.ifr_name, "ra0");
02 TE
wrq.u.data.length = bufLen;
wrq.u.data.pointer = pBssidList;
wrq.u.data.flags = OID_802_11_BSSID_LIST;
ret = ioctl(socket_id,RT_PRIV_IOCTL,&wrq);
do{
50 A
ret = ioctl(socket_id,RT_PRIV_IOCTL,&wrq);
printf("Scanning...\n");
29 DI
if(ret == EAGAIN)
printf("EAGAIN...\n");
else if(ret == E2BIG)
printf("E2BIG...\n");
E
else
sleep(1);
FO M
}while(ret == -1);
else{
printf("%d: %-33s\t", i+1, pBssid->Ssid.Ssid);
}
N
pBssid->MacAddress[3],
pBssid->MacAddress[4],
US AL
EO
pBssid->MacAddress[5]);
printf("Rssi:%d\t",pBssid->Rssi);
//Networktype
if(pBssid->InfrastructureMode == 0)
printf("Ad-hoc\t");
om TI
else
printf("Infra\t",pBssid->Rssi);
//wirelessMode
y.c N
if(pBssid->NetworkTypeInUse == 1)
printf("11b\t");
ra IDE
else if(pBssid->NetworkTypeInUse == 3)
printf("11bg\t", pBssid->NetworkTypeInUse);
else if(pBssid->NetworkTypeInUse == 6)
printf("11bgn\t", pBssid->NetworkTypeInUse);
else
printf("unknown\t", pBssid->NetworkTypeInUse);
em F
//Security
pFixIE = (PNDIS_802_11_FIXED_IEs)pBssid->IEs;
pVarIE = (PNDIS_802_11_VARIABLE_IEs)((char*)pFixIE + sizeof(NDIS_802_11_FIXED_IEs));
og ON
checkSecurity(pBssid);
printf("\n");
//move forward
pBssid = (PNDIS_WLAN_BSSID_EX)((char *)pBssid + pBssid->Length);
@ C
error_exit:
01 K
if(socket_id>=0)
close(socket_id);
return 1;
02 TE
}
50 A
HTTRANSMIT_SETTING HTSetting;
Double Rate;
double b_mode[] ={1, 2, 5.5, 11};
E
case 0:
if (HTSetting.field.MCS >=0 && HTSetting.field.MCS<=3)
Rate = b_mode[HTSetting.field.MCS];
else if (HTSetting.field.MCS >=8 && HTSetting.field.MCS<=11)
Rate = b_mode[HTSetting.field.MCS-8];
else
Rate = 0;
break;
R
case 1:
if ((HTSetting.field.MCS >= 0) && (HTSetting.field.MCS < 8))
Rate = g_Rate[HTSetting.field.MCS];
else
Rate = 0;
MediaTek Confidential © 2012 MediaTek Inc. Page 81 of 82
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
N
&Rate))
Rate = 0;
US AL
break;
EO
default:
Rate = 0;
break;
}
om TI
{
double HTTxRate20_800[16]={6.5, 13.0, 19.5, 26.0, 39.0, 52.0, 58.5, 65.0, 13.0, 26.0, 39.0, 52.0, 78.0, 104.0,
117.0, 130.0};
double HTTxRate20_400[16]={7.2, 14.4, 21.7, 28.9, 43.3, 57.8, 65.0, 72.2, 14.444, 28.889, 43.333, 57.778,
y.c N
86.667, 115.556, 130.000, 144.444};
double HTTxRate40_800[18]={13.5, 27.0, 40.5, 54.0, 81.0, 108.0, 121.5, 135.0, 27.0, 54.0, 81.0, 108.0,
162.0, 216.0, 243.0, 270.0, 6.0, 39.0};
ra IDE
double HTTxRate40_400[18]={15.0, 30.0, 45.0, 60.0, 90.0, 120.0, 135.0, 150.0, 30.0, 60.0, 90.0, 120.0,
180.0, 240.0, 270.0, 300.0, 6.7, 43.3};
// no TxRate for (BW = 20, GI = 400, MCS = 32) & (BW = 20, GI = 400, MCS = 32)
if (((nBW == BW_20) && (nGI == GI_400) && (nMCS == 32)) ||
((nBW == BW_20) && (nGI == GI_800) && (nMCS == 32)))
return 0; //false
em F
if( nBW == BW_20 && nGI == GI_800)
*dRate = HTTxRate20_800[nMCS];
else if( nBW == BW_20 && nGI == GI_400)
og ON
*dRate = HTTxRate20_400[nMCS];
else if( nBW == BW_40 && nGI == GI_800)
*dRate = HTTxRate40_800[nMCS];
else if( nBW == BW_40 && nGI == GI_400)
*dRate = HTTxRate40_400[nMCS];
else
@ C
return 0; //false
return 1; //true
}
01 K
02 TE
50 A
29 DI
E
FO M
R