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

Close IO Port after fork without resetting the parameters

git-svn-id: https://svn.fhem.de/fhem/trunk@3303 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2013-06-18 07:56:31 +00:00
parent 1cf355aa18
commit 2bae601ea0
2 changed files with 9 additions and 5 deletions

View File

@ -80,7 +80,7 @@ BlockingCall($$@)
foreach my $d (sort keys %defs) { # Close all kind of FD
my $h = $defs{$d};
TcpServer_Close($h) if($h->{SERVERSOCKET});
DevIo_CloseDev($h) if($h->{DeviceName});
DevIo_CloseDev($h,1) if($h->{DeviceName});
}
no strict "refs";

View File

@ -6,7 +6,7 @@ sub DevIo_SimpleRead($);
sub DevIo_TimeoutRead($$);
sub DevIo_SimpleWrite($$$);
sub DevIo_OpenDev($$$);
sub DevIo_CloseDev($);
sub DevIo_CloseDev($@);
sub DevIo_Disconnected($);
sub DevIo_SetHwHandshake($);
@ -279,9 +279,9 @@ DevIo_SetHwHandshake($)
########################
sub
DevIo_CloseDev($)
DevIo_CloseDev($@)
{
my ($hash) = @_;
my ($hash,$isFork) = @_;
my $name = $hash->{NAME};
my $dev = $hash->{DeviceName};
@ -292,7 +292,11 @@ DevIo_CloseDev($)
delete($hash->{TCPDev});
} elsif($hash->{USBDev}) {
$hash->{USBDev}->close() ;
if($isFork) { # SerialPort close resets the serial parameters.
POSIX::close($hash->{USBDev}{FD});
} else {
$hash->{USBDev}->close() ;
}
delete($hash->{USBDev});
} elsif($hash->{DIODev}) {