2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 18:59:33 +00:00

DevIo.pm: fix reattach handling of ser2net device (Forum #54732)

git-svn-id: https://svn.fhem.de/fhem/trunk@11693 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2016-06-19 10:21:42 +00:00
parent 3760924a5c
commit 7f75fa72f4

View File

@ -373,25 +373,34 @@ DevIo_OpenDev($$$)
$po->write_settings;
}
if($reopen) {
Log3 $name, 1, "$dev reappeared ($name)";
} else {
Log3 $name, 3, "$name device opened" if(!$hash->{DevioText});
}
DevIo_setStates($hash, "opened");
my $ret;
if($initfn) {
my $ret = &$initfn($hash);
my $hadFD = defined($hash->{FD});
$ret = &$initfn($hash);
if($ret) {
DevIo_CloseDev($hash);
Log3 $name, 1, "Cannot init $dev, ignoring it ($name)";
if($hadFD && !defined($hash->{FD})) { # Forum #54732 / ser2net
DevIo_Disconnected($hash);
$hash->{NEXT_OPEN} = time()+60;
} else {
DevIo_CloseDev($hash);
Log3 $name, 1, "Cannot init $dev, ignoring it ($name)";
}
}
}
DoTrigger($name, "CONNECTED") if($reopen);
return $ret;
if(!$ret) {
if($reopen) {
Log3 $name, 1, "$dev reappeared ($name)";
} else {
Log3 $name, 3, "$name device opened" if(!$hash->{DevioText});
}
}
DoTrigger($name, "CONNECTED") if($reopen && !$ret);
return undef;
}
sub