Posts

Showing posts with the label wireless

Compiling the 8192eu driver for the Raspberry Pi

I recently had the need to Wi-Fi enable a Raspberry Pi and so bought a D-Link DWA-131 Wireless USB Adapter.  I knew from something I'd read that it was a bit of a gamble in terms of whether it would be supported by the Pi under Raspian.  It turns out there are currently 3 revs of this adapter with different chipsets in each.  The one I got was the latest E1 version identified with the USB Device ID 2001:3319 that requires the realtek 8192eu driver.

Here's how to get it working under the September 2015 Raspian Jessie running Kernel 4.1.7+ for which I found some similar instructions a helpful starter:

1.  Get up to date and ready for compilation

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential git


2. Grab the Driver Source

git clone https://github.com/romcyncynatus/rtl8192eu.git

or from

http://support.dlink.com.au/download/download.aspx?product=DWA-131


3. Patch the driver source for Kernel 4.x

cd rtl8192eu
Apply the following patch to rtw_android.c

diff --git a/os_dep/linux/rtw_android.c b/os_dep/linux/rtw_android.c
index 40ddf07..f7c496e 100755
--- a/os_dep/linux/rtw_android.c
+++ b/os_dep/linux/rtw_android.c
@@ -342,7 +342,11 @@ int rtw_android_cmdstr_to_num(char *cmdstr)
 {
        int cmd_num;
        for(cmd_num=0 ; cmd_num<ANDROID_WIFI_CMD_MAX; cmd_num++)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
+               if(0 == strncasecmp(cmdstr , android_wifi_cmd_str[cmd_num], strlen(android_wifi_cmd_str[cmd_num])) )
+#else
                if(0 == strnicmp(cmdstr , android_wifi_cmd_str[cmd_num], strlen(android_wifi_cmd_str[cmd_num])) )
+#endif
                        break;

        return cmd_num;



4. Grab the rpi-source tool (to download the Pi kernel source)

wget https://raw.githubusercontent.com/notro/rpi-source/master/rpi-source 
chmod +x rpi-source
sudo mv rpi-source   /usr/bin/
sudo rpi-source -q --tag-update


5. Install the Pi kernel

sudo rpi-source --skip-gcc


6. Build and install the driver

make ARCH=arm
sudo make ARCH=arm install
sudo bash -c 'echo "options 8192eu rtw_power_mgnt=0 rtw_enusbss=0" > /etc/modprobe.d/8192eu.conf'
modprobe 8192eu

Squeezebox Duet is alive at last

Back in the middle of May I decided to set up my home stereo properly in our new house so I ordered a new stereo (an Onkyo CR-515) and decided to replace an old Thinkpad I used to store my digital music collection with a new device on the market from Slim Devices, the SqueezeBox Duet and a low-power PC as a media server.

Initially I wasn't able to set it up as I was experimenting with using a Linksys NSLU2 (or slug) as the media server. Unfortunately, this was vastly underpowered for the job so I had to re-think that part of my solution. In late June I had my new server so I looked out some pictures I took while unpacking and wrote my first post about the SqueezeBox Duet.


It's only now I'm able to write that I've successfully set up my complete solution as of the start of September. I've been having huge difficulties getting the box to stream audio properly with all sorts of symptoms. I'll spare the long description and cut to the solution, I changed my wireless router settings from its default channel 11 setting to channel 1 and everything sprung into life. During my 3 months of debugging to find this simple solution I contacted Slim Devices through various means, forums, chat channels, and official support. While the staff were extremely keen to help and reasonably responsive given the time difference between California and the UK, at no point did they give me any useful suggestions towards the successful solution. It was this that prompted me to think about the different types of open source. Now I can conclude that you're pretty much on your own with a SqueezeBox, but that's something I can live with quite easily, so now it's working I'm a happy bunny.

For future reference, next time I move house I'll do a scan of the local wireless networks much earlier and change my channel accordingly. I'm no wireless expert but then I'm no dummy either, so when I can communicate over my wireless network with several devices including more than one laptop, a Nintendo Wii and the SqueezeBox Duet Controller, I would suggest it's reasonable to expect the other half of the Duet (the Receiver) to work too. Not so apparently.