# D-link DWA-130 wireless usb needs a driver

## whobanil80

I've all most got everything working. It's just my sound and my wireless to go. I've been all over the Internet looking for the driver I need for my usb wireless device. I haven't found much. So as a last resort I come here to ask for some help.

lsusb gives me this info on it:

Bus 001 Device 004: ID 07d1:3300 D-Link System DWA-130 802.11n Wireless N Adapter(rev.E) [Realtek RTL8192SU]

Please give me any thoughts that may help. Thank you!

----------

## Gusar

The r8712u driver supports this thing. It's in the Staging section of the kernel.

----------

## whobanil80

I built it as a module and loaded it. Nothing. It doesn't work with it.

----------

## Gusar

Oh. Well, let me consult my crystal ball about what to do next. Beware though, that pesky thing is kinda flaky.

----------

## Gusar

In case you didn't get it, the above post is a colorful way of saying you haven't provided nearly enough info to receive any help. "It doesn't work" tells us nothing about what might be wrong.

----------

## whobanil80

Oh sorry. I don't know what else to include. What else should I? The LED doesn't light up, and the lsusb command does display it. So I figured the driver doesn't work. I gave you the info that lsusb gives, and I don't know what else I can give. So if you have an idea of what else you need, tell me and I will post.

----------

## whobanil80

Ugh! I just tried the r8192u_usb module and still nothing.

----------

## Gusar

It's always, *always* the same procedure. Doing a search (if the forum search function sucks too much, use google) would've given you the basic steps.

Install wgetpaste, try to connect to wireless, then run these and post the links:

```
dmesg | wgetpaste

zcat /proc/config.gz | wgetpaste
```

Also, how exactly are you connecting, and what's the output of those commands?

----------

## wrc1944

For r8712u info, look at these.  It does work, but it's a PITA right now.

https://forums.gentoo.org/viewtopic-p-6945178-highlight-.html#6945178

https://forums.gentoo.org/viewtopic-p-6949554-highlight-.html#6949554

https://bugs.archlinux.org/task/27996

https://forums.gentoo.org/viewtopic-p-6912478-highlight-.html#6912478

https://forums.gentoo.org/viewtopic-p-6943494-highlight-.html#6943494

----------

## Gusar

It's not nearly that complicated. I think it should work by simply not activating AP mode in the kernel config. If that doesn't work, these two patches should do it:

http://driverdev.linuxdriverproject.org/pipermail/devel/2012-February/024367.html

http://driverdev.linuxdriverproject.org/pipermail/devel/2012-February/024371.html

----------

## wrc1944

Gusar,

I had contacted Larry Finger about 2 weeks ago, and he came up with 2 patches he posted at the Arch bugzilla link I posted above (r8712u_async_fw and rtl8712_fix_ap_mode), which worked in that I could get connections, but the connection link quality and signal levels always dropped over 50% on all 3.2.x and 3.3.x kernels.  He also sent them upstream to the kernel people- I assume to include in mainline.

