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 3a94e974cb
commit ffdb8fca66

View File

@@ -276,8 +276,12 @@ CUL_DoInit($)
}
delete($hash->{RA_Timeout});
my ($ver, $try) = ("", 0);
while($try++ < 3 && $ver !~ m/^V/) {
$hash->{PortObj}->write("V\n");
my $ver = CUL_ReadAnswer($hash, "Version");
$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,11 +441,13 @@ CUL_HandleWriteQueue($)
if($hash->{QUEUECNT} > 0) {
$hash->{QUEUECNT}--;
my $bstring = shift(@{$hash->{QUEUE}});
if(defined($bstring)) {
CUL_XmitLimitCheck($hash,$bstring);
$hash->{PortObj}->write($bstring);
InternalTimer(gettimeofday()+0.25, "CUL_HandleWriteQueue", $hash, 1);
}
}
}
#####################################
sub