From patchwork Sat May 27 20:04:26 2006 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ville_Skytt=C3=A4?= X-Patchwork-Id: 12324 Received: from smtp2.pp.htv.fi ([213.243.153.35]) by www.linuxtv.org with esmtp (Exim 4.50) id 1Fk51R-0002hw-IF for vdr@linuxtv.org; Sat, 27 May 2006 22:04:29 +0200 Received: from [192.168.2.5] (cs181056070.pp.htv.fi [82.181.56.70]) by smtp2.pp.htv.fi (Postfix) with ESMTP id 61903296BE1 for ; Sat, 27 May 2006 23:04:27 +0300 (EEST) Subject: Re: [vdr] lirc improvement suggestion From: Ville =?ISO-8859-1?Q?Skytt=E4?= To: VDR Mailing List In-Reply-To: <44788BE7.6070902@gmx.de> References: <44788BE7.6070902@gmx.de> Date: Sat, 27 May 2006 23:04:26 +0300 Message-Id: <1148760266.5182.27.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 (2.6.1-1.fc5.2) X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: VDR Mailing List List-Id: VDR Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 May 2006 20:04:29 -0000 Status: O X-Status: X-Keywords: X-UID: 9615 On Sat, 2006-05-27 at 19:27 +0200, Joerg Riechardt wrote: > I used to use the usbremote plugin, now I switched to lirc, because I > wanted to play with irexec. Since then vdr didnĀ“t react to my remote > control as I was used to any more. I had sometimes double reactions on > one keypress as other people have described and the speed of the > reactions was weird. After investigating I found following solution, > which makes me 100% happy. Maybe other people like it too? I like it. The patch you posted had some whitespace/linewrap issues though, which are hopefully fixed by the attached one (no other changes in it). --- vdr-1.4.0/lirc.c~ 2006-01-27 17:59:47.000000000 +0200 +++ vdr-1.4.0/lirc.c 2006-05-27 22:04:19.000000000 +0300 @@ -13,9 +13,9 @@ #include #include -#define REPEATLIMIT 20 // ms #define REPEATDELAY 350 // ms -#define KEYPRESSDELAY 150 // ms +#define REPEATFREQ 100 // ms +#define REPEATTIMEOUT 500 // ms #define RECONNECTDELAY 3000 // ms cLircRemote::cLircRemote(const char *DeviceName) @@ -94,7 +94,7 @@ continue; } 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 if (repeat) Put(LastKeyName, false, true); @@ -104,8 +104,10 @@ timeout = -1; } 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) - continue; // repeat function kicks in after a short delay + continue; // skip keys coming in too fast (for count != 0 as well) repeat = true; timeout = REPEATDELAY; } @@ -113,7 +115,7 @@ Put(KeyName, repeat); } 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); repeat = false; *LastKeyName = 0;