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