diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2013-10-29 16:09:03 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2013-10-29 16:09:03 +0100 |
commit | 25e05054a6a597c87910207f2030c04992cbfb0d (patch) | |
tree | 03c5122dcc8ba15e1b3b5af7c24db1844ebf26ab /lirc.c | |
parent | 578cfe64a87710b0543a47b6441d7e28b30461ee (diff) | |
download | vdr-25e05054a6a597c87910207f2030c04992cbfb0d.tar.gz vdr-25e05054a6a597c87910207f2030c04992cbfb0d.tar.bz2 |
The LIRC remote control now connects to the socket even if it doesn't yet exist whe VDR is started
Diffstat (limited to 'lirc.c')
-rw-r--r-- | lirc.c | 19 |
1 files changed, 9 insertions, 10 deletions
@@ -6,7 +6,7 @@ * * LIRC support added by Carsten Koch <Carsten.Koch@icem.de> 2000-06-16. * - * $Id: lirc.c 2.5.1.1 2013/08/22 09:36:49 kls Exp $ + * $Id: lirc.c 2.5.1.2 2013/10/29 16:06:20 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); |