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.

49 thoughts on “Ralink RT5572 based WiFi Usb Dongle setup on Ubuntu 12.04

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

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

  3. @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. 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.

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

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

        • 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. 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.

    • 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. 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. 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!

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

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

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

  11. 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

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

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

    • 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..)

  14. 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

  15. 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. :(((((

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

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

    Thanks

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

  19. 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?

    • 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

        • 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.

        • 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.

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

        thanks

    • 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

    • Thank you for every other informative site.
      Where else could I am getting that type of info written in such an ideal means?

      I’ve a venture that I am simply now operating
      on, and I’ve been on the look out for such information.

      Have a look at my web site: Rayford

Comments are closed.