2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

Peters suggestions

git-svn-id: https://svn.fhem.de/fhem/trunk@238 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2008-09-07 13:30:49 +00:00
parent 076f2c8345
commit 1f17ec6e27

View File

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