He's not dead, he's resting

Edimax EW-7728In 802.11n (RaLink rt2860) with Linux 2.6.26

Being sick of wireless disconnecting every time it rained, I got my hands upon a cheap Edimax EW-7728In PCI 802.11n card. This uses a RaLink rt2860 (PDF) chip, which has vendor-supplied open source drivers available. Getting it to work with Linux 2.6.26 is slightly non-trivial, however.

First, we need the drivers. At the time of writing, that means 2008_0522_RT2860_Linux_STA_v1.6.1.0.tar.bz2.

Next, we need to fix a couple of things. First, the Makefile is dumb, and tries to install into /tftpboot:

From 82dc3a8737e4f97311f4f4fccd79ea55a319f1ea Mon Sep 17 00:00:00 2001
From: Ciaran McCreesh <>
Date: Mon, 14 Jul 2008 16:47:00 +0100
Subject: [PATCH] Get your filthy paws off my /tftpboot

 Makefile |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 72bc933..aed3b00 100644
--- a/Makefile
+++ b/Makefile
@@ -80,11 +80,9 @@ LINUX:
 ifneq (,$(findstring 2.4,$(LINUX_SRC)))
        cp -f os/linux/Makefile.4 $(RT28xx_DIR)/os/linux/Makefile
        make -C $(RT28xx_DIR)/os/linux/
-       cp -f $(RT28xx_DIR)/os/linux/rt$(CHIPSET)sta.o /tftpboot
        cp -f os/linux/Makefile.6 $(RT28xx_DIR)/os/linux/Makefile
        make  -C  $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
-       cp -f $(RT28xx_DIR)/os/linux/rt$(CHIPSET)sta.ko /tftpboot


Next, dev->nd_net should now be dev_net(dev):

From 0878b37a40e2a7f466a74938920ff3751917eec3 Mon Sep 17 00:00:00 2001
From: Ciaran McCreesh <>
Date: Mon, 14 Jul 2008 16:48:50 +0100
Subject: [PATCH] dev->nd_net is now dev_net(dev)

 os/linux/rt_main_dev.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/os/linux/rt_main_dev.c b/os/linux/rt_main_dev.c
index 24604da..6a3471d 100644
--- a/os/linux/rt_main_dev.c
+++ b/os/linux/rt_main_dev.c
@@ -669,7 +669,7 @@ static NDIS_STATUS rt_ieee80211_if_setup(struct net_device *dev, PRTMP_ADAPTER p

-        device = dev_get_by_name(dev->nd_net, slot_name);
+        device = dev_get_by_name(dev_net(dev), slot_name);
                device = dev_get_by_name(slot_name);

Finally, the driver is unusably noisy. Unless you want fifty-odd lines of kernel debug informatione every five seconds:

From 19c7a6895333624566775541fbc836e0c9208225 Mon Sep 17 00:00:00 2001
From: Ciaran McCreesh <>
Date: Mon, 14 Jul 2008 16:47:43 +0100
Subject: [PATCH] You shut your dirty whore mouth

 include/rt_linux.h |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/include/rt_linux.h b/include/rt_linux.h
index dfe4ab5..079d256 100644
--- a/include/rt_linux.h
+++ b/include/rt_linux.h
@@ -325,10 +325,6 @@ extern ULONG    RTDebugLevel;

 #define DBGPRINT_RAW(Level, Fmt)    \
 {                                   \
-    if (Level <= RTDebugLevel)      \
-    {                               \
-        printk Fmt;               \
-    }                               \

 #define DBGPRINT(Level, Fmt)    DBGPRINT_RAW(Level, Fmt)

There’s no Makefile install target, so you’ll need to sudo cp os/linux/*.ko /lib/modules/`uname -r`/kernel/ then sudo depmod -a before you can sudo modprobe rt2860sta. You’ll also need to sudo mkdir -p /etc/Wireless/RT2860STA/ then cp RT2860STA.dat /etc/Wireless/RT2860STA/, even though we’re not using that file for any configuration.

Gentoo’s init scripts, if you’re using them, try to be overly clever, and won’t be able to bring up the interface. So use something like this as your /etc/init.d/net.ra0:


depend() {
    need localmount
    after bootmisc hostname net.lo net.lo0
    use isapnp isdn pcmcia usb wlan

start() {
    bash -x -c 'ifconfig ra0 up'
    bash -x -c 'iwconfig ra0 essid giant-space-monkey key "aa:bb:cc:dd:ee:ff:00:11:22:33:44:55:66" freq 2.417G'
    bash -x -c 'dhcpcd ra0'

stop() {

restart() {

And that appears to be sufficient.


7 responses to “Edimax EW-7728In 802.11n (RaLink rt2860) with Linux 2.6.26

  1. klon July 14, 2008 at 9:47 pm

    Wow, respect, really :) Both for vendors, releasing their drivers as normal, and not broken (=closed source binary) ones, and for people like you, explaining how to get them working.

    I read a lot of Gentoo list logs and such, and, to be sincere – I didn’t like you. But your technical skills are worth of respect. So respect :)

    And BTW – by Gentoo init scripts you mean those used by “old” init, or the new OpenRC + baselayout? I am really dumb in this matter, so my question might be out of place. And maybe you could explain, how exactly are Gentoo init scripts are trying to be overly clever?

  2. Ciaran McCreesh July 14, 2008 at 10:20 pm

    Both OpenRC and plain old baselayout-1 get it wrong. The issue appears to be ‘ifconfig ra0 up’ being needed before any kind of iwconfig command (this is an oddity of some RaLink drivers). And it’s not even possible to hack it in using preup, since the overly clever networking scripts end up undoing all our hard work.

  3. m00f August 17, 2008 at 6:15 pm

    Sweet… That debugging information was driving me insane and I never had enough time to look into it. Gracias :)

    PS You should submit these patches to RaLink.


  4. kbr September 28, 2008 at 1:29 pm


    i tried this with the actual driver v1.7.0.0 from RALink,
    it compiles and starts cleanly, but i got
    no packets out.
    Have anybody got this running?

  5. Matt October 6, 2008 at 7:47 am

    Thanks for the guide. I was expecting setting up my wireless to be a nightmare.

    Here are a few extra tips that got me going:

    1) Install wireless tools first:

    emerge net-wireless/wireless-tools

    2) The Makefile is slightly different now. Deleting every line that tries to copy to tftpboot seemed to work ok.

    3) Changing to dev_net(dev) turned out to be unnecessary (i had to undo to get it to compile).

    4) Run ‘make’ in the directory you un-tarred to.

    5) Don’t forget to chmod a+x net.ra0 once you’ve created it.

    7) I added rt2860sta to my /etc/modules.autoload.d/kernel-2.6. Not sure if i needed to.

    6) iwconfig seemed to want things set up in a particular order (else it ignored me). I replaced the start command in the net.ra0 script with:

    start() {
    bash -x -c 'ifconfig ra0 up'
    bash -x -c 'iwconfig ra0 enc open'
    bash -x -c 'iwconfig ra0 key '
    bash -x -c 'iwconfig ra0 essid '
    bash -x -c 'dhcpcd ra0'

  6. John Hunt December 2, 2008 at 8:56 pm

    Very interesting, seems like you know what you’re doing. Have you per chance tidied up the driver? Although I’ve got it working, it’s obviously a mess (dmesg full of weird etc)


  7. Ciaran McCreesh December 2, 2008 at 9:05 pm

    The driver isn’t as bad. It still has silly makefile issues, but the dmesg spam is just one big block at the start, not continuous noise. It’s not annoyed me enough that I’ve bothered cleaning it up.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s