2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-19 06:36:04 +00:00

Windows fixes from Klaus

git-svn-id: https://svn.fhem.de/fhem/trunk@431 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2009-08-23 09:31:03 +00:00
parent 8e32901b52
commit ca4c55ee09

View File

@ -515,22 +515,30 @@ CUL_ReadAnswer($$$)
if(!$hash || ($^O !~ /Win/ && !defined($hash->{FD}))); if(!$hash || ($^O !~ /Win/ && !defined($hash->{FD})));
my ($mculdata, $rin) = ("", ''); my ($mculdata, $rin) = ("", '');
my $nfound; my $buf;
my $to = 3; # 3 seconds timeout
$to = $hash->{RA_Timeout} if($hash->{RA_Timeout}); # ...or less
for(;;) { for(;;) {
if($^O =~ m/Win/) { if($^O =~ m/Win/) {
$nfound=CUL_Ready($hash); $hash->{PortObj}->read_const_time($to*1000); # set timeout (ms)
# Read anstatt input sonst funzt read_const_time nicht.
$buf = $hash->{PortObj}->read(999);
return ("Timeout reading answer for get $arg", undef)
if(length($buf) == 0);
} else { } else {
vec($rin, $hash->{FD}, 1) = 1; vec($rin, $hash->{FD}, 1) = 1;
my $to = 3; # 3 seconds timeout my $nfound = select($rin, undef, undef, $to);
$to = $hash->{RA_Timeout} if($hash->{RA_Timeout}); # ...or less
$nfound = select($rin, undef, undef, $to);
if($nfound < 0) { if($nfound < 0) {
next if ($! == EAGAIN() || $! == EINTR() || $! == 0); next if ($! == EAGAIN() || $! == EINTR() || $! == 0);
return ("Select error $nfound / $!", undef); die("Select error $nfound / $!", undef);
} }
return ("Timeout reading answer for get $arg", undef)
if($nfound == 0);
$buf = $hash->{PortObj}->input();
} }
return ("Timeout reading answer for get $arg", undef) if($nfound == 0);
my $buf = $hash->{PortObj}->input();
Log 5, "CUL/RAW: $buf"; Log 5, "CUL/RAW: $buf";
$mculdata .= $buf; $mculdata .= $buf;