首页 > 代码库 > Ubuntu Linux: Install RT2870 Chipset Based USB Wireless Adapter(转)
Ubuntu Linux: Install RT2870 Chipset Based USB Wireless Adapter(转)
This blog post listed Linux Compatible USB wireless adapters. It seems that many new Linux users frequently have problems learning how to install RT2870 driver under Linux. I also received email requesting installation instructions for the same device. This quick tutorial will explains how to install RT2870 based chipset device with WPA2 authentication and TKIP wireless encryption.
Our Sample Setup
The following instructions are tested on:
- Ubuntu Linux 10.04.1 LTS
- Kernel - Linux 2.6.32-24-generic-pae i686 (32 bit)
- WPA2 with Linksys 160N router
RT2870 Chipset Based Devices Are Not Working Out Of Box
The main problem is conflicting driver which are shipped with default kernel. WPA2 is a method of security wireless networking with optional PSK for home users. The default driver only recognizes driver but always failed to join WPA2 based network. The solution is to install RT2870 driver from the vendor site.
Step #1: Disable Default Drivers
Type the following command to black list default drivers:$ sudo vi /etc/modprobe.d/blacklist.conf
Append the following driver names:
blacklist rt2800usbblacklist rt2x00libblacklist rt2x00usb
Save and close the file. Use the rmmod command to remove current drivers or just reboot the system:$ sudo modprobe -r driverName
# you need to remove all of the above drivers one by one:
$ sudo modprobe -r rt2800usb
OR simply reboot the systems:$ sudo reboot
Step 2: Install Compilers
Type the following command to install required packages so that you can compile source code:$ sudo apt-get install build-essential fakeroot dpkg-dev
Finally, install Linux kernel headers so that you can compile kernel device drivers:$ sudo apt-get install linux-headers-$(uname -r)
Step #3: Download Driver
Visit this page and download USB drivers [RT2870USB(RT2870/RT2770)].
Untar Tarball
Type the following command:$ tar -jxvf 2010_0709_RT2870_Linux_STA_v2.4.0.1.tar.bz2
$ cd 2010_0709_RT2870_Linux_STA_v2.4.0.1
Compile RT2870 Wireless Lan Linux Driver
First, edit config.mk file as follows so that Network Manager can be used to set WPA2 auth info:$ vi os/linux/config.mk
Set it as follows:
# Support Wpa_SupplicantHAS_WPA_SUPPLICANT=y# Support Native WpaSupplicant for Network MangerHAS_NATIVE_WPA_SUPPLICANT_SUPPORT=y
Save and close the file. To compile the driver, enter:$ make
Sample outputs:
make -C toolsmake[1]: Entering directory `/tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/tools‘gcc -g bin2h.c -o bin2hmake[1]: Leaving directory `/tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/tools‘/tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/tools/bin2hcp -f os/linux/Makefile.6 /tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux/Makefilemake -C /lib/modules/2.6.32-24-generic-pae/build SUBDIRS=/tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux modulesmake[1]: Entering directory `/usr/src/linux-headers-2.6.32-24-generic-pae‘ CC [M] /tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux/../../common/crypt_md5.o CC [M] /tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux/../../common/crypt_sha2.o CC [M] /tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux/../../common/crypt_hmac.o CC [M] /tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux/../../common/crypt_aes.o......... CC [M] /tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux/../../common/rtusb_io.o CC [M] /tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux/../../common/rtusb_bulk.o CC [M] /tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux/../../common/rtusb_data.o CC [M] /tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux/../../common/cmm_data_usb.o CC [M] /tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux/../../common/ee_prom.o CC [M] /tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux/../../common/rtmp_mcu.o CC [M] /tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux/../../common/rtusb_dev_id.o CC [M] /tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux/../../os/linux/rt_usb.o CC [M] /tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux/../../os/linux/rt_usb_util.o CC [M] /tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux/../../os/linux/usb_main_dev.o LD [M] /tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux/rt2870sta.o Building modules, stage 2. MODPOST 1 modules CC /tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux/rt2870sta.mod.o LD [M] /tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux/rt2870sta.komake[1]: Leaving directory `/usr/src/linux-headers-2.6.32-24-generic-pae‘
Note: You may see a LOTs of warnings during the compilation, and this is *normal* so don‘t panic.
Install Driver
Type the following command:$ sudo make install
Sample outputs:
make -C /tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux -f Makefile.6 installmake[1]: Entering directory `/tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux‘rm -rf /etc/Wireless/RT2870STAmkdir /etc/Wireless/RT2870STAcp /tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/RT2870STA.dat /etc/Wireless/RT2870STA/.install -d /lib/modules/2.6.32-24-generic-pae/kernel/drivers/net/wireless/install -m 644 -c rt2870sta.ko /lib/modules/2.6.32-24-generic-pae/kernel/drivers/net/wireless//sbin/depmod -a 2.6.32-24-generic-paemake[1]: Leaving directory `/tmp/2010_0709_RT2870_Linux_STA_v2.4.0.1/os/linux‘
Install Latest Firmware
Again visit this page and download "Firmware RT28XX/RT30XX USB series (RT2870/RT2770/RT3572/RT3070)". Unzip and install the firemware:$ unzip RT2870_Firmware_V22.zip
$ cd RT2870_Firmware_V22/
#### Make a backup of existing old firmware ####
$ mkdir -p $HOME/backup/lib/firmware
$ cp /lib/firmware/rt2870.bin $HOME/backup/lib/firmware
#### Install the firmware (for 64 bit Linux systems, you may have to use /lib64/firmware) #####
$ sudo cp rt2870.bin /lib/firmware/
##### **** backup and move existing driver, do NOT SKIP this STEP ****######
$ sudo mv /lib/modules/$(uname -r)/kernel/drivers/net/wireless/rt2870sta.ko $HOME/backup/
Update usb.ids
Type the following commands:$ mkdir -p $HOME/backup/var/lib/usbutils
$ cp /var/lib/usbutils/usb.ids $HOME/backup/var/lib/usbutils
$ sudo wget -O /var/lib/usbutils/usb.ids http://www.linux-usb.org/usb.ids
Step #4: Configure Driver
Connect your USB device and type the following command to verify that Wireless USB LAN adapter is detected:$ lsusb
Sample outputs:
Bus 002 Device 007: ID 0411:00e8 MelCo., Inc. Buffalo WLI-UC-G300N Wireless LAN AdapterBus 002 Device 006: ID 05ac:0220 Apple, Inc. Aluminum Keyboard (ANSI)Bus 002 Device 005: ID 05ac:1006 Apple, Inc. Hub in Aluminum KeyboardBus 002 Device 004: ID 413c:2513 Dell Computer Corp.Bus 002 Device 003: ID 413c:2513 Dell Computer Corp.Bus 002 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching HubBus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hubBus 001 Device 007: ID 413c:8160 Dell Computer Corp.Bus 001 Device 006: ID 413c:8162 Dell Computer Corp.Bus 001 Device 005: ID 413c:8161 Dell Computer Corp.Bus 001 Device 004: ID 0a5c:4500 Broadcom Corp. BCM2046B1 USB 2.0 Hub (part of BCM2046 Bluetooth)Bus 001 Device 003: ID 0a5c:5800 Broadcom Corp. BCM5880 Secure Applications ProcessorBus 001 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching HubBus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
/etc/Wireless/RT2870STA/RT2870STA.dat Configuration
You need to edit /etc/Wireless/RT2870STA/RT2870STA.dat file, enter:$ sudo vi /etc/Wireless/RT2870STA/RT2870STA.dat
Set SSID (nixcraft is my SSID):
SSID=nixcraft
Set country (IN = INDIA, US = USA, etc):
CountryCode=IN
Set authentication information (do not skip this if you want WPA2 based authentication):
AuthMode=WPA2EncrypType=TKIPWPAPSK=YOUR-PASSWORD-HERE
See README_STA for other detailed information about each field. Save and close the file.
Step #5: Connect To the Internet
Type the ifconfig command and you should see ra0:$ ifconfig ra0
ra0 Link encap:Ethernet HWaddr 00:1d:73:bc:e4:6e inet6 addr: fe80::21d:73ff:febc:e46e/64 Scope:Link UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:5157 errors:0 dropped:0 overruns:0 frame:0 TX packets:206 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1093810 (1.0 MB) TX bytes:16772 (16.7 KB)
You can now connect to the Internet by clicking on Network manager ( The network-manager is the one which is found in the systray. The icon of two computers, one below to the other on the left-side). Clicking on NM-applet will give you the types of connection/hardware you have available > Select Wireless Device > Select nixcraftSSID (or scan of SSID) > Make sure you set "WPA2" as wireless security. Once connected you can browse the Internet or verify IP info:$ ifconfig ra0
Sample outputs:
ra0 Link encap:Ethernet HWaddr 00:1d:73:bc:e4:6e inet addr:192.168.1.103 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::21d:73ff:febc:e46e/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:6711 errors:0 dropped:0 overruns:0 frame:0 TX packets:271 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1420879 (1.4 MB) TX bytes:22312 (22.3 KB)
Verify gateway or just ping to public ip:$ route -n
$ ping google.com
$ ping cyberciti.biz
A Note About Kernel Upgrades
You need to reinstall the driver using the above steps.
Ubuntu Linux: Install RT2870 Chipset Based USB Wireless Adapter(转)