From bdd43ea7ec30f361293856668286f7a53e4a166f Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Mon, 22 Mar 2010 09:34:32 +0000 Subject: [PATCH] Optional baudrate for CUL git-svn-id: https://svn.fhem.de/fhem/trunk@601 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 2 ++ fhem/FHEM/00_CUL.pm | 15 +++++++++++++++ fhem/docs/commandref.html | 23 +++++++++++++---------- 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 9ff6efb66..ec2c1e437 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -580,3 +580,5 @@ - =DATE= (5.0) - feature: KM271: Read only - bugfix: 99_SUNRISE_EL endless loop bug + - feature: CUL: optional baudrate spec in definition + diff --git a/fhem/FHEM/00_CUL.pm b/fhem/FHEM/00_CUL.pm index 748f53af3..711bb7c95 100755 --- a/fhem/FHEM/00_CUL.pm +++ b/fhem/FHEM/00_CUL.pm @@ -929,6 +929,10 @@ CUL_OpenDev($$) $selectlist{"$name.$dev"} = $hash; } else { # USB Device + + my $baudrate; + ($dev, $baudrate) = split("@", $dev); + if ($^O=~/Win/) { require Win32::SerialPort; $po = new Win32::SerialPort ($dev); @@ -952,6 +956,17 @@ CUL_OpenDev($$) delete($readyfnlist{"$name.$dev"}); $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) { diff --git a/fhem/docs/commandref.html b/fhem/docs/commandref.html index f78f2fb41..a68c95184 100644 --- a/fhem/docs/commandref.html +++ b/fhem/docs/commandref.html @@ -1700,13 +1700,16 @@ A line ending with \ will be concatenated with the next one, so long lines define <name> CUL <device> <housecode>

USB-connected devices (CUL/CUR/CUN):
Network-connected devices (CUN):
- +
  • title
    A special form of label (see above), which replaces the string <TL> in the .gplot file. It defaults to the filename of the logfile.