Synology DSM Unsupported Usb Wifi Dongle Integration
In this first post i will talk about Synology nas, specialy the DS218J i bought recently.
I want to connect my nas in wifi using my D-link Dwa131 usb wifi dongle.
Surprisingly he does not recognize my device.
After googling around it came that the DS218J ony support D-Link DWA131 A1, wich use RTL8192SU chip, while my D-Link DWA131 E1 use a RTL8192EU chip.
The Synology don’t have a driver for that chip.
I do not want to purchase another dongle so i decided to figure out how i can integrate myself to fully support my hardware.
First i need to take the linux driver for that chip and cross compil it to be used in the DSM.
I choose https://github.com/Mange/rtl8192eu-linux-driver, it’s the official one with additional patch to keep it working on newer kernel.
To cross compile a kernel module for the DSM we need to get the cross compilation toolchain and kernel source provided by synology (thanks).
According to the uname output above i download the following toolchain:
https://sourceforge.net/projects/dsgpl/files/DSM 6.1 Tool Chains/Marvell Armada 38x Linux 3.10.102/
And the below kernel source:
https://sourceforge.net/projects/dsgpl/files/Synology NAS GPL Source/15047branch/armada38x-source/linux-3.10.x-bsp.txz/
Extracted both and moved the compilation toolchain folder under /usr/local
First set environment variable for cross compilation
KSRC is the folder where the kernel source where extracted. After that, copy the appropried kernel conf for your hardware and make dep and modules
So the last step before compiling is to modify the makefile of the driver.
set
add a new variable below
and add the condition below
Save the makefile and compile the driver
Copie the rtl8192eu.ko file to the /lib/modules/ folder of the nas.
Load our previously compiled driver with insmod and plug the dongle to confirm that your device is reconized.
So, wifi dongle is corrected reconized and cli configuration of wifi network is functionnal but it not appeare in the DSM Web Gui.
After little reversing of diverse component, DSM web gui use a file placed in tmp with name pattern of wireless.conf{id} wich describe the usb dongle.
This file is generated by udev scripts under /lib/udev/scripts wich also initialize wifi deamon and other wireless related configs.
To accomplish that, we need to add an entry in the usb.wifi.table under /lib/udev/devicetables/ and modify the udev script wich handle usb wifi events.
By issuing lsusb we get necessary informations:
Usb Vendor ID is 2001 and Product ID is 3319
We need to add an entry to the usb.wifi.table with these info and the driver name.
The last step is to modify the usb-wifi-utils.sh script to support our device.
At the top of this file add an entry for our device chip.
Locate the select_modules
function and add this switch
Now plug the usb dongle and Synology Web Gui will reconize your device.
This procedure can be applied to other unsuported usb wifi dongle if you have the corresponding linux driver source.
und3ath.