Ralink RT5572 based WiFi Usb Dongle setup on Ubuntu 12.04

By ctheroux43 Comments

The WiFi USB dongles based on the newest RT5572 chip set do not work out of the box on Ubuntu.  Unex DNUR-V72, D-Link DWA-160 Rev B and TP-Link TL-WDN3200 dongles are based on this chipset.

You will need to compile the source code of the driver to make it work.  Do not leave this page!  This involves only a few easy steps.

1. Save this page’s link.  You will have to reboot and come back to it.

2. Un-plug the WiFi USB dongle from your computer.

3. Reboot your computer.

4. Download the driver’s source code from the manufacturer website. Alternatively, you can download a version of this file from this site. Files have been already edited. Steps 9, 10 and 11 are then unnecessary. Note that the filename is slightly different (DPO_RT5572_LinuxSTA_2.6.0.1_20120629_EDITED.tar.bz2.bz2).

5. Open a terminal window.

6. Change to the directory that contains the driver’s source code downloaded previously.  For example,

cd /home/myuser/Downloads

7. Extract the source code.  You might need the modify the file name since Mediatek may publish newer source code.  For example (there is two bz2 extensions!),

tar xvf DPO_RT5572_LinuxSTA_2.6.0.1_20120629.tar.bz2.bz2

8. Change to the source code directory

cd DPO_RT5572_LinuxSTA_2.6.0.1_20120629

9. Edit the file os/linux/config.mk.  Set to y the two variables HAS_WPA_SUPPLICANT and HAS_NATIVE_WPA_SUPPLICANT_SUPPORT.  Your file shall shows

# Support Wpa_Supplicant
# i.e. wpa_supplicant -Dralink
HAS_WPA_SUPPLICANT=y
# Support Native WpaSupplicant for Network Manager
# i.e. wpa_supplicant -Dwext
HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=y

10. Edit the file os/linux/usb_main_dev.c. Add a line containing MODULE_LICENSE(“GPL”);. This line is important. The position of the line is important. Your file shall shows

MODULE_DESCRIPTION("RT2870 Wireless Lan Linux Driver");
MODULE_LICENSE("GPL");
#ifdef CONFIG_STA_SUPPORT
#ifdef MODULE_VERSION

11. Edit the file common/cmm_mac_usb.c and add the lines “#define usb_buffer_alloc(a, b, c, d) usb_alloc_coherent(a, b, c, d)” and “#define usb_buffer_free(a, b, c, d) usb_free_coherent(a, b, c, d)“. The position of the lines is important. Your file shall shows

#ifdef RTMP_MAC_USB

#define usb_buffer_alloc(a, b, c, d) usb_alloc_coherent(a, b, c, d)
#define usb_buffer_free(a, b, c, d) usb_free_coherent(a, b, c, d)

#include        "rt_config.h"

12. In the same directory as step #8, compile the driver’s source code. Type the following command:

sudo make

13. Install the driver. Type the following command:

sudo make install

14. Plug your WiFi USB dongle.
15. After a few seconds, you should see an interface called ra0 if you type the following command:

sudo ifconfig

16. Configure your connection as you would normally do.

Linux, Ralink, RT5572, Ubuntu, Ubuntu 11.04, Ubuntu 11.10, Ubuntu 12.04, WiFI

