Skipping keys that come in too fast from LIRC

This commit is contained in:
Klaus Schmidinger 2003-04-27 11:41:51 +02:00
parent 7d3fa91850
commit 749b5090ab
3 changed files with 8 additions and 1 deletions

View File

@ -609,3 +609,6 @@ Manuel Hartl <icecep@gmx.net>
Benjamin Harling <benjamin.harling@web.de>
for suggesting to add a note regarding non-VDR files in the /videoX directories to
INSTALL
Christian Jacobsen <christian.jacobsen@stageholding.de>
for making the LIRC interface skip keys that come in too fast

View File

@ -2076,3 +2076,4 @@ Video Disk Recorder Revision History
start/stop time and the file name (suggested by Manuel Hartl).
- Added a note regarding non-VDR files in the /videoX directories to INSTALL
(suggested by Benjamin Harling).
- Skipping keys that come in too fast from LIRC (thanks to Christian Jacobsen).

5
lirc.c
View File

@ -6,7 +6,7 @@
*
* LIRC support added by Carsten Koch <Carsten.Koch@icem.de> 2000-06-16.
*
* $Id: lirc.c 1.5 2003/04/25 13:45:15 kls Exp $
* $Id: lirc.c 1.6 2003/04/27 11:39:47 kls Exp $
*/
#include "lirc.h"
@ -16,6 +16,7 @@
#define REPEATLIMIT 20 // ms
#define REPEATDELAY 350 // ms
#define KEYPRESSDELAY 150 // ms
cLircRemote::cLircRemote(char *DeviceName)
:cRemote("LIRC")
@ -77,6 +78,8 @@ void cLircRemote::Action(void)
sscanf(buf, "%*x %x %29s", &count, KeyName); // '29' in '%29s' is LIRC_KEY_BUF-1!
int Now = time_ms();
if (count == 0) {
if (strcmp(KeyName, LastKeyName) == 0 && Now - FirstTime < KEYPRESSDELAY)
continue; // skip keys coming in too fast
if (repeat)
Put(LastKeyName, false, true);
strcpy(LastKeyName, KeyName);