Trying to get DWA-131 adapter to work
-
Hello,
I just bought a DWA-131 wireless adapter for my raspberry pi 3 with recalbox img.
I bought this one because I saw this thread in the french forum https://forum.recalbox.com/topic/338/résolu-problème-clé-wifi-dlink-dwa-131/3 and the guy said that he got it to work, so I decided to give this adapter a shot.
For my surprise it doesn't seem to work out of the box, so started googling and discovered that you need to install some drivers in order to the adapter work, more specifically this one: r8712u . I also saw that you need to compile it in the distro you are running using the make command, which is a cmd that recalbox doesn't seem to have.
That got me to thinking on how that french dude got this adapter working and I went to his post again and saw that it is from 3 years ago, so I guess that this adapter must have worked on a previous version of recalbox, but doesn't work anymore. Using the find command I also noticed that there is a r8712u.ko file under the modules folder of the recalbox which doesn't seem to be loaded on the system (lsmod), so I loaded it with modprobe, and it started to appear on lsmod, but still didn't work.
Can someone shed some light on why is this happening, someone with some linux experience, some dev? Did it use to work but doesn't anymore? Can we compile a version of this driver on recalbox?
Thx.
UPDATE: Actually, looking at his dmesg when pluggin the dongle this is the driver being used rtl8192cu, which seems to be located at /lib/modules/4.4.13-v7/kernel/drivers/net/wireless/realtek/rtl8192cu
UPDATE2: my dmesg
[ 540.157467] usb 1-1.4: new high-speed USB device number 7 using dwc_otg [ 540.257847] usb 1-1.4: New USB device found, idVendor=2001, idProduct=3319 [ 540.257856] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 540.257863] usb 1-1.4: Product: Wireless N Nano USB Adapter [ 540.257868] usb 1-1.4: Manufacturer: Realtek [ 540.257874] usb 1-1.4: SerialNumber: 00e04c000001
when using modprobe
[ 226.268704] usbcore: registered new interface driver rtl8192cu
-
Apparently the driver could be outdated and does not include the ID(2001:3319) from the new dongle revision (E).
On this post https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=33588&start=25 MrEngman explains it and compiles the driver inserting the new ID so the adapter can be recognized.
Anyway this new version can be included? Is there a way I can do it, or just the devs?
-
@alcartur hey !
First of all, glad you made your part of the work ! This is really helpfulNow : we're still on the 4.1 kernel branch. My work to move to 4.9 is over, but i still have quite some work on other boards.
So here is the trick :
- if you do need the driver now, we can patch the kernel to add your id
- if you're not in a hurry and enjoy the on-board pi3 wifi, make sure it's supported in kernel 4.9
- if you are a true fearless viking in your mind, you can submit a merge request on our gitlab. If you want to go this way, i can help you
-
@substring Hello,
Thanks for the quick reply!
D-LINK seems to make their driver for this dongle available for compilation here: ftp://files.dlink.com.au/products/DWA-131/REV_E/Drivers/DWA-131_Linux_driver_v4.3.1.1.zip
A preview from their readme file:
Fedora 14.0 Install: 1. su-> enter your root password(if need to do 2. and 3.) 2. yum install gcc(if necessary) 3. yum install kernel-PAE-devel(if kernel doesnt support PAE, type : yum install kernel-devel)(if necessary) 4. tar zxvf 20140812_rtl8192EU_linux_v4.3.1.1_11320.tar.gz and cd to 20140812_rtl8192EU_linux_v4.3.1.1_11320 5. make 6. su-> enter your root password(if not do 1. 2. 3.) 7. make install
I don't know if this is helpful too.
- if you do need the driver now, we can patch the kernel to add your id (This would be my prefered choice)
- if you're not in a hurry and enjoy the on-board pi3 wifi, make sure it's supported in kernel 4.9 (I'd like to use the dongle, because I'm getting only 700kbps-1mbps when transfering files through the internal wifi, since the pi is on the other room)
- if you are a true fearless viking in your mind, you can submit a merge request on our gitlab. If you want to go this way, i can help you (I think this would be a very long journey until getting this to work haha, but if the first choice isn't possible, I'll take it)
Thanks again!
-
@alcartur there is no kernel patch in what i've read
-
@substring I see, so the only way is the option 3 then? If so, could you please help me with some macro steps that I would need to follow?
-
@alcartur first, if you find me a kernel patch or which file has to be patched, I can do it. I just don't want to spend time looking for that by myself as i have a too little knowledge in kernel code.
-
@substring Thx for the help, but I got it working now!
There are a few things I did:
- Downloaded the .ko module from : http://www.fars-robotics.net/8192eu-4.4.13-v7-894.tar.gz and placed the 8192eu.ko file under /lib/modules/4.4.13-v7/kernel/drivers/net/wireless/realtek/rtl8192eu/
- Created a file 8192eu.conf on /etc/modprobe.d/ with the following content:
options 8192eu rtw_power_mgnt=0 rtw_enusbss=0
- Edited the file /etc/network/interfaces and it looks like this now:
# Configure Loopback auto lo iface lo inet loopback auto wlan1 iface wlan1 inet dhcp allow-hotplug wlan1 wpa-ssid xxxxxxx wpa-psk xxxxxxxxxx
The only thing left now was to include the driver dependencies on the modules.dep file which could be done automatically by running depmod but I don't know why recalbox doesn't have this command, so I deduced that maybe this driver dependencies were the same as the 8192cu.ko so I just used the same dependencies for this one and it worked.
- Just place this line at the end of the file /lib/modules/4.4.13-v7/modules.dep
kernel/drivers/net/wireless/realtek/rtl8192eu/8192eu.ko: kernel/net/wireless/cfg80211.ko kernel/net/rfkill/rfkill.ko
After doing all of this I rebooted and the wifi didn't seem to work, but just shutting it off and on again through the interface made it work, I don't know why, but aparently, the wifi wasn't working at boot anymore. So to fix this I just created a boot script
- At the dir /etc/init.d I created a file S99MyScript with the following content and made it runnable with chmod +x S99MyScript
#!/bin/bash case "$1" in start) echo "starting wifi" /usr/bin/connmanctl enable wifi /usr/bin/connmanctl scan wifi ;; stop) Add your shutdown code here! ;; restart|reload) echo "starting wifi" /usr/bin/connmanctl enable wifi /usr/bin/connmanctl scan wifi ;; *) esac exit $?
It seems that the script S09wifi already does this, but it has some conditions and I don't want to debug it.
From what I remember this was all I did, maybe you guys can implement something like this on the next release?
Thanks again for the patience and replies.
-
@alcartur i wouldn't add such a specific thing for your adapter only. For custom bootscripts, the S99custom calls
~\custom.sh
, take advantage of itI.d still need the edits made to the source code of the kernel module.
Do you know if your wifi adapyer works out of the box in kernel 4.9 ?
-
@substring There weren't source code edits.
At first I thought that the module used by my dongle was the rtl8192cu, which exists on the kernel, this was true only on the previous revisions of my dongle, that's why the french dude mentioned it, the E revision now uses the rtl8192eu which doesn't exist on the kernel, so what I did was to place the new 8192eu.ko module on the kernel.
Do you know if your wifi adapyer works out of the box in kernel 4.9 ?
I guess it doesn't.
Here is a discussion on the reddit talking about why this driver doesn't exist on the kernel by default: https://www.reddit.com/r/linux/comments/47bggn/why_doesnt_the_rtl8192eu_be_supported_by_default/ -