RT2070 ARM-linux

 

RT2070 ARM-linux

分类: kernel space   2976人阅读  评论(2)  收藏  举报

http://ubuntuforums.org/showthread.php?t=1285828

 

Tenda W541U V2.0 Wireless USB Adapter / Ralink RT2070 How To

Hi,

After some time of searching, switching between sadness and happiness and pulling my hair out I finally got my Tenda W541U V2.0 a.k.a. Tenda 54M Mini, a.k.a. Ralink RT2070L working.

I wrote this tutorial because I googled and I found nothing, nobody seems to know how to do it or is not willing to share his method. I even emailed Tenda support and they said their hardware is not working on Linux but it seems it actually does.

Note: There are many CHEAP usb adapters that are based on this Ralink chipset, the best way to see if yours is using it is to do a lsusb, and check for 148f:2070 at ID.

Hardware :
Tenda W541U V2.0 Wireless USB Adapter ( Ralink RT2070L Chipset)

Bus 001 Device 003: ID 148f:2070 Ralink Technology, Corp.

Driver :
RT3070USB(RT307x) http://www.sendspace.com/file/xfk1tg 

Host :
Linux mercury 2.6.28-15-generic #52-Ubuntu SMP Wed Sep 9 10:49:34 UTC 2009 i686 GNU/Linux

Ubuntu 9.04 /n /l

Tutorial :

1. Download the RT3070USB driver from Ralink. (link is listed above).
2. Unpack it.

Code:
$sudo su

#tar jxvf 2009_0525_RT3070_Linux_STA_v2.1.1.0.bz2

3. Navigate to os/linux and add the following line to usb_main_dev.c

Code:
#cd 2009_0525_RT3070_Linux_STA_v2.1.1.0/os/linux

#pico usb_main_dev.c

...

add:

        {USB_DEVICE(0x148F,0x2070)}, /* Ralink 2070L */

under #ifdef RT3070

...

4. Compile the module. 

Code:
#cd ../..;make

5. Install the module.

Code:
#make install

6. Copy the .DAT file to /etc/Wireless. (the install script should do it but just in case). Also copy the rt2870.bin file to /lib/firmware. (just in case).

Code:
#mkdir -p /etc/Wireless/RT2870STA

#cp RT2870STA.dat /etc/Wireless/RT2870STA/

#apt-get install tofrodos

#dos2unix /etc/Wireless/RT2870STA/RT2870STA.dat

#chmod +x /etc/Wireless/RT2870STA/RT2870STA.dat



#cp common/rt2870.bin /lib/firmware/

7. Start the module.

Code:
#modprobe rt3070sta

8. Test to see if it works.

Code:
#ifconfig ra0 inet 192.168.0.33 up



#iwconfig ra0

9. Configure the card.

For step 9, you can find numerous tutorials, the configuration is exactly the same as for the rt2870 chipset.

UPDATE: Linux Kernel >= 2.6.31 / Ubuntu Karmic Koala 9.10 compile patch!
Ok, after speaking with another person and installing Ubuntu 9.10 on my other box I noticed this driver will not compile on my brand new 2.6.31-14-generic kernel.

The error I received (and probably many people do when attempting to compile most ralink drivers under 2.6.31 because this kernel replaced the old net_device structure with a new one called net_device_ops) was: 

Code:
  CC [M]  /root/2009_0525_RT3070_Linux_STA_v2.1.1.0/os/linux/../../os/linux/rt_linux.o

/root/2009_0525_RT3070_Linux_STA_v2.1.1.0/os/linux/../../os/linux/rt_linux.c: In function ‘RtmpOSNetDevAttach’:

/root/2009_0525_RT3070_Linux_STA_v2.1.1.0/os/linux/../../os/linux/rt_linux.c:1510: error: ‘struct net_device’ has no member named ‘open’

/root/2009_0525_RT3070_Linux_STA_v2.1.1.0/os/linux/../../os/linux/rt_linux.c:1511: error: ‘struct net_device’ has no member named ‘stop’

/root/2009_0525_RT3070_Linux_STA_v2.1.1.0/os/linux/../../os/linux/rt_linux.c:1512: error: ‘struct net_device’ has no member named ‘hard_start_xmit’

/root/2009_0525_RT3070_Linux_STA_v2.1.1.0/os/linux/../../os/linux/rt_linux.c:1513: error: ‘struct net_device’ has no member named ‘do_ioctl’

