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 --- rcu.c | 105 +++++++++++++++++++++++++++++++++--------------------------------- 1 file changed, 52 insertions(+), 53 deletions(-) (limited to 'rcu.c') diff --git a/rcu.c b/rcu.c index fea31ec..f1f0de5 100644 --- a/rcu.c +++ b/rcu.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: rcu.c 1.9 2005/07/31 10:17:45 kls Exp $ + * $Id: rcu.c 1.10 2005/08/15 12:30:21 kls Exp $ */ #include "rcu.h" @@ -98,60 +98,59 @@ void cRcuRemote::Action(void) uint64 LastCommand = 0; bool repeat = false; - //XXX - for (; f >= 0;) { + while (Running() && f >= 0) { - LOCK_THREAD; + LOCK_THREAD; - if (ReceiveByte(REPEATLIMIT) == 'X') { - for (int i = 0; i < 6; i++) { - int b = ReceiveByte(); - if (b >= 0) { - buffer.raw[i] = b; - if (i == 5) { - unsigned short Address = ntohs(buffer.data.address); // the PIC sends bytes in "network order" - uint64 Command = ntohl(buffer.data.command); - if (code == 'B' && Address == 0x0000 && Command == 0x00004000) - // Well, well, if it isn't the "d-box"... - // This remote control sends the above command before and after - // each keypress - let's just drop this: - break; - Command |= uint64(Address) << 32; - if (Command != LastCommand) { - LastCommand = Command; - repeat = false; - FirstTime.Set(); - } - else { - if (FirstTime.Elapsed() < REPEATDELAY) - break; // repeat function kicks in after a short delay - repeat = true; - } - Put(Command, repeat); - receivedCommand = true; - } - } - else - break; - } - } - else if (repeat) { // the last one was a repeat, so let's generate a release - Put(LastCommand, false, true); - repeat = false; - LastCommand = 0; - } - else { - LastCommand = 0; - if (numberToSend >= 0) { - Number(numberToSend); - numberToSend = -1; - } - } - if (code && time(NULL) - LastCodeRefresh > 60) { - SendCommand(code); // in case the PIC listens to the wrong code - LastCodeRefresh = time(NULL); - } - } + if (ReceiveByte(REPEATLIMIT) == 'X') { + for (int i = 0; i < 6; i++) { + int b = ReceiveByte(); + if (b >= 0) { + buffer.raw[i] = b; + if (i == 5) { + unsigned short Address = ntohs(buffer.data.address); // the PIC sends bytes in "network order" + uint64 Command = ntohl(buffer.data.command); + if (code == 'B' && Address == 0x0000 && Command == 0x00004000) + // Well, well, if it isn't the "d-box"... + // This remote control sends the above command before and after + // each keypress - let's just drop this: + break; + Command |= uint64(Address) << 32; + if (Command != LastCommand) { + LastCommand = Command; + repeat = false; + FirstTime.Set(); + } + else { + if (FirstTime.Elapsed() < REPEATDELAY) + break; // repeat function kicks in after a short delay + repeat = true; + } + Put(Command, repeat); + receivedCommand = true; + } + } + else + break; + } + } + else if (repeat) { // the last one was a repeat, so let's generate a release + Put(LastCommand, false, true); + repeat = false; + LastCommand = 0; + } + else { + LastCommand = 0; + if (numberToSend >= 0) { + Number(numberToSend); + numberToSend = -1; + } + } + if (code && time(NULL) - LastCodeRefresh > 60) { + SendCommand(code); // in case the PIC listens to the wrong code + LastCodeRefresh = time(NULL); + } + } } int cRcuRemote::ReceiveByte(int TimeoutMs) -- cgit v1.2.3