Oct 072012
 

DWA-125_cap_on

My new desktop don’t has an integrated wireless card, but has 10 USB ports, so I’ve decided to use an external USB/Wireless adapter to connect it to the WI-Fi at my home, using a cable is not an option, I’ve the router in another room, and it would be a mess to bring it to the desktop, so without doing any research on the net for linux-friendly adapter (and i really suggest you to do this if you want to buy one) I’ve bought a D-LINK N 150 aka DWA-125 on the local mall, basically I’ve bought the cheapest adapter with a name i know.

And setting this up it’s been the hardest part of all the new installation, if you have the “luck” to have this hardware this small guide can perhaps help you too, I’ve done it on a Mint 13, but this should work flawlessly on Ubuntu and Debian as well, and probably on most distributions.


Verify your device

As first thing verify that you have the same adapter I’m using, to check this connect it to an usb port and, open a terminal and run the command lsusb, you should have an output like this one

linuxaria@mint-desktop ~ $ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 003: ID 04e8:61b6 Samsung Electronics Co., Ltd
Bus 001 Device 004: ID 058f:6364 Alcor Micro Corp. Hi-Speed 7-in-1 Flash Card Reader/Writer [Sabrent]
Bus 002 Device 003: ID 2001:3c19 D-Link Corp.
Bus 002 Device 004: ID 0424:2524 Standard Microsystems Corp. USB MultiSwitch Hub
Bus 002 Device 005: ID 050d:0102 Belkin Components Flip KVM
Bus 002 Device 006: ID 046d:c315 Logitech, Inc. Classic New Touch Keyboard
Bus 002 Device 007: ID 046d:c01d Logitech, Inc. MX510 Optical Mouse
Bus 001 Device 005: ID 0951:1643 Kingston Technology DataTraveler G3 4GB

In my case it’s the device 003, the important numbers to identify the usb hardware are 2001:3c19 these 2 numbers indicates the Vendor:Product, you can also use a more verbose output with lsusb -v :

linuxaria@mint-desktop ~ $ lsusb -v -d 2001:3c19
Bus 002 Device 003: ID 2001:3c19 D-Link Corp.
Couldn't open device, some information will be missing
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x2001 D-Link Corp.
idProduct 0x3c19

bcdDevice 1.01
iManufacturer 1
iProduct 2
iSerial 3
bNumConfigurations 1
...

So if you have that couple of numbers, you have the same device I’m using and so you can continue to follow this how-to, if your numbers are different, sorry this will not probably help you.

Add the correct Module to the Kernel

I’m using the kernel: 3.2.0-23-generic at 64 bit, and for what I’ve found (but i could be wrong of course) there is not module included for the D-Link DWA-125 so we must download the correct driver source, compile it and insert the module into the kernel..but don’t worry it’s not so hard.

1) Download from the page: http://www.ralinktech.com/en/04_support/support.php?sn=501 the file “RT8070 /RT3070 /RT3370 /RT5370 /RT5372 USB” with date 03/28/2012 and version 2.5.0.3 or a newer one if you find it.

2) Now open a terminal and extract the driver and do a cd in the new directory

tar -Jxvf 2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO.bz2
cd 2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO

3) Now we have to enable WPA for the driver, so edit the file: 2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO/os/linux/config.mk and change these 2 parameters that otherwise are set to N:

‘HAS_WPA_SUPPLICANT=y’
and
‘HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=y’

4) Now in the terminal run the command:

make

And you can safely ignore this error: cp: cannot create regular file `/tftpboot’: Permission denied

5) Now we have the module, we have to copy it in the correct position and load it:

sudo cp ./os/linux/rt5370sta.ko /lib/modules/`uname -r`/kernel/drivers/net/usb/

Next do

sudo depmod -a

and then copy the default configuration file:

sudo mkdir -p /etc/Wireless/RT2870STA/
sudo cp RT2870STA.dat /etc/Wireless/RT2870STA/RT2870STA.dat
sudo modprobe rt5370sta

6) Now you should be able to use network-manager or any other tools such as wicd or command line to configure the wifi.

7) If everything works, load automatically this module adding it to the file /etc/modules, as last line add:
rt5370sta

You have to re-do this for any new major release of the kernel, unless it will be included in the new one…we’ll see, for the moment is working and it’s stable.

Thanks to: Pclinuxos Forum

Popular Posts:

Flattr this!

  12 Responses to “How to use a D-LINK – Wireless N 150 usb adapter on Linux”

  1. Hi i am using the same info that you and mint, but when i try to extract te package it said:
    xz: (stdin): File format not recognized
    tar: Child returned status 1
    tar: Error is not recoverable: exiting now

    • Quick solution, can you upgrade to Mint 14 ?
      On that kernel the support is directly on the standard kernel and so you don’t need anymore to compile that extra module 🙂

  2. Thanks a tonn mate, I got my DLink D123 working in Ubuntu 12.04 successfully following ur instructions 🙂

  3. it is:

    tar –jxvf

    and NOT

    tar -Jxvf

  4. link not working

  5. Grazie a questa guida sono riuscito a configurare la mia DWA-125 su Ubuntu 13.10 32bit. Ho dovuto in più occasioni deviare da essa per raggiungere lo scopo.
    1) Il file dei driver per Linux era stato aggiornato e cambiato in parte il nome.
    2) Per scompattare l’archivio dei driver ho usato l’interfaccia grafica e non il terminale, giacché continuavo a ricevere messaggi di errore.
    3) compilato il file ho ricevuto messaggi di errore quando ho tentato di inserirlo e caricarlo nella giusta posizione. Sono andato a vedere con “dir” cosa c’era nella directory “./os/linux…” e ho trovato che il file presente non era il “rt.5370sta.ko” bensì “rt5572sta.ko”.
    Una volta corretta la mira ha funzionato, i passi successivi hanno funzionato così come riportato nella guida.
    La mia DWA-125 sta funzionando meravigliosamente. Grazie!

  6. Thank you SO, SO MUCH! I was pulling my hair off trying to get this to work again, after some ubuntu updates. You saved me from switching back do Windows. For those who, like me, had a hard time understanding how to download the driver, this is the page (08/23/14): http://www.mediatek.com/en/downloads/rt8070-rt3070-rt3370-rt3572-rt5370-rt5372-rt5572-usb-usb/ .

    The only thing different is that make didnt made a rt5370sta.ko. Instead, I got this rt5572sta.ko. It just works the same way, following the step by step.

    Thanks again!

  7. Thank you so much
    This manual is very useful

 Leave a Reply

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=""> <s> <strike> <strong>

(required)

(required)

*