From 6f31ad04a1d33ce2df32b3d89b05d7163dcc0d6c Mon Sep 17 00:00:00 2001 From: kaihs <> Date: Fri, 30 May 2014 18:36:06 +0000 Subject: [PATCH] FRAMEBUFFER performance optimization don't close the pipe to fbvs immediately as this waits for the child process to finish git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@6015 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- FHEM/02_FRAMEBUFFER.pm | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/FHEM/02_FRAMEBUFFER.pm b/FHEM/02_FRAMEBUFFER.pm index 1f4c19e1c..eecd09ed7 100644 --- a/FHEM/02_FRAMEBUFFER.pm +++ b/FHEM/02_FRAMEBUFFER.pm @@ -126,6 +126,11 @@ sub FRAMEBUFFER_updateDisplay($) { my ($hash) = @_; my $name = $hash->{NAME}; my $fbv = '/usr/local/bin/fbvs'; + my $fd = $hash->{fd}; + + if (defined $fd) { + close $fd; + } if (-x $fbv) { if (defined $hash->{debugFile}) { @@ -138,10 +143,12 @@ sub FRAMEBUFFER_updateDisplay($) { } if (FRAMEBUFFER_readLayout($hash)) { - open(FBV, "|".$fbv . ' -d '. $hash->{fhem}{fb_device}); - binmode FBV; - print FBV FRAMEBUFFER_returnPNG($name); - close FBV; + open($fd, "|".$fbv . ' -d '. $hash->{fhem}{fb_device}); + binmode $fd; + print $fd FRAMEBUFFER_returnPNG($name); + # don't close the file immediately, as this will wait + # for the fbv process to terminate which may take some time + #close FBV; } } else { Log3 $name, 1, "$fbv doesn't exist or isn't executable, please install it";