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 methode 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.
This may take a while. Go read a book, have lunch or ...
# cd /usr/src/linux
# make modules
...
# 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 .
To make it become active you may need to stop applications (like fhem) who
are using the /dev/ttyUSB device and unload the module and load it again.
# rmmod ftdi_so
# modprobe ftdi_so
You should now see multiple ttyUSB devices:
# 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/50-udev-default.rules
and append the following lines in the block labled as serial devices:
KERNEL=="ttyUSB*", SYSFS{product}=="ELV FHZ 1300 PC", SYMLINK+="elv_fhz1300pc"
KERNEL=="ttyUSB*", SYSFS{product}=="ELV EM 1010 PC", SYMLINK+="elv_em1010pc"
Now you need to reboot your box (unfortunalty) and once the system has come up
again you can use the device paths /dev/elv_fhz1300pc
or
/dev/elv_em1010pc
in your FHEM configuration file.