Mailing List archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[vdr] Re: vdr not reading .lircrc ?
On Wednesday 05 June 2002 15:40, Bernhard Wager wrote:
> Oops,
>
> ein forgot to attach the patch. Here it is.
>
>
> -- No attachments (even text) are allowed --
> -- Type: text/x-diff
> -- File: vdr-1.0.2-lirc.diff
diff -ru vdr-1.0.2/Makefile vdr-1.0.2-lirc/Makefile
--- vdr-1.0.2/Makefile Mon Apr 1 14:50:48 2002
+++ vdr-1.0.2-lirc/Makefile Wed May 15 12:55:06 2002
@@ -69,7 +69,7 @@
# The main program:
vdr: $(OBJS) $(DTVLIB)
- g++ -g -O2 $(OBJS) $(NCURSESLIB) -ljpeg -lpthread $(LIBDIRS) $(DTVLIB) -o
vdr
+ g++ -g -O2 $(OBJS) $(NCURSESLIB) -ljpeg -lpthread -llirc_client $(LIBDIRS)
$(DTVLIB) -o vdr
# The font files:
diff -ru vdr-1.0.2/remote.c vdr-1.0.2-lirc/remote.c
--- vdr-1.0.2/remote.c Sun Sep 30 13:39:49 2001
+++ vdr-1.0.2-lirc/remote.c Wed May 15 18:56:54 2002
@@ -22,6 +22,7 @@
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/un.h>
+#include "lirc/lirc_client.h" //BW
#endif
#include "config.h"
@@ -402,24 +403,25 @@
{
*keyName = 0;
receivedData = receivedRepeat = false;
- struct sockaddr_un addr;
- addr.sun_family = AF_UNIX;
- strcpy(addr.sun_path, DeviceName);
- if ((f = socket(AF_UNIX, SOCK_STREAM, 0)) >= 0) {
- if (connect(f, (struct sockaddr *)&addr, sizeof(addr)) >= 0) {
+ if((f = lirc_init("vdr",1)) >= 0){
+ if(lirc_readconfig(NULL,&bw_config,NULL)==0){
Start();
return;
}
LOG_ERROR_STR(DeviceName);
- close(f);
+ lirc_deinit();
}
else
LOG_ERROR_STR(DeviceName);
f = -1;
+
+
}
cRcIoLIRC::~cRcIoLIRC()
{
+ lirc_freeconfig(bw_config);
+ lirc_deinit();
Cancel();
}
@@ -431,6 +433,7 @@
int LastTime = 0;
char buf[LIRC_BUFFER_SIZE];
char LastKeyName[LIRC_KEY_BUF];
+ char *bw_c;
for (; f >= 0;) {
@@ -442,7 +445,13 @@
sscanf(buf, "%*x %x %29s", &count, LastKeyName); // '29' in
'%29s' is LIRC_KEY_BUF-1!
int Now = time_ms();
if (count == 0) {
- strcpy(keyName, LastKeyName);
+ if (lirc_code2char(bw_config, buf, &bw_c) == 0 && bw_c !=
NULL)
+ sscanf(bw_c, "%29s", keyName);
+ else if (lirc_code2char(bw_config, buf, &bw_c) == 0 && bw_c !=
NULL)
+ sscanf(bw_c, "%29s", keyName);
+ else
+ sscanf("**", "%29s", keyName);
+ dsyslog(LOG_INFO, "BW: Kommando: %s (pid=%d)", keyName,
getpid());
receivedData = true;
receivedRepeat = receivedRelease = false;
FirstTime = Now;
@@ -474,10 +483,13 @@
}
}
}
+
+
}
bool cRcIoLIRC::GetCommand(unsigned int *Command, bool *Repeat, bool
*Release)
{
+
if (receivedData) { // first we check the boolean flag without a lock, to
avoid delays
LOCK_THREAD;
diff -ru vdr-1.0.2/remote.h vdr-1.0.2-lirc/remote.h
--- vdr-1.0.2/remote.h Sun Jul 22 16:42:59 2001
+++ vdr-1.0.2-lirc/remote.h Wed May 15 19:07:39 2002
@@ -15,6 +15,10 @@
#include "thread.h"
#include "tools.h"
+#if defined REMOTE_LIRC
+#include "lirc/lirc_client.h"
+#endif
+
class cRcIoBase {
protected:
time_t t;
@@ -85,6 +89,7 @@
int f;
char keyName[LIRC_KEY_BUF];
bool receivedData, receivedRepeat, receivedRelease;
+ struct lirc_config *bw_config;
virtual void Action(void);
public:
cRcIoLIRC(char *DeviceName);
Only in vdr-1.0.2/: vdr-1.0.2-lirc.diff
Home |
Main Index |
Thread Index