Also, the connections suffered constant random drop-outs on Gentoo and several distros, with 2 different strong AP's.  Basically, it didn't solve my problems, either with wicd or NetworkManager.  As I mentioned on the links I posted, using the 3.1.x kernel staging/rtl8712 directory in all 3.2 and 3.3 kernels (and I mean ALL 3.2's) solves all problems 100% with connection levels and drop-outs using wicd

The first patch you linked is the same as Larry's rtl8712_fix_ap_mode, but the 2nd patch is different from his r8712u_async_fw patch.

Is this new patch (the 2nd) now the one to use instead of the others, as it appears to refer to the rtl871x_sta_mgt.c source file included the first rtl8712_fix_ap_mode patch?

I'll be giving it a try in the next few days on several systems, both with wicd and NetworkMananger.  Hope this is the final fix with wicd.  I also tried wpa_supplicant, but could never get it to work at all.  Apparently, wpa_supplicant has no (or incomplete) support yet for r8712u, unless I'm missing something in their compatible hardware list.

----------

## Gusar

 *wrc1944 wrote:*   

> Is this new patch (the 2nd) now the one to use instead of the others

 

Looks like it should be used in addition to the fix_ap patch. I didn't know there's further problems with the driver, and it doesn't seem to me like this patch will fix them. Trying doesn't hurt though. The async_fw patch is required for udev>=176, it just changes the way firmware gets loaded, but it doesn't affect functionality otherwise.

 *wrc1944 wrote:*   

> Apparently, wpa_supplicant has no (or incomplete) support yet for r8712u, unless I'm missing something in their compatible hardware list.

 

wpa_supplicant doesn't directly access hardware (except in very few cases, mostly very old cards), it goes via wireless extensions (-Dwext) or netlink (-Dnl80211). r8712u is a wext driver. Also, network-manager is just a frontend, in the background it uses wpa_supplicant. So if pure wpa_supplicant doesn't work but nm does, it's a mistake on your part in configuring it.

----------

## wrc1944

Gusar,

Thanks much for the clarifications.  If I understand correctly, you're saying all 3 patches should be applied?  In my case, I'm using the Rosewill RNX N180UBE Wireless N 300MBs Adapter, so it seems likely I need the r8712u_async_fw patch as it modifies  usb_intf.c and refers to usb in other files.

I have been wondering about my attempts at wpa_supplicant configuration- I followed all the docs carefully, but never could get beyond r8712u was loaded, but wpa_supplicant "was not active."  Wpa_gui wouldn't add a network, and couldn't get it working with editing wpa_supplicant.conf.  Must be missing something somewhere.   :Rolling Eyes: 

----------

## Gusar

 *wrc1944 wrote:*   

> If I understand correctly, you're saying all 3 patches should be applied?

 

The two AP related ones.

The async_fw patch, like I said, it's for udev>=176. If you're using an earlier udev you don't need it.

 *wrc1944 wrote:*   

> I have been wondering about my attempts at wpa_supplicant configuration- I followed all the docs carefully, but never could get beyond r8712u was loaded, but wpa_supplicant "was not active."  Wpa_gui wouldn't add a network, and couldn't get it working with editing wpa_supplicant.conf.  Must be missing something somewhere.  

 

Manual configuration is not that hard really, if you're using a typical WPA-PSK network:

```
echo 'ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel' > /etc/wpa_supplicant/wpa_supplicant.conf

wpa_passphrase your_ssid your_password >> /etc/wpa_supplicant/wpa_supplicant.conf

wpa_supplicant -iwlan0 -Dwext -c/etc/wpa_supplicant/wpa_supplicant.conf

dhcpcd wlan0
```

----------

## whobanil80

Sorry I haven't been on in a long time. I have been working on school, since it is midterm week. Anyway my installation of Gentoo decided that it wasn't going to compile anymore, so I have to reinstall. I have been using the live disc to do homework and such. I will have it installed soon and we can go from there.

@wrc1944 I read the links you posted and I am very interested to try to use the 3.1 driver build, but noobishly I do not know how to compile 3.2 with 3.1 stuff. Also, as far as firmware, am I supposed to do something with it, or leave it be?

Any more details I can give are the facts that my wireless stick works with live disc., perfectly. When I had Gentoo installed, I didn't get anything out of the usb device at all. It didn't light up, /sbin/ifconfig didn't show it. Thus I couldn't even try to connect via wireless, since according to the computer I have no wireless. Thus I couldn't tell you what would happen if I tried to connect. However lsusb shows my device there.

I will try to have Gentoo running again this week.

----------

## wrc1944

whobanil80,

If you want to use a 3.1.x kernel, the r8712u driver from staging will work, as a module, but don't enable the AP option for it in kernel config- it's known to be broken.

If you really need to use a 3.2.x kernel, so far the new  linux-3.2.x/drivers/staging/rtl8712 directory isn't working too well.

However, if you replace that directory with the same exact one from a 3.1.x kernel, and then compile your kernel, it works well with wicd.

Just delete the 3.2 kernel source's rtl87812 directory and put one from 3.1.10 in its place.  I's not a real fix, and the devs are working on it, but it has been a good work-around so far if you need to use 3.2 kernels with a usb wireless adapter needing the realtek  r8712u driver.

The firmware should be placed in /lib/firmware/rtlwifi, if it isn't already there. Look in /lib/firmware, and if you see a rtl8712u.bin  file, you should be fine.  Nothing to do- if it's there the kernel should load it at boot up.

Hope this helps.

----------

## whobanil80

Okay. For testing, I just compiled gentoo-sources-3.1.10-r1 and its drivers. When I boot, It still fails to initialize wlan0. The stick is still not lighting up. Same as usual. However, this time during boot, it said something about the .conf file for the wpa_supplicant. A little investigation and I came to realize that I don't have a config file for it. So I wrote one and ran:

wpa_supplicant -Dr8712u -iwlan0 -c/etc/wpa_supplicant.conf

Driver unsupported 

 :Mad: 

----------

## Gusar

Err, you have direct instructions on how to use wpa_supplicant a few posts up. Not searching the forums is one thing, but not reading the very thread in which you're asking for help?

Then, a few posts even further up, there's instructions for additional info you should provide in case you can't get a connection.

----------

## whobanil80

@Gusar:

Okay I see what you are getting at about the wpa_supplicant. I'll try to run the command with -Dwext and I'll post what happens, and the info you want if it fails. Sorry I don't take a lot of time to read thing carefully, as I read over that before but paid no attention to it at the time. That is because at the time I was not concerned with wpa_supplicant. My bad. Mock me all you want, I'm a full time college student and don't have copious amounts of time to spend on hours of reading other forum posts. That is why I posted my own question. 

Seriously though, I do appreciate both of you helping me. Thank you guys!

----------

## whobanil80

Okay. I just did those thing and here you go:

http://paste.pocoo.org/show/555997/

http://paste.pocoo.org/show/555998/

Using the correct command this time:

# wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf

Could not set interface wlan0 flags: Operation not permitted

Failed to initialize driver interface

This WAS ran as root BTW so don't ask when looking at 'Operation not permitted' I'm not that stupid.

 *Quote:*   

> 
> 
> It's not nearly that complicated. I think it should work by simply not activating AP mode in the kernel config. If that doesn't work, these two patches should do it:
> 
> http://driverdev.linuxdriverproject.org/pipermail/devel/2012-February/024367.html
> ...

 

Honestly, I don't know what to do with these. I did look at them. 

 *Quote:*   

> 
> 
> Also, how exactly are you connecting, and what's the output of those commands?
> 
> 

 

I told you the out put above and I haven't tried to connect yet because my wireless card isn't even "on". I can't get that far. It doesn't run on my installation of Gentoo at all. It does run on the live disc (lights up and is able to connect). lsusb does tell me it is plugged in.

I really don't know what else I can tell you beyond that.

----------

## Gusar

```
r8712u: Loading firmware from "rtlwifi/rtl8712u.bin"

r8712u: Unable to load firmware

r8712u: Install latest linux-firmware

r8712u: Loading firmware from "rtlwifi/rtl8712u.bin"

r8712u: Unable to load firmware

r8712u: Install latest linux-firmware
```

You're missing firmware. Install the linux-firmware package.

----------

## whobanil80

 *Quote:*   

> 
> 
> # wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf
> 
> Could not set interface wlan0 flags: Operation not permitted
> ...

 

I wrote my .conf file. I think I'll post it any way so you can see. I followed an example I found (Yes I do a little research outside of my own post)

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel

network={

        ssid="Spencer_Family"

        key_mgmt=WPA-PSK

        psk="*******"

}

I do have my actual phrase where the ****** is. I don't think anything is wrong here, but just to tell you a little info:

I have a hidden SSID

It is WPA2-personal encrypted

----------

## whobanil80

 *Quote:*   

> 
> 
> You're missing firmware. Install the linux-firmware package.
> 
> 

 

Ah. That would help. One moment

----------

## whobanil80

 :Embarassed:   Missing firmware...

Well that made much more progress! Wireless card is now active. However, 'dhcpcd wlan0' timed out. So I did not connect. My bet is the wpa_supplicant.conf file might not be correct. I will check my pass code. Thank you Gusar!

----------

## whobanil80

Nope, everything is fine there. I'm going to do a bit of research to make sure I did this right.

----------

## Gusar

 *whobanil80 wrote:*   

> I have a hidden SSID

 

That's very valuable info. It means you have to add scan_ssid=1 into the network block in the config file.

----------

## whobanil80

Okay. I added the scan_ssid thing and after reading more on wpa_supplicant I now have these:

/etc/wpa_supplicant/wpa_supplicant.conf

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel

ctrl_interface_group=0

network={

        ssid="Spencer_Family"

        scan_ssid=1

        proto=WPA

        key_mgmt=WPA-PSK

        pairwise=CCMP TKIP

        group=CCMP TKIP WEP104 WEP40

        psk="***************"

}

And

/etc/conf.d/net

modules="wpa_supplicant"

wpa_supplicant_wlan0="-Dwext"

config_eth0="dhcp"

config_wlan0="dhcp"

Still no luck connecting

----------

## whobanil80

I don't know if it is worth noting, but I use AES encrytion. not TKIP. The directions didn't say anything about these so *shrugs*

----------

## Gusar

 *whobanil80 wrote:*   

> 
> 
> ```
> ctrl_interface_group=0
> ```
> ...

 

This shouldn't be there, you've already set the group in the line above it. The setting is either:

```
ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=0
```

or

```
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=root
```

I use the wheel group instead, so that I can mess with stuff using wpa_cli as a regular user. But this shouldn't matter really. So since you don't get a connection let's try this: connect manually, but with debug output:

```
wpa_supplicant -d -iwlan0 -Dwext -c/etc/wpa_supplicant/wpa_supplicant.conf
```

Post the output of that.

Also, you said the network is WPA2, but your config has proto=WPA, that could also be a problem. For WPA2 proto should be set to RSN. Or don't set proto at all, wpa_supplicant can figure out this stuff on it's own. Same goes for key_mgmt, pairwise and group.

Then there's also the possibility that the r8712u driver just plain doesn't like hidden networks. They're a pain, it's known they cause problems with some drivers. And the network is not really hidden, one can easily sniff it out. So I suggest to reconfigure the router, make the network not hidden. Then remove scan_ssid=1 and try again.

 *Quote:*   

> I don't know if it is worth noting, but I use AES encrytion. not TKIP. The directions didn't say anything about these so *shrugs*

 

AES is CCMP, you've set that, so not an issue. The WPA vs RSN thing might be, as I said above.Last edited by Gusar on Fri Feb 24, 2012 12:08 pm; edited 2 times in total

----------

## whobanil80

Well, contradictory to my system clock, it is 4AM (it says 8PM lol) and I'm heading to bed. So I will check in later. Thank you for your help tonight and I would shake your hand if shoving my hand through the computer screen wouldn't result in a painful mess.

----------

## whobanil80

As a quick try before I went to bed, I removed the extra/wrong crap from the .conf and tried it out. All I can say is, I'm typing this connected via wireless. THANK YOU! I have learned quite a bit from this experience and again I'd love to shake your hand, but I can't. You are awesome!

----------

