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)
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.
5. Install the module.
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.
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:
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.
Update: Ralink kept changing the driver version, so I added a link to 2009_0525_RT3070_Linux_STA_v2.1.1.0.bz2. Also I tried to compile the driver with the patch applied on 2.6.32-22-generic-pae (Lucid) and it worked.