From 26fbb921f5ad2ec824c407710aa28f73762ffa6b Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Tue, 29 Oct 2013 16:03:43 +0100 Subject: The LIRC remote control now connects to the socket even if it doesn't yet exist whe VDR is started --- lirc.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'lirc.c') diff --git a/lirc.c b/lirc.c index e02f2296..2b0c07b1 100644 --- a/lirc.c +++ b/lirc.c @@ -6,7 +6,7 @@ * * LIRC support added by Carsten Koch 2000-06-16. * - * $Id: lirc.c 3.1 2013/08/22 09:22:14 kls Exp $ + * $Id: lirc.c 3.2 2013/10/29 12:32:12 kls Exp $ */ #include "lirc.h" @@ -21,11 +21,9 @@ cLircRemote::cLircRemote(const char *DeviceName) { addr.sun_family = AF_UNIX; strcpy(addr.sun_path, DeviceName); - if (Connect()) { - Start(); - return; - } - f = -1; + if (!Connect()) + f = -1; + Start(); } cLircRemote::~cLircRemote() @@ -67,14 +65,15 @@ void cLircRemote::Action(void) bool repeat = false; int timeout = -1; - while (Running() && f >= 0) { + while (Running()) { - bool ready = cFile::FileReady(f, timeout); + bool ready = f >= 0 && cFile::FileReady(f, timeout); int ret = ready ? safe_read(f, buf, sizeof(buf)) : -1; - if (ready && ret <= 0 ) { + if (f < 0 || ready && ret <= 0) { esyslog("ERROR: lircd connection broken, trying to reconnect every %.1f seconds", float(RECONNECTDELAY) / 1000); - close(f); + if (f >= 0) + close(f); f = -1; while (Running() && f < 0) { cCondWait::SleepMs(RECONNECTDELAY); -- cgit v1.2.3