diff --git a/fhem/CHANGED b/fhem/CHANGED index 0b1c5dc83..1687da2d7 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,6 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - change: 66_ECMD: ReadyFn added (fixes issue under Windows) - change: 02_RSS: use a GUID in RSS; urlq source for img command - feature: 70_PushNotifier improve usebility, configuration without cURL (xusader) - bugfix: SYSMON: prevent empty line im log by userReadings diff --git a/fhem/FHEM/66_ECMD.pm b/fhem/FHEM/66_ECMD.pm index 23df467b2..5173a3fdd 100644 --- a/fhem/FHEM/66_ECMD.pm +++ b/fhem/FHEM/66_ECMD.pm @@ -41,7 +41,7 @@ sub ECMD_Clear($); #sub ECMD_Parse($$$$$); sub ECMD_Read($); sub ECMD_ReadAnswer($$); -#sub ECMD_Ready($); +sub ECMD_Ready($); sub ECMD_Write($$$); @@ -61,6 +61,7 @@ ECMD_Initialize($) # Consumer $hash->{DefFn} = "ECMD_Define"; $hash->{UndefFn} = "ECMD_Undef"; + $hash->{ReadyFn} = "ECMD_Ready"; $hash->{GetFn} = "ECMD_Get"; $hash->{SetFn} = "ECMD_Set"; $hash->{AttrFn} = "ECMD_Attr"; @@ -150,6 +151,25 @@ ECMD_Log($$$) Log3 $hash, $loglevel , "$name: $logmsg"; } +##################################### +sub +ECMD_Ready($) +{ + my ($hash) = @_; + + return DevIo_OpenDev($hash, 1, "ECMD_DoInit") + if($hash->{STATE} eq "disconnected"); + + # 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); +} + + ##################################### sub ECMD_SimpleRead($)