2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-13 17:26:34 +00:00

Better init checking.

"Serial.pm: undefined" bug fixed


git-svn-id: https://svn.fhem.de/fhem/trunk@276 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2008-12-04 14:19:49 +00:00
parent 74994a4de2
commit 039c25b78a

View File

@ -276,8 +276,12 @@ CUL_DoInit($)
}
delete($hash->{RA_Timeout});
$hash->{PortObj}->write("V\n");
my $ver = CUL_ReadAnswer($hash, "Version");
my ($ver, $try) = ("", 0);
while($try++ < 3 && $ver !~ m/^V/) {
$hash->{PortObj}->write("V\n");
$ver = CUL_ReadAnswer($hash, "Version");
}
if($ver !~ m/^V/) {
$attr{$name}{dummy} = 1;
$hash->{PortObj}->close();
@ -285,6 +289,7 @@ CUL_DoInit($)
Log 1, $msg;
return $msg;
}
CUL_SimpleWrite($hash, $initstr);
$hash->{STATE} = "Initialized";
@ -405,7 +410,6 @@ CUL_Write($$$)
if($fn eq "F") {
if(!$hash->{QUEUECNT}) {
CUL_XmitLimitCheck($hash, $bstring);
$hash->{PortObj}->write($bstring);
@ -437,9 +441,11 @@ CUL_HandleWriteQueue($)
if($hash->{QUEUECNT} > 0) {
$hash->{QUEUECNT}--;
my $bstring = shift(@{$hash->{QUEUE}});
CUL_XmitLimitCheck($hash,$bstring);
$hash->{PortObj}->write($bstring);
InternalTimer(gettimeofday()+0.25, "CUL_HandleWriteQueue", $hash, 1);
if(defined($bstring)) {
CUL_XmitLimitCheck($hash,$bstring);
$hash->{PortObj}->write($bstring);
InternalTimer(gettimeofday()+0.25, "CUL_HandleWriteQueue", $hash, 1);
}
}
}