00_CUL.pm: CUL_ReadAnswer: better parsing of non-answer-data

DevIo.pm: set disconnected to state, additionally to STATE (Froum #28470)


git-svn-id: https://svn.fhem.de/fhem/trunk@6980 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig
2014-11-15 13:06:08 +00:00
parent 66f9545f5d
commit 3c58e5871b
2 changed files with 9 additions and 6 deletions

View File

@@ -535,13 +535,15 @@ CUL_ReadAnswer($$$$)
$mculdata .= $buf;
}
# \n\n is socat special
if($mculdata =~ m/\r\n/ || $anydata || $mculdata =~ m/\n\n/ ) {
(undef, $mculdata) = CUL_prefix(0, $ohash, $mculdata); # Delete prefix
if($regexp && $mculdata !~ m/$regexp/) {
CUL_Parse($ohash, $hash, $ohash->{NAME}, $mculdata);
# Dispatch data in the buffer before the proper answer.
while(($mculdata =~ m/^([^\n]*\n)(.*)/s) || $anydata) {
my $line = ($anydata ? $mculdata : $1);
$mculdata = $2;
(undef, $line) = CUL_prefix(0, $ohash, $line); # Delete prefix
if($regexp && $line !~ m/$regexp/) {
CUL_Parse($ohash, $hash, $ohash->{NAME}, $line);
} else {
return (undef, $mculdata)
return (undef, $line);
}
}
}

View File

@@ -388,6 +388,7 @@ DevIo_Disconnected($)
DevIo_CloseDev($hash);
$readyfnlist{"$name.$dev"} = $hash; # Start polling
$hash->{STATE} = "disconnected";
setReadingsVal($hash, "state", "disconnected", TimeNow());
DoTrigger($name, "DISCONNECTED");
}