1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Improved the repeat function for LIRC remote controls

This commit is contained in:
Klaus Schmidinger 2006-05-28 08:49:52 +02:00
parent e4d3a28acd
commit 9b3b98f88f
3 changed files with 11 additions and 7 deletions

View File

@ -541,6 +541,7 @@ Christian Rienecker <C.Rienecker@gmx.net>
Joerg Riechardt <J.Riechardt@gmx.de> Joerg Riechardt <J.Riechardt@gmx.de>
for filling in some missing teletext PIDs for filling in some missing teletext PIDs
for improving the repeat function for LIRC remote controls
Holger Wächtler <holger@qanu.de> Holger Wächtler <holger@qanu.de>
for some valuable advice during adapting to the NEWSTRUCT driver for some valuable advice during adapting to the NEWSTRUCT driver

View File

@ -4716,7 +4716,7 @@ Video Disk Recorder Revision History
- Fixed automatically updating the CAM menu in case the whole operation (for - Fixed automatically updating the CAM menu in case the whole operation (for
instance a firmware update) takes longer than the menu timeout. instance a firmware update) takes longer than the menu timeout.
2006-05-27: Version 1.4.0-2 2006-05-28: Version 1.4.0-2
- Removed leftover LSMOD=... line from 'runvdr'. - Removed leftover LSMOD=... line from 'runvdr'.
- Modified the Makefile to copy additional libraries a plugin might provide (suggested - Modified the Makefile to copy additional libraries a plugin might provide (suggested
@ -4740,3 +4740,4 @@ Video Disk Recorder Revision History
Christian Wieninger). Christian Wieninger).
- Avoiding a compiler warning in libsi's TypeLoop::operator[]. - Avoiding a compiler warning in libsi's TypeLoop::operator[].
- Now processing the "frequency list descriptor" (based on a patch from Anssi Hannula). - Now processing the "frequency list descriptor" (based on a patch from Anssi Hannula).
- Improved the repeat function for LIRC remote controls (thanks to Joerg Riechardt).

14
lirc.c
View File

@ -6,16 +6,16 @@
* *
* LIRC support added by Carsten Koch <Carsten.Koch@icem.de> 2000-06-16. * LIRC support added by Carsten Koch <Carsten.Koch@icem.de> 2000-06-16.
* *
* $Id: lirc.c 1.14 2006/01/27 15:59:47 kls Exp $ * $Id: lirc.c 1.15 2006/05/28 08:48:13 kls Exp $
*/ */
#include "lirc.h" #include "lirc.h"
#include <netinet/in.h> #include <netinet/in.h>
#include <sys/socket.h> #include <sys/socket.h>
#define REPEATLIMIT 20 // ms
#define REPEATDELAY 350 // ms #define REPEATDELAY 350 // ms
#define KEYPRESSDELAY 150 // ms #define REPEATFREQ 100 // ms
#define REPEATTIMEOUT 500 // ms
#define RECONNECTDELAY 3000 // ms #define RECONNECTDELAY 3000 // ms
cLircRemote::cLircRemote(const char *DeviceName) cLircRemote::cLircRemote(const char *DeviceName)
@ -94,7 +94,7 @@ void cLircRemote::Action(void)
continue; continue;
} }
if (count == 0) { if (count == 0) {
if (strcmp(KeyName, LastKeyName) == 0 && FirstTime.Elapsed() < KEYPRESSDELAY) if (strcmp(KeyName, LastKeyName) == 0 && FirstTime.Elapsed() < REPEATDELAY)
continue; // skip keys coming in too fast continue; // skip keys coming in too fast
if (repeat) if (repeat)
Put(LastKeyName, false, true); Put(LastKeyName, false, true);
@ -104,8 +104,10 @@ void cLircRemote::Action(void)
timeout = -1; timeout = -1;
} }
else { else {
if (LastTime.Elapsed() < REPEATFREQ)
continue; // repeat function kicks in after a short delay (after last key instead of first key)
if (FirstTime.Elapsed() < REPEATDELAY) if (FirstTime.Elapsed() < REPEATDELAY)
continue; // repeat function kicks in after a short delay continue; // skip keys coming in too fast (for count != 0 as well)
repeat = true; repeat = true;
timeout = REPEATDELAY; timeout = REPEATDELAY;
} }
@ -113,7 +115,7 @@ void cLircRemote::Action(void)
Put(KeyName, repeat); Put(KeyName, repeat);
} }
else if (repeat) { // the last one was a repeat, so let's generate a release else if (repeat) { // the last one was a repeat, so let's generate a release
if (LastTime.Elapsed() >= REPEATDELAY) { if (LastTime.Elapsed() >= REPEATTIMEOUT) {
Put(LastKeyName, false, true); Put(LastKeyName, false, true);
repeat = false; repeat = false;
*LastKeyName = 0; *LastKeyName = 0;