Tutorial: install a Aeotec z-stick on a QNAP TS-231P server with Openhab

Problem:
I own a QNAP ARM NAS server type TS-231P release QTS 4.4.1.0998 (2019/07/15)
and want to install a Z-Wave network controlled by my QNAP.
The linux OS is: 4.2.8
I use OpenHab to manage smart Home but it should work with other software.

To manage the z-wave network I bought an AEOTEC z-stick GEN5 USB and connect it to the NAS but the USB stick is not reconized by the NAS.

Solution:

1- Activate telnet on the NAS and connect in terminal mode with ie. Putty from a laptop.

2- to see the release of Linux:

uname -a

3- Connect the USB stick on the NAS thru a USB port. I used the front one

4- You should see the USB stick (Sigma Design) with:

lsusb

Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 0658:0200 Sigma Designs, Inc.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

5- You need to install a module called “cdc-acm.ko” in the system if when you do:

ls /dev/tty*

you can’t see the device ttyACM0 or ttyACM1

ls /dev/ttyA*

/dev/ttyACM0

6- You need to download the QNAP source suitable for your exact OS release and NAS model, then compile, then make a module and install the module.

6a - Download and Install a compiler and tools on the NAS, ie ENTware-std: https://www.qnapclub.eu/de/qpkg/556
To install the packag, Use the App Center interface on the NAS, the “Manual install” icon, then indicate the package file: Entware_1.00std.qpkg

6b- Download the QNAP source of Linux:


download: /QNAP NAS GPL Source/QTS 4.4.0/GPL_QTS-4.4.0-20190806_Kernel.tar.gz
unflate the files somewhere:

tar xvf GPL_QTS-4.4.0-20190806_Kernel.tar.gz

In the directory GPL_QTS you have the tree “src” with all the OS release
and the tree “kernel_cfg” with the exact compiler configuration file for your QNAP model.

6c- Copy the compiler configuration file in the right place of the source.
Tricky because X letter signify any (ie. TSX31X is suitable for TS231P)

cp kernel_cfg/TSX31X/linux-4.2.arm src/linux-4.2/.config

6d-Edit the file .config and modify the line: CONFIG_USB_ACM=m (to create a module)

7- Compile from the src/linux-4.2 directory:

make

make drivers/usb/class

Normally a file drivers/usb/class/cdc-acm-ko is created. Save this file is a safe place.

8-Load cdc-acm-ko module in the kernel

insmod cdc-acm.ko

Normally the driver /dev/ttyACM0 is created.

9- Make the release permanent
The problem with QNAP is that it’s a memory kernel and when the NAS reboot you lost your module.
You need to make a dummy package

Read to understand how to do that:

Summary

This text will be hidden

1 Like

It is strange their OS is not modular like Linux and most any modern OS.

It’s a Linux OS but not 100% vanilla. Looks really like a Ubuntu Linux. You need to find the cdc-acm.c and compile it with a cross compiler for ARM to create a module. The module must be then load in the kernel with insmod command.

Too bad a Raspbian module would not likely work since it is for ARM too.

No you need the right source for the right OS and hardware.

When it comes to device drivers, Linux is not very modular. The device drivers need to be directly pulled into the kernel. On Raspbian and more general purpose Linux distros, the drivers needed are built into the kernel by default. OP’s instructions above show how to build and pull the missing device drivers needed to get Zwave to run on the highly customized Linux running on QNAP.

insmod is to insert the kernel module. I believe it needs to be compiled using the kernel headers matching the kernel though. It has been a little while since I compiled Linux,

It’s easy and works very well following the tutorial.
You could make it working for any QNAP server and almost any compatible QTS version.
I also upgrade to QTS 4.4.1.1146 and Openhab 2.5 and it’s still working.

1 Like