43 Comments to “Ralink RT5572 based WiFi Usb Dongle setup on Ubuntu 12.04”

  1. omenk says:

    wow its works, but i use another DPO files.
    how to create usb wifi auto enabled(detected) when computer reboot. thanks

    1. Claude Theroux says:

      Which one did you use?

  2. anatolii says:

    cd Desktop/backports-3.11-rc3-1/
    make defconfig-wifi
    make
    sudo make install
    sudo modprobe -r rt5572sta
    sudo modprobe rt2800usb

  3. JD says:

    @ctheroux,

    Although the driver works out the box with Ubuntu 14.04 the free drivers perform horribly compared to the Mediatek drivers. I tried installing it on Ubuntu 14.04 but I get syntax errors and such probably due to new kernel because it works perfectly fine under Debian Wheezy. Any suggestions? I don’t know if Ubuntu has any firmware to support in the repos I have checked but no luck.

    Thanks!

  4. Georg Mill says:

    For Ubuntu 14.04 edit DPO_RT5572_LinuxSTA_2.6.1.3_20121022/os/linux/rt_linux.c

    Search for these lines:
    #if LINUX_VERSION_CODE fsuid = current->fsuid;
    pOSFSInfo->fsgid = current->fsgid;
    current->fsuid = current->fsgid = 0;

    and add directly after these lines the following code:

    #else if LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0)

    #endif
    This is a really dirty hack, but it works for me.

    1. Erasmus says:

      Cannot find these lines quoted in the file. What do I add where for ubuntu 14.04?
      Thanks so much.

      1. ctheroux says:

        It works now out of the box with 14.04. There is no need to do this with Ubuntu 14.04.

        1. Aman says:

          No TL-WN727N wireless adapter does not work out of box with Ubuntu 14.04. I tried all methods over here but nothing is working. Please help.

  5. Georg Mill says:

    For Ubuntu 14.04 edit DPO_RT5572_LinuxSTA_2.6.1.3_20121022/os/linux/rt_linux.c
    and insert

    #if LINUX_VERSION_CODE fsuid = current->fsuid;
    pOSFSInfo->fsgid = current->fsgid;
    current->fsuid = current->fsgid = 0;
    #else if LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0)

    #endif
    pOSFSInfo->fs = get_fs();
    set_fs(KERNEL_DS);
    this is a real dirty hack, but it works.

    1. Aman says:

      this definitely not working . Syntax error in if statement.

    2. Chopo Rito says:

      I used

      pOSFSInfo->fsuid = __kuid_val(current_fsuid());
      pOSFSInfo->fsgid = __kgid_val(current_fsgid());

      instead of

      pOSFSInfo->fsuid = current_fsuid();
      pOSFSInfo->fsgid = current_fsgid();

      and it worked for me. I think this may be a solution.

  6. hung says:

    I use your method It works in Ubuntu 12.04 TP link 3200
    But when i get software updated from ubuntu i must do to the directory of the the driver run ” make ” and then ” make install” to meke the adapter works again

  7. dlanced says:

    Hi,
    This terrifice page has helped me in the past, but now I’m having trouble using a TP-Link WDN3200 usb adapter (rt5572) on Debian 7.3. When I get to your step 12 (make), I get this output:
    ===============================
    make -C tools
    make[1]: Entering directory `/home/myname/DPO_RT5572_LinuxSTA_2.6.0.1_20120629/tools’
    gcc -g bin2h.c -o bin2h
    make[1]: Leaving directory `/home/myname/DPO_RT5572_LinuxSTA_2.6.0.1_20120629/tools’
    /home/dclinton/DPO_RT5572_LinuxSTA_2.6.0.1_20120629/tools/bin2h
    cp -f os/linux/Makefile.6 /home/myname/DPO_RT5572_LinuxSTA_2.6.0.1_20120629/os/linux/Makefile
    make -C /lib/modules/3.8.7-yocto-standard/build SUBDIRS=/home/dclinton/DPO_RT5572_LinuxSTA_2.6.0.1_20120629/os/linux modules
    make: *** /lib/modules/3.8.7-yocto-standard/build: No such file or directory. Stop.
    make: *** [LINUX] Error 2
    =====================
    Do you have any ideas?
    Thanks so much!

    1. pipechela says:

      same error. any ideas? im trying with raspberry pi

  8. Syed Mohsin Bukhari says:

    Hi, nice guide. Can you please tell me how to uninstall it?

    1. ctheroux says:

      Did you tried?

      sudo make uninstall

  9. […] I found a couple resources for building the drivers, and had to synthesize it into a set of instructions that worked […]

  10. Chauhan says:

    Thank u !! I’ve TP-LINK WDN3200 usb adaptor…can you tell me these steps and driver will be work in Backtrack 5r3??

  11. Toshy says:

    Really great, no bugs, just followed the instructions and it worked immediately!! Thank you

  12. mrjayviper says:

    I was finally able to compile the thing on my raspbian by installing the linux-headers. But it seems the drivers created during the install is for RT2870? o.O

    can someone please help? thanks

  13. mrjayviper says:

    Has anyone got it to work on raspbian? if yes, instructions please. thanks

  14. nick says:

    running modprobe on it seems to have fixed it – connected ok now – hurrah

    1. anon says:

      thanks Nick! (and ctheroux, of course ;)
      I run “sudo modprobe mt7601Usta” at the end and it worked fine! so happy…, it was really doing my head in.
      (needless to say that if your chip is of a slightly different version, you should modprobe the correct module..)

  15. nick says:

    install proceeded ok using already altered files. device recognised and able to select network and enter password, but kernal panic consistently as it tries to connect

  16. clementine says:

    This doesn’t work in 13.04. I once saw an obscure link somewhere that the developers were working on getting it to work in 13.04 but I don’t know when that will be or what. Unfortunately this doesn’t work. :(((((

  17. Doug says:

    Using sudo modprobe rt5572sta kicked it in for me on mint 15. thx! http://ubuntuforums.org/showthread.php?t=2137428

  18. [...] A already modified version of the driver can be found at http://www.ctheroux.com/publicfiles/DPO_RT5572_LinuxSTA_2.6.0.1_20120629_EDITED.tar.bz2.bz2 and saves the hazzle of editing some files of the rt5572 driver. [...]

  19. [...] Eine bereits angepasste Version der Treibers findet man unter http://www.ctheroux.com/publicfiles/DPO_RT5572_LinuxSTA_2.6.0.1_20120629_EDITED.tar.bz2.bz2 und erspart somit die ansonsten notwendigen Modifikationen des rt5572 Treibers. [...]

  20. Istvan Mezey says:

    Thank You !
    My Xubuntu Linux on Fujitsu Siemens Lifebook C1020 workin fine with USB-WiFi TP-Link TL-WDN3200 ! I am happy !

    1. Istvan Mezey says:

      Sorry, not connected to a hidden SSID…

  21. trent says:

    Will this work with the raspberry pi rev 2? In search of dual band single that works.

    Thanks

  22. DoD says:

    It works for me up until the ‘sudo make’ step it says it cant find the directory

    1. MrKaroshi says:

      Any solution for this one? Having the same issue.

  23. [...] USB network adapter and using Ubuntu 12.04 (64 bit). Installed the kernel module per these pages: http://www.ctheroux.com/2012/09/rali…-ubuntu-12-04/ http://bernaerts.dyndns.org/linux/22…k-dwa160-revb2 Both of these procedures are similar, [...]

  24. Radek says:

    the drivers complies and installs OK, it’s telling me that I am connected to the network, but still have no internet access. can’t ping google and chrome won’t even open. I am using ubuntu 12.10 64 bit. Any suggestion?

    1. lang6 says:

      same issue as Radek . Compiled, configured, connected, wpa auth ok but cannot ping my router or have dhcp offer. Set as static, routes are ok with default route using wireless device ra0 .Seen from my router interface as authenticated, so communication seems ok but cannot ping my router despite answer to ping are allowed on the router side

      1. ctheroux says:

        The above does not work yet on 12.10.

        1. Sharl says:

          any solution? i have the same problem on Ubuntu 12.10 amd64 platform with tp-link TL-WDN3321 model which is ralink RT5572 chipset inside.

          p.s.i have a laptop which runs ubuntu 12.10 i686 platform,with it,the driver and this wireless adapter works ok.

          want help.

        2. Kelvin You says:

          Same issue. the DHCP request is sent out. but can not get the DHCP offer. Actually, the DHCP offer exists but dropped by the WiFi card.

      2. starlight says:

        same problem. networkmanager + driver doesnt sent a dhcp request, static ip works, but cannot use this!
        no solution for this issue?

        thanks

    2. Anonymous says:

      I think this is one of the most significant information for
      me. And i am glad reading your article. But should remark on
      some general things, The site style is ideal, the articles iis really nice : D.
      Good job, cheers

Leave your Comment

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


+ six = 7

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Blue Taste Theme created by Jabox