From 78ef8f3ff207d4072a48b26ca49c4572c93685c6 Mon Sep 17 00:00:00 2001 From: HCS <> Date: Sat, 5 Jan 2019 22:49:48 +0000 Subject: [PATCH] 36_PrecipitationSensor: connect non blocking git-svn-id: https://svn.fhem.de/fhem/trunk@18151 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/36_PrecipitationSensor.pm | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/fhem/FHEM/36_PrecipitationSensor.pm b/fhem/FHEM/36_PrecipitationSensor.pm index 2c94d9827..dc1ee25d0 100644 --- a/fhem/FHEM/36_PrecipitationSensor.pm +++ b/fhem/FHEM/36_PrecipitationSensor.pm @@ -268,15 +268,7 @@ sub PrecipitationSensor_Ready($) { my ($hash) = @_; my $name = $hash->{NAME}; - PrecipitationSensor_Connect($hash, 1); - - # This is relevant for windows/USB only - my $po = $hash->{USBDev}; - my ($BlockingFlags, $InBytes, $OutBytes, $ErrorFlags); - if($po) { - ($BlockingFlags, $InBytes, $OutBytes, $ErrorFlags) = $po->status; - } - return ($InBytes && $InBytes>0); + return PrecipitationSensor_Connect($hash, 1); } #======================================================================================= @@ -409,8 +401,12 @@ sub PrecipitationSensor_Connect($;$) { my $enabled = AttrVal($name, "disable", "0") != "1" && !defined($hash->{helper}{FLASHING}); if($enabled) { $hash->{nextOpenDelay} = 2; - my $ret = DevIo_OpenDev($hash, $mode, "PrecipitationSensor_DoInit"); + my $ret = DevIo_OpenDev($hash, $mode, "PrecipitationSensor_DoInit", sub($$){ + my ($hash, $error) = @_; + ####Log 3, $hash->{NAME} . " " . $error; + }); return $ret; + } return undef;