summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.c10
-rw-r--r--config.h3
-rw-r--r--remote.c12
-rw-r--r--remote.h6
-rw-r--r--vdr.c6
5 files changed, 25 insertions, 12 deletions
diff --git a/config.c b/config.c
index 16f44124..32fa17f9 100644
--- a/config.c
+++ b/config.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: config.c 1.8 2000/07/15 12:39:20 kls Exp $
+ * $Id: config.c 1.9 2000/07/15 16:35:18 kls Exp $
*/
#include "config.h"
@@ -54,6 +54,12 @@ void cKeys::Clear(void)
k->code = 0;
}
+void cKeys::SetDummyValues(void)
+{
+ for (tKey *k = keys; k->type != kNone; k++)
+ k->code = k->type + 1; // '+1' to avoid 0
+}
+
bool cKeys::Load(char *FileName)
{
isyslog(LOG_INFO, "loading %s", FileName);
@@ -150,7 +156,7 @@ unsigned int cKeys::Encode(const char *Command)
{
if (Command != NULL) {
const tKey *k = keys;
- while ((k->type != kNone) && strncmp(k->name, Command, strlen(k->name)) != 0) // must use 'strncmp()' because LIRC delivers trailing characters!
+ while ((k->type != kNone) && strcmp(k->name, Command) != 0)
k++;
return k->code;
}
diff --git a/config.h b/config.h
index 22099b90..8edba128 100644
--- a/config.h
+++ b/config.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: config.h 1.7 2000/06/24 13:42:32 kls Exp $
+ * $Id: config.h 1.8 2000/07/15 16:26:57 kls Exp $
*/
#ifndef __CONFIG_H
@@ -50,6 +50,7 @@ public:
tKey *keys;
cKeys(void);
void Clear(void);
+ void SetDummyValues(void);
bool Load(char *FileName = NULL);
bool Save(void);
unsigned int Encode(const char *Command);
diff --git a/remote.c b/remote.c
index e3786c5c..931cfd33 100644
--- a/remote.c
+++ b/remote.c
@@ -6,7 +6,7 @@
*
* Ported to LIRC by Carsten Koch <Carsten.Koch@icem.de> 2000-06-16.
*
- * $Id: remote.c 1.9 2000/07/15 12:19:50 kls Exp $
+ * $Id: remote.c 1.10 2000/07/15 16:34:35 kls Exp $
*/
#include "remote.h"
@@ -365,17 +365,20 @@ cRcIoLIRC::~cRcIoLIRC()
const char *cRcIoLIRC::ReceiveString(void)
{
+ char buf[LIRC_BUFFER_SIZE];
+
while (InputAvailable(true)) {
if (read(f, buf, sizeof(buf)) > 21) {
- const int repeat = 10 * (buf[17] - '0') + (buf[18] - '0');
const int now = time_ms();
+ int repeat;
+ sscanf(buf, "%*s %x %7s", &repeat, keyName); // '7' in '%7s' is LIRC_KEY_BUF-1!
if (repeat == 0) {
firstTime = lastTime = now;
- return buf + 20;
+ return keyName;
}
else if ((now > firstTime + REPEATDELAY) && (now > lastTime + REPEATLIMIT)) {
lastTime = now;
- return buf + 20;
+ return keyName;
}
}
}
@@ -384,6 +387,7 @@ const char *cRcIoLIRC::ReceiveString(void)
void cRcIoLIRC::Flush(int WaitSeconds)
{
+ char buf[LIRC_BUFFER_SIZE];
time_t t0 = time(NULL);
for (;;) {
diff --git a/remote.h b/remote.h
index 38961b9c..7b94ac78 100644
--- a/remote.h
+++ b/remote.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: remote.h 1.6 2000/06/24 15:52:56 kls Exp $
+ * $Id: remote.h 1.7 2000/07/15 16:32:43 kls Exp $
*/
#ifndef __REMOTE_H
@@ -75,9 +75,9 @@ public:
class cRcIoLIRC : public cRcIoBase {
private:
- enum { LIRC_BUFFER_SIZE = 128 };
+ enum { LIRC_KEY_BUF = 8, LIRC_BUFFER_SIZE = 128 };
int f;
- char buf[LIRC_BUFFER_SIZE];
+ char keyName[LIRC_KEY_BUF];
const char *ReceiveString(void);
public:
cRcIoLIRC(char *DeviceName);
diff --git a/vdr.c b/vdr.c
index 4c1dce0a..a065bfd2 100644
--- a/vdr.c
+++ b/vdr.c
@@ -22,7 +22,7 @@
*
* The project's page is at http://www.cadsoft.de/people/kls/vdr
*
- * $Id: vdr.c 1.20 2000/07/15 11:45:05 kls Exp $
+ * $Id: vdr.c 1.21 2000/07/15 16:26:57 kls Exp $
*/
#include <signal.h>
@@ -58,7 +58,9 @@ int main(int argc, char *argv[])
Channels.Load("channels.conf");
Timers.Load("timers.conf");
-#ifndef REMOTE_LIRC
+#ifdef REMOTE_LIRC
+ Keys.SetDummyValues();
+#else
if (!Keys.Load(KEYS_CONF))
Interface.LearnKeys();
#endif