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:
parent
3760924a5c
commit
7f75fa72f4
@ -373,25 +373,34 @@ DevIo_OpenDev($$$)
|
||||
$po->write_settings;
|
||||
}
|
||||
|
||||
DevIo_setStates($hash, "opened");
|
||||
|
||||
my $ret;
|
||||
if($initfn) {
|
||||
my $hadFD = defined($hash->{FD});
|
||||
$ret = &$initfn($hash);
|
||||
if($ret) {
|
||||
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)";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!$ret) {
|
||||
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);
|
||||
if($ret) {
|
||||
DevIo_CloseDev($hash);
|
||||
Log3 $name, 1, "Cannot init $dev, ignoring it ($name)";
|
||||
}
|
||||
}
|
||||
|
||||
DoTrigger($name, "CONNECTED") if($reopen);
|
||||
return $ret;
|
||||
DoTrigger($name, "CONNECTED") if($reopen && !$ret);
|
||||
return undef;
|
||||
}
|
||||
|
||||
sub
|
||||
|
Loading…
Reference in New Issue
Block a user