Home page of this blog

Saturday, September 11, 2010

Configuring rpmfusion kernel module for ASUS N13 Wifi USB adapter in Ubuntu Lucid

Recently I bought ASUS USB Wifi N adapter after seeing it had linux support.

The details of this adapter as printed by lsusb is as follows

Bus 001 Device 002: ID 0b05:1784 ASUSTek Computer, Inc.

I thought it will be detected straight away by Ubuntu when I plugged in. That was not the case. The model required rt3070sta kernel module. This I came to know from searching Ubuntu forums. The module is in staging and it is still rt2870sta and did not work.

Now that it did not work for me, I compiled the source code bundled in the CD and connected to my home router. But it was not the latest source code. So I went to ralink site and downloaded the source and compiled it. But the code had debug prints to log to systemlog and it kept filling syslog. oops

To my surprise Windows 7 pulled the driver from net, autoconfigured and no need to tell it is way ahead of the curve. Now back to Ubuntu

I wanted to get the latest rt3070sta driver source compiled for 2.6.35 kernel in Lucid, and I ended up in compilation errors. Then came an idea, that rpmfusion would have compiled the driver for 2.6.34 for Fedora 13 and 2.6.35 for Fedora 14 rawhide, so I went straight to rpmfusion website and downloaded the source code

Then I experimented patched driver source from rpmfusion.org in Ubuntu. And the experiment worked extremely well to my delight. There was no compilation errors, not with 2.6.32 or 2.6.35 kernel, wow, Fedora and its community rocks as always

There was no flooding debug prints, no unncessary tftpboot configuration, support for 2.6.34 kernel ... the signal was good and everything seemed to work well with the patched source code from rpmfusion.org

Here is the summary of what I did to configure the ASUS Wifi module step by step, as this may help someone

Step 1

Download rt3070-kmod src rpm from rpmfusion updates for Fedora 13, http://download1.rpmfusion.org/free/fedora/updates/13/SRPMS/repoview/index.html


Step 2

Install p7zip-full if it is not already installed, this is to extract the source rpm

sudo aptitude install p7zip-full

Step 3

Extract the source rpm, by right clicking the downloaded rpm

Step 4

Change to extracted directory and extract DPO_RT3070_LinuxSTA_V2.3.0.2_20100412.tar.bz2

Step 5

Copy all the patch files into the newly extracted directory

cp rt3070-*.patch DPO_RT3070_LinuxSTA_V2.3.0.2_20100412/

Step 6

Installing the patches

Change to extracted folder where the patches have been copied (see previous step 5)

Brief explanation of what the patches does

rt3070-2.6.34.patch --> To avoid errors when compiling with kernel version 2.6.34 and above (this is due to the function usb_buffer_alloc and usb_buffer_free is not there from 2.6.34 and changed to usb_alloc_coherent and usb_free_coherent)
rt3070-no2.4-in-kernelversion.patch --> This patch removes kernel 2.4 support from the makefile
rt3070-Makefile.x-fixes.patch --> Fixes makefile installation rule
rt3070-strip-tftpboot-copy.patch --> This patch removes configuring tftpboot while installing the driver
rt3070-suppress-flood.patch --> To avoid numerous debug logs. This patch comments out debug logs

Install the patches in the correct order as mentioned below

1.To apply rt3070-2.6.34.patch run the following command --> patch -p1 <rt3070-2.6.34.patch
2.To apply rt3070-no2.4-in-kernelversion.patch run the following command --> patch -p1 <rt3070-no2.4-in-kernelversion.patch
3.To apply rt3070-Makefile.x-fixes.patch run the following command --> patch -p1 <rt3070-makefile.x-fixes.patch
4.To apply rt3070-strip-tftpboot-copy.patch run the following command --> patch -p1 <rt3070-strip-tftpboot-copy.patch
5.To apply rt3070-suppress-flood.patch run the following command --> patch -p1 <rt3070-suppress-flood.patch

Step 7

To avoid possible conflict with 2870 driver

Run this command (just copy the following and paste in the command line)

for sta in common/rtmp_init.c include/rt_ate.h include/os/rt_linux.h README_STA* RT2870STACard.dat ; do
sed 's|RT2870STA|RT3070STA|g' $sta > tmp.sta
touch -r $sta tmp.sta
mv tmp.sta $sta

Step 8

Build the kernel module

CFLAGS="-march=native -O2" make -j8

change -j8 to -j2 if you have core2duo, and -j4 if you have quadcore

Step 9

Copy the data file after creating the data directory for the module

sudo mkdir -p /etc/Wireless/RT3070STA

sudo cp RT2870STA.dat /etc/Wireless/RT3070STA/RT3070STA.dat

Step 10

Insert the module into the running kernel after copying into some directory which is common to all users

sudo cp os/linux/rt3070sta.ko /usr/local/bin/rt3070sta-rpmfusion-lucid.ko

sudo insmod /usr/local/bin/rt3070sta-rpmfusion-lucid.ko

Now configure networkmanager to connect to whichever wireless accesspoint you want to join and save it

Step 11

To automatically detect your wireless driver from next boot, add the following line before last line to /etc/rc.local by editing it as root

Upon reboot, your network adapter should be autodetected and connected (if you configured network manager to do so)

Step 12

Whenever there is a new kernel or kernel change rebuild the module, by following above steps


  1. Thks. Worked on fedora 14 after i've spent a few hours googling.