如何載入 Ralink Wifi Driver
by 艾鍗學院, 2012-10-02 15:15, 人氣(5793)
How-to
----------------------
載入Kernel Module
# insmod rt2870sta.ko rtusb init --->
usbcore: registered new interface driver rt2870
=== pAd = c607e000, size = 501464 ===
<-- RTMPAllocTxRxRingMemory, Status=0
<-- RTMPAllocAdapterBlock, Status=0
usb 1-1: New USB device found, idVendor=148f, idProduct=2870
usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 1-1: Product: 802.11 n WLAN
usb 1-1: Manufacturer: Ralink
------------------
RT2870STA.dat 這個檔案在module 載入時,會讀入這個檔案,所以必須要先放在Root filesystem,
RT2870STA.dat 主要是用來設定wifi連線的參數,如SSID,認證, 加密等,
在你要連線某台AP時,必須修改這個檔案以符合你的情況, 另一種方法
用iwpriv (,其時就是ioctl 下命令),也可以用進行參數設定, 立即生效
若是用 RT2870STA.dat, 若更換參數,記得要重對ra0 down再up
ifconfig ra0 down/up, 因為此時才會Reload 參數
Configuration File : RT2870STA.dat
---------------------------------------
# Copy this file to /etc/Wireless/RT2870STA/RT2870STA.dat
# This file is a binary file and will be read on loading rt.o module.
#
# Use "vi RT2870STA.dat" to modify settings according to your need.
#
# 1.) set NetworkType to "Adhoc" for using Adhoc-mode, otherwise using Infrastructure
# 2.) set Channel to "0" for auto-select on Infrastructure mode
# 3.) set SSID for connecting to your Accss-point.
# 4.) AuthMode can be "WEPAUTO", "OPEN", "SHARED", "WPAPSK", "WPA2PSK", "WPANONE"
# 5.) EncrypType can be "NONE", "WEP", "TKIP", "AES"
# for more information refer to the Readme file.
--------------------------------------
# ifconfig ra0 up
-->RTUSBVenderReset
<--RTUSBVenderReset
Key1Str is Invalid key length(0) or Type(0)
Key2Str is Invalid key length(0) or Type(0)
Key3Str is Invalid key length(0) or Type(0)
Key4Str is Invalid key length(0) or Type(0)
1. Phy Mode = 5
2. Phy Mode = 5
phy mode> Error! The chip does not support 5G band 1!
RTMPSetPhyMode: channel is out of range, use first channel=1
3. Phy Mode = 9
MCS Set = ff ff 00 00 01
<==== rt28xx_init, Status=0
0x1300 = 00064300
===========
# ifconfig ra0
ra0 Link encap:Ethernet HWaddr 00:0E:2E:DE:28:A7
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:372 errors:0 dropped:0 overruns:0 frame:0
TX packets:142 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:84814 (82.8 KiB) TX bytes:11360 (11.0 KiB)
======================
# Copy this file to /etc/Wireless/RT2870STA/RT2870STA.dat
# This file is a binary file and will be read on loading rt.o module.
#
# Use "vi RT2870STA.dat" to modify settings according to your need.
#
# 1.) set NetworkType to "Adhoc" for using Adhoc-mode, otherwise using Infrastructure
# 2.) set Channel to "0" for auto-select on Infrastructure mode
# 3.) set SSID for connecting to your Accss-point.
# 4.) AuthMode can be "WEPAUTO", "OPEN", "SHARED", "WPAPSK", "WPA2PSK", "WPANONE"
# 5.) EncrypType can be "NONE", "WEP", "TKIP", "AES"
# for more information refer to the Readme file.
--------------------------------------
# ifconfig ra0 up
-->RTUSBVenderReset
<--RTUSBVenderReset
Key1Str is Invalid key length(0) or Type(0)
Key2Str is Invalid key length(0) or Type(0)
Key3Str is Invalid key length(0) or Type(0)
Key4Str is Invalid key length(0) or Type(0)
1. Phy Mode = 5
2. Phy Mode = 5
phy mode> Error! The chip does not support 5G band 1!
RTMPSetPhyMode: channel is out of range, use first channel=1
3. Phy Mode = 9
MCS Set = ff ff 00 00 01
<==== rt28xx_init, Status=0
0x1300 = 00064300
===========
# ifconfig ra0
ra0 Link encap:Ethernet HWaddr 00:0E:2E:DE:28:A7
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:372 errors:0 dropped:0 overruns:0 frame:0
TX packets:142 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:84814 (82.8 KiB) TX bytes:11360 (11.0 KiB)
======================
# 進行site survey 動作
# iwpriv ra0 get_site_survey
ra0 get_site_survey:
Ch SSID BSSID Security Siganl(%)W-Mode ExtCH NT
1 JS_ASUS_RT-N16 bc:ae:c5:c5:17:ea WPA1PSKWPA2PSK/TKIPAES 60 11b/g/n NONE In
2 APTG Wi-Fi cc:b2:55:03:39:4f NONE 0 11b/g NONE In
2 CHT Wi-Fi(HiNet) cc:b1:55:03:39:4f NONE 0 11b/g NONE In
5 JS_Pentens bc:ae:c5:c4:d8:f2 WPA1PSKWPA2PSK/AES 60 11b/g/n NONE In
6 ACER-PC_Network 34:08:04:d1:bb:a8 WPA1PSKWPA2PSK/TKIPAES 24 11b/g/n NONE In
6 JS_GW 00:50:7f:e3:08:84 WPA1PSKWPA2PSK/TKIPAES 65 11b/g/n BELOW In
6 ittraining_1 28:10:7b:ef:8d:20 WPA1PSKWPA2PSK/TKIPAES 89 11b/g/n NONE In
6 ittraining_3 00:90:cc:f4:d5:a4 WPA1PSKWPA2PSK/TKIPAES 29 11b/g/n BELOW In
11 IPxnase 00:24:a5:f4:c5:09 WPA1PSKWPA2PSK/TKIP 20 11b/g NONE In
11 1c:bd:b9:b0:f2:c8 WPA1PSKWPA2PSK/TKIPAES 10 11b/g/n BELOW In
11 linksys 00:22:6b:7c:f2:43 WPA1PSKWPA2PSK/TKIPAES 34 11b/g/n NONE In
# iwpriv ra0 get_site_survey
ra0 get_site_survey:
Ch SSID BSSID Security Siganl(%)W-Mode ExtCH NT
1 JS_ASUS_RT-N16 bc:ae:c5:c5:17:ea WPA1PSKWPA2PSK/TKIPAES 60 11b/g/n NONE In
2 APTG Wi-Fi cc:b2:55:03:39:4f NONE 0 11b/g NONE In
2 CHT Wi-Fi(HiNet) cc:b1:55:03:39:4f NONE 0 11b/g NONE In
5 JS_Pentens bc:ae:c5:c4:d8:f2 WPA1PSKWPA2PSK/AES 60 11b/g/n NONE In
6 ACER-PC_Network 34:08:04:d1:bb:a8 WPA1PSKWPA2PSK/TKIPAES 24 11b/g/n NONE In
6 JS_GW 00:50:7f:e3:08:84 WPA1PSKWPA2PSK/TKIPAES 65 11b/g/n BELOW In
6 ittraining_1 28:10:7b:ef:8d:20 WPA1PSKWPA2PSK/TKIPAES 89 11b/g/n NONE In
6 ittraining_3 00:90:cc:f4:d5:a4 WPA1PSKWPA2PSK/TKIPAES 29 11b/g/n BELOW In
11 IPxnase 00:24:a5:f4:c5:09 WPA1PSKWPA2PSK/TKIP 20 11b/g NONE In
11 1c:bd:b9:b0:f2:c8 WPA1PSKWPA2PSK/TKIPAES 10 11b/g/n BELOW In
11 linksys 00:22:6b:7c:f2:43 WPA1PSKWPA2PSK/TKIPAES 34 11b/g/n NONE In
# start dhcp client to get IP from AP
udhcpc -i ra0 -s /bin/udhcpc.script &
V. References
----------------------
RT2870STA.dat
iwpriv_usage.txt