Linux & Ralink’s RT5392

Last weekend I visited my parents. And as always, they had some computer stuff to fix for me. Something with the printer which wasn’t printing. Ok, the printer was fixed quite quickly but while I used that Notebook I really thought I could need some updates. The installed OS was Ubuntu 10.04 “Lucid Lynx” which is around 2 years old. Well, Ubuntu can do release upgrades pretty comfortable via one simple command, so hey, what could possibly go wrong? It turns out: Wifi can.

The Notebook has a RT5392-chip from Ralink. Ralink is one of those chinese manufacturers that floods the market with terrible low-quality but super cheap and terribly supported hardware. Oh my god, why did I run that stupid do-realease-upgrade?

So, first, everything just seemed fine. Wifi was active and it connected to the configured network. However the speed was terrible. I didn’t get more than ~1,5Mbit/sec. Therefore I got random disconnects. Ok, if I don’t want my parents calling me everyday I had to fix this. The problem was easy. Ralink’s Linux driver is made made for  Linux kernels till around 2.6.something. Ubuntu ships with a kernel version 3.13. Luckily the driver’s source code is available on the Ralink’s website. This took me quite a while, the driver is hidden behind a “please-register-first”-wall. But for anyone interested, you can get it here: http://www.mediatek.com/en/downloads/rt539x-pcie/

Downloading the driver, extracting it is just straight forward. Now we need to patch the driver to work with modern kernels. Again, we are lucky. Jesse Crews from gridlox.net is maintaining two patches. The first one is meant for kernels up to 3.8 the other for kernels 3.15. You can get both at http://gridlox.net/diff/. In case of trouble, here’s a mirror: https://gist.github.com/ptrxyz/2d3c7ee10ea158cfa496

Pretty straight forward, too. Just simple .diff-patches. Apply the one matching your kernel version using

To build the driver, we need kernel headers and build-essentials, of course. Both things are in the repos, so sudo apt-get install linux-headers-generic build-essential should do.

Finally it’s time to compile: make && sudo make install

As a last action, for me it was needed to blacklist the rt2800 kernel driver. But again, this is a one-liner echo "blacklist rt2800pci" | sudo tee -a /etc/modprobe.d/blacklist.conf.

Anyone being a little bit familiar with Linux should be able to do this in a few minutes. Thus, here a little TL;DR :

– Make sure kernel headers and build-essentials are installed
– Download the driver from here and a patch matching your kernel version here.
– Extract, and patch
– make && make install
– blacklist the rt2800pci module

Sidenotes:

If the code compiles but you can’t modprobe the driver and you get something like ERROR: could not insert 'rt5390sta': Exec format error you most likely used the wrong patch. Try the kernel 3.15 patch.

Consider this post as a quick guide for people who already know how to do compile a kernel module and get it running and were just looking for the relevant links and patches. Thus no DKMS and stuff. If you want it I guess you are able to set that up on your own…

Leave a Reply

Your email address will not be published. Required fields are marked *