Note: Depending on the GNU/Linux distribution (Debian, openSuSE, etc.) and
version of the Linux kernel you may or may not have to do the
following steps. It is worth giving it a try without any modifications first. We have convinced the kernel developers to enable all (currently known) ELV devices by default. Starting with kernel 2.6.24.2 (e.g. openSUSE 11) the changes below are not required. You can check your running kernel version using the command:
|
One device
If you connect one USB device (FHZ1000PC, FHZ1300PC, EM1010PC, WS300, ...) to
your GNU/Linux server you can use the regular ftdi_sio kernel module.
However, it may not recognize our device. Therefore you need to get the
vendor and product codes:
# lsusb
...
Bus 002 Device 002: ID 0403:e0e8 Future Technology Devices International, Ltd
...
Now you need to edit your /etc/modprobe.conf
or
/etc/modprobe.conf.local
file (depending on your distribution).
Add the following line to it:
options ftdi_sio vendor=0x0403 product=0xe0e8
Replace the vendor and product code with the output of the lsusb
command. The you load the module using:
# modprobe ftdi_sio
Multiple devices
If you're using multiple USB devices (FHZ1000PC, FHZ1300PC, EM1010PC, WS300,
...) you cannot use the method above. You need to modify the ftdi_sio kernel
module to make it work. The following example was done with openSuSE 10.1:
You need to have the kernel-source-version RPM of your current kernel
(see output of uname -r
) installed.
For the EM1010PC you (may) need to add the following line:
# cd /usr/src/linux
# make cloneconfig
# make modules_prepare
# cp /boot/symvers-2.6.*-default.gz /usr/src/linux
# mv symvers-2.6.*-default.gz Module.symvers.gz
# gunzip /usr/src/linux/Module.symvers.gz
# make modules_prepare
# cd drivers/usb/serial
# vi ftdi_sio.h
...
#define FTDI_ELV_WS500_PID 0xE0E9 /* PC-Wetterstation (WS 500) */
#define FTDI_ELV_EM1010PC_PID 0xE0EF /* EM 1010 PC */
Now we need to uncomment some lines to enable all of our devices.
# vi ftdi_sio.c
...
{ USB_DEVICE(FTDI_VID, FTDI_ELV_WS300PC_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_ELV_FHZ1300PC_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_ELV_WS500_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_ELV_EM1010PC_PID) },
...
Remove the /* and */ of your devices and save the file.
# cd /usr/src/linux
Now you have 3 choices:
# mv Module.symvers Module.symvers.notneeded
|
... to build the modules for all of usb serial. If you have a less powerful machine like the ARM-Based NSLU2 then it is sufficient to only build the required module. |
# make modules
| ... to build all modules (takes a long time). |
# make driver/usb/serial/ftdi_sio.ko
| ... to build just the ftdi_sio.ko module. However, this does not seem to be working always. |
# cd /lib/modules/yourKernelVerion/kernel/drivers/usb/serial
# cp ftdi_sio.ko ftdi_sio.ko_backup
# cp /usr/src/linux/drivers/usb/serial/ftdi_sio.ko .
# rmmod ftdi_so
# modprobe ftdi_so
# ls -l /dev/ttyUSB*
crw-rw---- 1 root uucp 188, 0 2007-02-11 23:00 /dev/ttyUSB0
crw-rw---- 1 root uucp 188, 1 2007-02-11 23:00 /dev/ttyUSB1
Device links
If you're using multiple USB devices (FHZ, EM, WS...) it might occur that the
enumeration of the /dev/ttyUSBn numbers get mixed up if one of the
device is missing or after a reboot.
Starting with kernel 2.6 the UDEV
implements means for using virtual names instead of the bare numbers.
Edit the file /etc/udev/rules.d/10-udev.rules
(create if
necessary) and insert the following lines:
If you use udev prior to version 103:
KERNEL=="ttyUSB*", SYSFS{product}=="ELV FHZ 1300 PC", SYMLINK+="elv_fhz1300pc"
KERNEL=="ttyUSB*", SYSFS{product}=="ELV EM 1010 PC", SYMLINK+="elv_em1010pc"
Starting with udev 103 the SYSFS will be replaced by ATTRS:
KERNEL=="ttyUSB*", ATTRS{product}=="ELV FHZ 1300 PC", SYMLINK+="elv_fhz1300pc"
KERNEL=="ttyUSB*", ATTRS{product}=="ELV EM 1010 PC", SYMLINK+="elv_em1010pc"
Now you need to reload (rmmod/modprobe) the ftdio_sio kernel module to
use the device paths /dev/elv_fhz1300pc
or
/dev/elv_em1010pc
in your FHEM configuration file.
Perl Device::SerialPort
On debian you may install the missing Device::SerialPort package with:
apt-get install libdevice-serialport-perl
Logfile config
For a weekly fhem.log rotation add to /etc/logrotate.conf:
/var/log/fhem.log { missingok weekly copytruncate rotate 5 compress }