Get serial devices working on Synology DS216+II DiskStation

Hi all,
Since a few months I’ve bought myself a DS216+II with DSM6.1 installed. I installed the OH2-package on it. I’ve got a few bindings working already but I can’t get any binding getting to work which use a USB port. Too much unanswered question… this really drives me nuts.

For example; I connected a ‘Plugwise stick’ to one of the USB-ports, I see it appears on port 1-2 when I use the ‘lsusb-command’. Which path/port do I have to configure in the bindings?

Most of the examples I’ve Googled, use paths like /dev/ttyACM0, but I can’t find the ttyACM0 on the /dev/-location. I did find USB in the /sys/bus/usb/devices/-location. Which location do I have to use?

Do I have to do something with ‘groups’ or something?

I hope some of you has experience adding serial devices to a DS216+II and can help me on the right track.

Thanks already for your help.

Regards.

@Jaco What will probably help is to also load the usbserial.ko and ftdi_sio.ko kernel modules. These modules will most likely already be on your NAS in a directory named /lib/modules.

To load these modules issue the following commands:

sudo insmod /lib/modules/usbserial.ko
sudo insmod /lib/modules/ftdi_sio.ko

Now when you insert the Plugwise Stick into your NAS you can check with the dmesg command what path is assigned to it. I just tried this with my Stick on a 415+ NAS with DSM 6.1 and this was the output of dmesg:

[302774.647724] ftdi_sio 1-1.3:1.0: FTDI USB Serial Device converter detected
[302774.655477] usb 1-1.3: Detected FT232RL
[302774.659880] usb 1-1.3: Number of endpoints 2
[302774.664764] usb 1-1.3: Endpoint 1 MaxPacketSize 64
[302774.670235] usb 1-1.3: Endpoint 2 MaxPacketSize 64
[302774.675704] usb 1-1.3: Setting MaxPacketSize 64
[302774.681429] usb 1-1.3: FTDI USB Serial Device converter now attached to ttyUSB0

Without loading the modules my NAS also would not detect the Stick. I haven’t further tested it with openHAB but I guess it should work! Most likely the /dev/ttyUSB0 file also needs to be assigned the right permissions and something needs to be done to also load the modules after the NAS is restarted.

Additional serial driver modules

It seems there was a separate package for adding Serial Driver support to Synology NAS-es by a Domoticz user at http://www.jadahl.com . However it is no longer maintained or available. The site still has complete packages with Domoticz installations that do contain additional Serial Drivers and scripts to load them.

  • To get these additional drivers and startup scripts you can download the appropriate Domoticz SPK from http://www.jadahl.com/domoticz_stable_6.1/ .
  • When you rename the .spk to .tar.gz and extract it you will also have a package.tgz file. The package.tgz file contains additional kernel modules in the /modules directory.
  • The SPK also has a /scripts directory with a file named start-stop-status. The method start_daemon shows how these additional modules are loaded. Normally it is just with insmod, on some older DSM versions the script also executes some additional logic to dynamically create the /dev/ttyXXX files.
1 Like

@wborn I won’t be too happy yet, but it seems that at least one of my questions is answered :smile:

When I use the dmesg-command, I can see the stick is connected to ttyUSB0

I will try to get the device working in openHAB… I will keep you informed.

Many thanks already!

Regards Jaco

1 Like

Thanks again @wborn, your answer solved my problem.

For people who’re having the same problem in the future;

Edit or create the file startup.sh via:

sudo vi /usr/local/etc/rc.d/startup.sh

Put the next text into the file:

sudo insmod /lib/modules/usbserial.ko
sudo insmod /lib/modules/ftdi_sio.ko
sudo chmod 777 /lib/modules/usbserial.ko
sudo chmod 777 /lib/modules/ftdi_sio.ko

Change rights of startup.sh:

chmod 700 /usr/local/etc/rc.d/startup.sh

The next time your NAS reboots, modules will be starten automatically.

3 Likes

Thanks for following up on this @Jaco! Now I can also start using my NAS as a hot spare for running openHAB. :slight_smile:

Hello

I have also a DS216Play. When I plug my USB-to-Serial adapter based on PL2303 chip, I can see it in the info center of DSM.
If I use the SSH to search the port of it, I see nothing. No ttyUSB0 or ttyACM0.
I didn’t find on google what is going on.

|__usb1 1d6b:0002:0310 09 2.00 480MBit/s 0mA 1IF (ehci_hcd ehci-platform.0) hub
|__usb2 1d6b:0001:0310 09 1.10 12MBit/s 0mA 1IF (Linux 3.10.105 ohci_hcd Generic Platform OHCI Controller ohci-platform.0) hub
|__2-1 067b:2303:0300 00 2.00 12MBit/s 100mA 1IF (Prolific Technology Inc. USB-Serial Controller c6a3cfa3ccbecaa4cb88a8c4a5ccbedb)
|__usb3 1d6b:0002:0310 09 2.00 480MBit/s 0mA 1IF (Linux 3.10.105 xhci-hcd xHCI Host Controller xhci-hcd.0.auto) hub
|__usb4 1d6b:0003:0310 09 3.00 5000MBit/s 0mA 1IF (Linux 3.10.105 xhci-hcd xHCI Host Controller xhci-hcd.0.auto) hub

Any suggestions ?

Tx

Antoine

Thanks for the guidance on this one!
I can confirm this method works also on old Synology NAS as well - I have DS1010+ that cannot upgrade beyond DSM5.

To make this work on boot for my NAS i had to add the commands to /etc/rc.local --> the one in /usr/local/etc/rc.d/ did not execute on boot.

I used FTDI based USB to RS485 and had to load both usbserial and only then ftdi.

Hi, thanks for this artikel.
I executed also
insmod /lib/modules/cdc-acm.ko
now I can use the cdc-standard usb-serial converters. My LCD, which supports this protocol works now on the Synology NAS!

Hi, I used the additional drivers from USB drivers for DSM 6.2

UsbSerialDrivers DSM 6.2 v6-4 for my DS716+II with EnOcean Gateway USB 300

lsusb gives me=
__3-1 0403:6001:0600 00 2.00 12MBit/s 90mA 1IF (EnOcean GmbH EnOcean USB 300 DC FT4YFL3J)

dmesg|grep usb gives me=
[ 105.637815] usbserial: USB Serial support registered for FTDI USB Serial Device

ls -lisa /dev/ttyUSB0
934931 0 crw-rw-rw- 1 root root 188, 0 Apr 11 20:13 /dev/ttyUSB0

creating the Enocean Gateway in Openhab3.0.1 won’t work (port could not be found)

Can you put me in the right direction please ?
I’m a beginner

Solved.

You need to check “Execute container using high privilege” in the tab General settings in the UI of Docker?

and from the Documentation:

USB sticks

If you want use an USB stick (for example for Z-Wave network), then it will be not available for the dockerized system by default. In Docker openHAB is running in name of openhab, a restricted user. The stick will work if you run the following command right after docker image is started.

(in my case)

docker exec \
    -d \
    openhab-openhab1 \
    /bin/chmod o+rw /dev/ttyUSB0

when you start the container after a stop you need execute the command again

This command changes permissions of the specific device as expected (readable and writable for everyone).

Note

The device path (/dev/ttyACM0) or container name (openhab) could be different in your system, command can be modified accordingly.