mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-22 02:10:32 +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:
parent
1cf355aa18
commit
2bae601ea0
@ -80,7 +80,7 @@ BlockingCall($$@)
|
|||||||
foreach my $d (sort keys %defs) { # Close all kind of FD
|
foreach my $d (sort keys %defs) { # Close all kind of FD
|
||||||
my $h = $defs{$d};
|
my $h = $defs{$d};
|
||||||
TcpServer_Close($h) if($h->{SERVERSOCKET});
|
TcpServer_Close($h) if($h->{SERVERSOCKET});
|
||||||
DevIo_CloseDev($h) if($h->{DeviceName});
|
DevIo_CloseDev($h,1) if($h->{DeviceName});
|
||||||
}
|
}
|
||||||
|
|
||||||
no strict "refs";
|
no strict "refs";
|
||||||
|
@ -6,7 +6,7 @@ sub DevIo_SimpleRead($);
|
|||||||
sub DevIo_TimeoutRead($$);
|
sub DevIo_TimeoutRead($$);
|
||||||
sub DevIo_SimpleWrite($$$);
|
sub DevIo_SimpleWrite($$$);
|
||||||
sub DevIo_OpenDev($$$);
|
sub DevIo_OpenDev($$$);
|
||||||
sub DevIo_CloseDev($);
|
sub DevIo_CloseDev($@);
|
||||||
sub DevIo_Disconnected($);
|
sub DevIo_Disconnected($);
|
||||||
sub DevIo_SetHwHandshake($);
|
sub DevIo_SetHwHandshake($);
|
||||||
|
|
||||||
@ -279,9 +279,9 @@ DevIo_SetHwHandshake($)
|
|||||||
|
|
||||||
########################
|
########################
|
||||||
sub
|
sub
|
||||||
DevIo_CloseDev($)
|
DevIo_CloseDev($@)
|
||||||
{
|
{
|
||||||
my ($hash) = @_;
|
my ($hash,$isFork) = @_;
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
my $dev = $hash->{DeviceName};
|
my $dev = $hash->{DeviceName};
|
||||||
|
|
||||||
@ -292,7 +292,11 @@ DevIo_CloseDev($)
|
|||||||
delete($hash->{TCPDev});
|
delete($hash->{TCPDev});
|
||||||
|
|
||||||
} elsif($hash->{USBDev}) {
|
} 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});
|
delete($hash->{USBDev});
|
||||||
|
|
||||||
} elsif($hash->{DIODev}) {
|
} elsif($hash->{DIODev}) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user