From ddd1e13e53c4970058884e2af31c2681617e7bf3 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Mon, 15 Aug 2005 18:00:00 +0200 Subject: =?UTF-8?q?Version=201.3.29=20-=20Fixed=20a=20race=20condition=20i?= =?UTF-8?q?n=20cTransfer=20(thanks=20to=20Klaus=20Heppenheimer=20for=20rep?= =?UTF-8?q?orting=20this=20one).=20=20=20In=20doing=20so,=20the=20'active'?= =?UTF-8?q?=20variables=20used=20by=20the=20actual=20derived=20cThread=20c?= =?UTF-8?q?lasses=20=20=20have=20been=20replaced=20by=20the=20cThread::Run?= =?UTF-8?q?ning()=20function.=20=20=20Plugin=20authors=20may=20want=20to?= =?UTF-8?q?=20check=20their=20derived=20cThread=20classes=20and=20replace?= =?UTF-8?q?=20any=20'active'=20=20=20variables=20the=20same=20way=20as,=20?= =?UTF-8?q?for=20instance,=20done=20in=20transfer.c.=20-=20Fixed=20handlin?= =?UTF-8?q?g=20EPG=20data=20for=20time=20shifted=20events=20(thanks=20to?= =?UTF-8?q?=20Marco=20Schl=C3=BC=C3=9Fler).=20-=20Increased=20the=20defaul?= =?UTF-8?q?t=20value=20for=20'Min.=20user=20inactivity'=20to=20300=20minut?= =?UTF-8?q?es=20(suggested=20=20=20by=20Helmut=20Auer).=20-=20Now=20storin?= =?UTF-8?q?g=20the=20channel=20id=20in=20the=20info.vdr=20file=20even=20if?= =?UTF-8?q?=20there=20is=20no=20EPG=20info=20=20=20available=20(thanks=20t?= =?UTF-8?q?o=20Andreas=20Brachold=20for=20reporting=20that=20there=20are?= =?UTF-8?q?=20empty=20info.vdr=20=20=20files=20created=20in=20that=20case)?= =?UTF-8?q?.=20-=20Added=20some=20'mkdir=20-p'=20to=20the=20Makefile's=20'?= =?UTF-8?q?install'=20target=20(thanks=20to=20Wayne=20Keer).=20-=20Changed?= =?UTF-8?q?=20the=20title=20of=20the=20recording=20info=20menu=20(thanks?= =?UTF-8?q?=20to=20Rolf=20Ahrenberg).=20-=20Fixed=20handling=20the=20frame?= =?UTF-8?q?=20number=20display=20if=20'7'=20is=20pressed=20before=20the=20?= =?UTF-8?q?first=20editing=20=20=20mark,=20or=20'9'=20after=20the=20last?= =?UTF-8?q?=20one=20(thanks=20to=20Thomas=20G=C3=BCnther).=20-=20Now=20dis?= =?UTF-8?q?carding=20any=20previous=20numerical=20input=20to=20switch=20ch?= =?UTF-8?q?annels=20if=20Up,=20Down,=20Channel+,=20=20=20Channel-,=20Left?= =?UTF-8?q?=20or=20Right=20is=20pressed=20(thanks=20to=20Wolfgang=20Rohdew?= =?UTF-8?q?ald=20for=20reporting=20a=20=20=20problem=20with=20this).=20-?= =?UTF-8?q?=20Pressing=20Ok=20while=20entering=20a=20channel=20number=20no?= =?UTF-8?q?w=20immediately=20switches=20to=20that=20=20=20channel,=20witho?= =?UTF-8?q?ut=20waiting=20for=20further=20input.=20-=20Avoiding=20unnecess?= =?UTF-8?q?ary=20OSD=20draw=20operations=20caused=20by=20the=20audio=20tra?= =?UTF-8?q?ck=20description=20=20=20display=20in=20the=20ST:TNG=20skin's?= =?UTF-8?q?=20channel=20display=20(thanks=20to=20Oliver=20Endriss=20for=20?= =?UTF-8?q?reporting=20=20=20this).=20-=20Removed=20the=20VIDEO=5FSTILLPIC?= =?UTF-8?q?TURE=5FWORKS=5FWITH=5FVDR=5FFRAMES=20stuff=20from=20=20=20cDvbD?= =?UTF-8?q?evice::StillPicture(),=20since=20apparently=20the=20VIDEO=5FSTI?= =?UTF-8?q?LLPICTURE=20call=20works.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lirc.c | 84 +++++++++++++++++++++++++++++++++--------------------------------- 1 file changed, 42 insertions(+), 42 deletions(-) (limited to 'lirc.c') diff --git a/lirc.c b/lirc.c index 0714049..2eee9cc 100644 --- a/lirc.c +++ b/lirc.c @@ -6,7 +6,7 @@ * * LIRC support added by Carsten Koch 2000-06-16. * - * $Id: lirc.c 1.11 2005/07/31 10:18:09 kls Exp $ + * $Id: lirc.c 1.12 2005/08/15 12:28:10 kls Exp $ */ #include "lirc.h" @@ -61,48 +61,48 @@ void cLircRemote::Action(void) bool repeat = false; int timeout = -1; - for (; f >= 0;) { + while (Running() && f >= 0) { - bool ready = cFile::FileReady(f, timeout); - int ret = ready ? safe_read(f, buf, sizeof(buf)) : -1; + bool ready = cFile::FileReady(f, timeout); + int ret = ready ? safe_read(f, buf, sizeof(buf)) : -1; - if (ready && ret <= 0 ) { - esyslog("ERROR: lircd connection lost"); - close(f); - f = -1; - break; - } + if (ready && ret <= 0 ) { + esyslog("ERROR: lircd connection lost"); + close(f); + f = -1; + break; + } - if (ready && ret > 21) { - int count; - char KeyName[LIRC_KEY_BUF]; - sscanf(buf, "%*x %x %29s", &count, KeyName); // '29' in '%29s' is LIRC_KEY_BUF-1! - if (count == 0) { - if (strcmp(KeyName, LastKeyName) == 0 && FirstTime.Elapsed() < KEYPRESSDELAY) - continue; // skip keys coming in too fast - if (repeat) - Put(LastKeyName, false, true); - strcpy(LastKeyName, KeyName); - repeat = false; - FirstTime.Set(); - timeout = -1; - } - else { - if (FirstTime.Elapsed() < REPEATDELAY) - continue; // repeat function kicks in after a short delay - repeat = true; - timeout = REPEATDELAY; - } - LastTime.Set(); - Put(KeyName, repeat); - } - else if (repeat) { // the last one was a repeat, so let's generate a release - if (LastTime.Elapsed() >= REPEATDELAY) { - Put(LastKeyName, false, true); - repeat = false; - *LastKeyName = 0; - timeout = -1; - } - } - } + if (ready && ret > 21) { + int count; + char KeyName[LIRC_KEY_BUF]; + sscanf(buf, "%*x %x %29s", &count, KeyName); // '29' in '%29s' is LIRC_KEY_BUF-1! + if (count == 0) { + if (strcmp(KeyName, LastKeyName) == 0 && FirstTime.Elapsed() < KEYPRESSDELAY) + continue; // skip keys coming in too fast + if (repeat) + Put(LastKeyName, false, true); + strcpy(LastKeyName, KeyName); + repeat = false; + FirstTime.Set(); + timeout = -1; + } + else { + if (FirstTime.Elapsed() < REPEATDELAY) + continue; // repeat function kicks in after a short delay + repeat = true; + timeout = REPEATDELAY; + } + LastTime.Set(); + Put(KeyName, repeat); + } + else if (repeat) { // the last one was a repeat, so let's generate a release + if (LastTime.Elapsed() >= REPEATDELAY) { + Put(LastKeyName, false, true); + repeat = false; + *LastKeyName = 0; + timeout = -1; + } + } + } } -- cgit v1.2.3