mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-12 16:46:35 +00:00
CUL with directio
git-svn-id: https://svn.fhem.de/fhem/trunk@988 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
5e79ad3a82
commit
09071f2903
@ -7,6 +7,7 @@
|
||||
- feature: .gplot files renamed from type to content
|
||||
- bugfix: FS20 on-for-timer error reporting only in the logfile
|
||||
- bugfix: FHEM2FHEM should work with CUL again, after syntax change
|
||||
- feature: CUL directio mode (No Device::SerialPort needed)
|
||||
|
||||
- 2011-07-08 (5.1)
|
||||
- feature: smallscreen optimizations for iPhone
|
||||
|
@ -106,7 +106,8 @@ CUL_Define($$)
|
||||
my @a = split("[ \t][ \t]*", $def);
|
||||
|
||||
if(@a < 4 || @a > 5) {
|
||||
my $msg = "wrong syntax: define <name> CUL devicename[\@baudrate] <FHTID>";
|
||||
my $msg = "wrong syntax: define <name> CUL {none | devicename[\@baudrate] ".
|
||||
"| devicename\@directio | hostname:port} <FHTID>";
|
||||
Log 2, $msg;
|
||||
return $msg;
|
||||
}
|
||||
@ -949,6 +950,7 @@ CUL_SimpleWrite(@)
|
||||
|
||||
$hash->{USBDev}->write($msg) if($hash->{USBDev});
|
||||
syswrite($hash->{TCPDev}, $msg) if($hash->{TCPDev});
|
||||
syswrite($hash->{DIODev}, $msg) if($hash->{DIODev});
|
||||
|
||||
select(undef, undef, undef, 0.001);
|
||||
}
|
||||
@ -958,22 +960,21 @@ sub
|
||||
CUL_SimpleRead($)
|
||||
{
|
||||
my ($hash) = @_;
|
||||
my ($buf, $res);
|
||||
|
||||
if($hash->{USBDev}) {
|
||||
my $buf = $hash->{USBDev}->input();
|
||||
#Log 1, "Got $buf";
|
||||
return $buf;
|
||||
}
|
||||
$buf = $hash->{USBDev}->input();
|
||||
|
||||
} elsif($hash->{DIODev}) {
|
||||
$res = sysread($hash->{DIODev}, $buf, 256);
|
||||
$buf = undef if(!defined($res));
|
||||
|
||||
} elsif($hash->{TCPDev}) {
|
||||
$res = sysread($hash->{TCPDev}, $buf, 256);
|
||||
$buf = undef if(!defined($res));
|
||||
|
||||
if($hash->{TCPDev}) {
|
||||
my $buf;
|
||||
if(!defined(sysread($hash->{TCPDev}, $buf, 256))) {
|
||||
CUL_Disconnected($hash);
|
||||
return undef;
|
||||
}
|
||||
return $buf;
|
||||
}
|
||||
return undef;
|
||||
return $buf;
|
||||
}
|
||||
|
||||
########################
|
||||
@ -994,6 +995,10 @@ CUL_CloseDev($)
|
||||
$hash->{USBDev}->close() ;
|
||||
delete($hash->{USBDev});
|
||||
|
||||
} elsif($hash->{DIODev}) {
|
||||
close($hash->{DIODev});
|
||||
delete($hash->{DIODev});
|
||||
|
||||
}
|
||||
($dev, undef) = split("@", $dev); # Remove the baudrate
|
||||
delete($selectlist{"$name.$dev"});
|
||||
@ -1044,6 +1049,27 @@ CUL_OpenDev($$)
|
||||
delete($readyfnlist{"$name.$dev"});
|
||||
$selectlist{"$name.$dev"} = $hash;
|
||||
|
||||
} elsif(lc($baudrate) eq "directio") { # Without Device::SerialPort
|
||||
|
||||
if(!open($po, "+<$dev")) {
|
||||
return undef if($reopen);
|
||||
Log(3, "Can't open $dev: $!");
|
||||
$readyfnlist{"$name.$dev"} = $hash;
|
||||
$hash->{STATE} = "disconnected";
|
||||
return "";
|
||||
}
|
||||
|
||||
$hash->{DIODev} = $po;
|
||||
|
||||
if( $^O =~ /Win/ ) {
|
||||
$readyfnlist{"$name.$dev"} = $hash;
|
||||
} else {
|
||||
$hash->{FD} = fileno($po);
|
||||
delete($readyfnlist{"$name.$dev"});
|
||||
$selectlist{"$name.$dev"} = $hash;
|
||||
}
|
||||
|
||||
|
||||
} else { # USB/Serial device
|
||||
|
||||
|
||||
|
@ -2048,8 +2048,16 @@ A line ending with \ will be concatenated with the next one, so long lines
|
||||
following command:<ul>modprobe usbserial vendor=0x03eb
|
||||
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>
|
||||
|
||||
If the baudrate is "directio" (e.g.: /dev/ttyACM0@directio), then the
|
||||
perl module Device::SerialPort is not needed, and fhem opens the device
|
||||
with simple file io. This might work if the operating system uses sane
|
||||
defaults for the serial parameters, e.g. some Linux distributions and
|
||||
OSX. <br><br>
|
||||
|
||||
</ul>
|
||||
Network-connected devices (CUN):<br><ul>
|
||||
<device> specifies the host:port of the device. E.g.
|
||||
@ -2547,16 +2555,16 @@ A line ending with \ will be concatenated with the next one, so long lines
|
||||
<li>day-temp <tmp><br>
|
||||
night-temp <tmp><br>
|
||||
Set the day or night temperature. Temp must be between 6 and 30
|
||||
Centigrade, and precision is half a degree.
|
||||
<li>tempListSat HH:MM temp 24:00 temp ...<br>
|
||||
tempListSun HH:MM temp 24:00 temp ...<br>
|
||||
tempListMon HH:MM temp 24:00 temp ...<br>
|
||||
tempListTue HH:MM temp 24:00 temp ...<br>
|
||||
tempListThu HH:MM temp 24:00 temp ...<br>
|
||||
tempListWed HH:MM temp 24:00 temp ...<br>
|
||||
tempListFri HH:MM temp 24:00 temp ...<br>
|
||||
Celsius, and precision is half a degree.
|
||||
<li>tempListSat HH:MM temp ... 24:00 temp<br>
|
||||
tempListSun HH:MM temp ... 24:00 temp<br>
|
||||
tempListMon HH:MM temp ... 24:00 temp<br>
|
||||
tempListTue HH:MM temp ... 24:00 temp<br>
|
||||
tempListThu HH:MM temp ... 24:00 temp<br>
|
||||
tempListWed HH:MM temp ... 24:00 temp<br>
|
||||
tempListFri HH:MM temp ... 24:00 temp<br>
|
||||
Specify a list of temperature intervals. Up to 24 intervals can be
|
||||
spacified for each week day, the resolution is 10 Minutes. The
|
||||
specified for each week day, the resolution is 10 Minutes. The
|
||||
last time spec must always be 24:00.<br>
|
||||
Example: set th tempListSat 06:00 19 23:00 22.5 24:00 19<br>
|
||||
</ul></li>
|
||||
@ -2567,11 +2575,11 @@ A line ending with \ will be concatenated with the next one, so long lines
|
||||
<ul>
|
||||
<li>raw <data> ...<br>
|
||||
Only needed for experimentation.
|
||||
send a list of "raw" commands. The first command will be immediately
|
||||
sent, the next one after the previous one is acked by the target. The
|
||||
length will be computed automatically, and the message counter will be
|
||||
incremented if the first two charcters are ++.
|
||||
Example (enable AES):<pre>
|
||||
send a list of "raw" commands. The first command will be
|
||||
immediately sent, the next one after the previous one is acked by
|
||||
the target. The length will be computed automatically, and the
|
||||
message counter will be incremented if the first two charcters are
|
||||
++. Example (enable AES):<pre>
|
||||
set hm1 raw ++A001F100001234560105000000001\
|
||||
++A001F10000123456010802010AF10B000C00\
|
||||
++A001F1000012345601080801\
|
||||
|
Loading…
x
Reference in New Issue
Block a user