2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 16:56:54 +00:00

Optional baudrate for CUL

git-svn-id: https://svn.fhem.de/fhem/trunk@601 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2010-03-22 09:34:32 +00:00
parent 638cd6567c
commit bdd43ea7ec
3 changed files with 30 additions and 10 deletions

View File

@ -580,3 +580,5 @@
- =DATE= (5.0) - =DATE= (5.0)
- feature: KM271: Read only - feature: KM271: Read only
- bugfix: 99_SUNRISE_EL endless loop bug - bugfix: 99_SUNRISE_EL endless loop bug
- feature: CUL: optional baudrate spec in definition

View File

@ -929,6 +929,10 @@ CUL_OpenDev($$)
$selectlist{"$name.$dev"} = $hash; $selectlist{"$name.$dev"} = $hash;
} else { # USB Device } else { # USB Device
my $baudrate;
($dev, $baudrate) = split("@", $dev);
if ($^O=~/Win/) { if ($^O=~/Win/) {
require Win32::SerialPort; require Win32::SerialPort;
$po = new Win32::SerialPort ($dev); $po = new Win32::SerialPort ($dev);
@ -952,6 +956,17 @@ CUL_OpenDev($$)
delete($readyfnlist{"$name.$dev"}); delete($readyfnlist{"$name.$dev"});
$selectlist{"$name.$dev"} = $hash; $selectlist{"$name.$dev"} = $hash;
} }
if($baudrate) {
$po->reset_error();
Log 3, "$name: Setting baudrate to $baudrate";
$po->baudrate($baudrate);
$po->databits(8);
$po->parity('none');
$po->stopbits(1);
$po->handshake('none');
}
} }
if($reopen) { if($reopen) {

View File

@ -1700,13 +1700,16 @@ A line ending with \ will be concatenated with the next one, so long lines
<code>define &lt;name&gt; CUL &lt;device&gt; &lt;housecode&gt;</code> <br> <code>define &lt;name&gt; CUL &lt;device&gt; &lt;housecode&gt;</code> <br>
<br> <br>
USB-connected devices (CUL/CUR/CUN):<br><ul> USB-connected devices (CUL/CUR/CUN):<br><ul>
&lt;device&gt; specifies the serial port to communicate with the CUL or CUR. &lt;device&gt; specifies the serial port to communicate with the CUL or
The name of the serial-device depends on your distribution, CUR. The name of the serial-device depends on your distribution, under
under linux the cdc_acm kernel module is responsible, and usually a linux the cdc_acm kernel module is responsible, and usually a
/dev/ttyACM0 device will be created. If your distribution does not have a /dev/ttyACM0 device will be created. If your distribution does not have a
cdc_acm module, you can force usbserial to handle the CUL by the following cdc_acm module, you can force usbserial to handle the CUL by the
command:<ul>modprobe usbserial vendor=0x03eb product=0x204b</ul>In this following command:<ul>modprobe usbserial vendor=0x03eb
case the device is most probably /dev/ttyUSB0.<br> product=0x204b</ul>In this case the device is most probably
/dev/ttyUSB0.<br><br>
You can also specify a baudrate if the device name contains the @
character, e.g.: /dev/ttyACM0@38400<br><br>
</ul> </ul>
Network-connected devices (CUN):<br><ul> Network-connected devices (CUN):<br><ul>
&lt;device&gt; specifies the host:port of the device. E.g. 192.168.0.244:2323 &lt;device&gt; specifies the host:port of the device. E.g. 192.168.0.244:2323
@ -4059,7 +4062,7 @@ Terminating
<li><a href="#fixedrange">fixedrange</a></li> <li><a href="#fixedrange">fixedrange</a></li>
<li><a href="#plotsize">plotsize</a></li> <li><a href="#plotsize">plotsize</a></li>
<li><a href="#plotmode">plotmode</a></li> <li><a href="#plotmode">plotmode</a></li>
<a name="label"> <a name="label"></a>
<li>label<br> <li>label<br>
Colon separated list of values. The values will be used to replace Colon separated list of values. The values will be used to replace
&lt;L#&gt; type of strings in the .gplot file, with # beginning at 1 &lt;L#&gt; type of strings in the .gplot file, with # beginning at 1
@ -4067,7 +4070,7 @@ Terminating
expression, so you have access e.g. to the $value hash.<br><br> expression, so you have access e.g. to the $value hash.<br><br>
If the plotmode is gnuplot-scroll or SVG, you can also use the min, max, If the plotmode is gnuplot-scroll or SVG, you can also use the min, max,
avg, cnt, lastv (last value) and lastd (last date) values of the avg, cnt, sum, lastv (last value) and lastd (last date) values of the
individual curves, by accessing the corresponding values from the data individual curves, by accessing the corresponding values from the data
hash, see the example below:<br> hash, see the example below:<br>
@ -4089,7 +4092,7 @@ Terminating
</ul></li> </ul></li>
</ul> </ul>
</li> </li>
<a name="title"> <a name="title"></a>
<li>title<br> <li>title<br>
A special form of label (see above), which replaces the string &lt;TL&gt; A special form of label (see above), which replaces the string &lt;TL&gt;
in the .gplot file. It defaults to the filename of the logfile. in the .gplot file. It defaults to the filename of the logfile.