/root/2009_0525_RT3070_Linux_STA_v2.1.1.0/os/linux/../../os/linux/rt_linux.c:1519: error: ‘struct net_device’ has no member named ‘get_stats’

/root/2009_0525_RT3070_Linux_STA_v2.1.1.0/os/linux/../../os/linux/rt_linux.c:1553: error: ‘struct net_device’ has no member named ‘validate_addr’

make[2]: *** [/root/2009_0525_RT3070_Linux_STA_v2.1.1.0/os/linux/../../os/linux/rt_linux.o] Error 1

make[1]: *** [_module_/root/2009_0525_RT3070_Linux_STA_v2.1.1.0/os/linux] Error 2

make[1]: Leaving directory `/usr/src/linux-headers-2.6.31-14-generic'

make: *** [LINUX] Error 2

After some deep searching I found this rt3070-2.6.31-compile.patch (a part of rt3070-kmod Fedora 11 package) on lists.rpmfusion.org/pipermail/rpmfusion-commits/2009-August/006214.html. Once you apply it, it will compile just fine.

I have attached it to this post, just:

Code:
$gunzip rt3070-2.6.31-compile.patch.gz



$patch -p0 < rt3070-2.6.31-compile.patch



patching file 2009_0525_RT3070_Linux_STA_v2.1.1.0/include/rtmp_os.h

patching file 2009_0525_RT3070_Linux_STA_v2.1.1.0/os/linux/rt_linux.c

patching file 2009_0525_RT3070_Linux_STA_v2.1.1.0/os/linux/rt_main_dev.c



$cd 2009_0525_RT3070_Linux_STA_v2.1.1.0/



$make

Also make sure that rt2800usb, rt2x00usb and rt2x00lib are blacklisted as they now recognize this device (under Ubuntu 9.10) but the device will not function properly (no scan results). 

Code:
$sudo pico /etc/modprobe.d/blacklist.conf



add the following lines:

blacklist rt2x00usb

blacklist rt2x00lib

blacklist rt2800usb

close and save.



$sudo rmmod rt2x00usb (just in case)

$sudo rmmod rt2x00lib (just in case)

$sudo rmmod rt2800usb (just in case)

Good luck.

Update 2 : If when you are trying to load the module you receive the following (on Karmic):

Code:
$sudo modprobe rt3070sta

$dmesg

815108.907620] rt3070sta: module is from the staging directory, the quality is unknown, you have been warned.

And your device is NOT detected, copy the rt3070sta.ko file in the staging directory like this:

Code:
$cd os/linux

$sudo cp ./rtk3070sta.ko /lib/modules/`uname -r`/kernel/drivers/staging/rt3070/

$sudo rmmod rt3070sta

$sudo modprobe rt3070sta

Update 3 :
For some reason the common/rtusb_io.c file contains a very annoying line that will fill your dmesg with empty lines cointaining only #. In order to fix this "bug":

Code:
$nano common/rtusb_io.c

replace:

DBGPRINT(RT_DEBUG_OFF, ("#/n"));

with:

//DBGPRINT(RT_DEBUG_OFF, ("#/n"));

$sudo make clean && make && make install

Also I noticed Ralink "updated" the driver "directory" as the driver itself still wont compile on 2.6.30 >= kernels, and from a first impression it is the exact same driver. A quick fix would be to do the following, after you download the and extract driver archive:

Code:
$mv 2009_1106_RT3070_Linux_STA_V2.1.1.0 2009_0525_RT3070_Linux_STA_v2.1.1.0

That is because the rt3070-2.6.31-compile patch is designed to search for that directory in particular.

Security Update :
For those using this driver with wpasupplicant you should know about this bug which could affect your system:

http://bugzilla.kernel.org/show_bug.cgi?id=14591 

A quick fix for it is to: 

Code:
$cd os/linux

$nano sta_ioctl.c

replace

struct iw_mlme *pMlme = (struct iw_mlme *)wrqu->data.pointer;

with

struct iw_mlme *pMlme;

and

struct iw_pmksa *pPmksa = (struct iw_pmksa *)wrqu->data.pointer;

with

struct iw_pmksa *pPmksa;

$sudo make clean && make && make install

The only disadvantage is that the driver will lack SIOCSIWPMKSA and SIOCSIWMLME functions. However I managed to connect to the AP (WPA,WEP) just fine w/out these two.

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值