From c1a5a7d50c4a45b3d3d65717c788e1925463a61e Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Fri, 1 Nov 2002 10:53:07 +0100 Subject: [PATCH] Only accepting key presses from the current remote control when learning --- CONTRIBUTORS | 2 ++ HISTORY | 2 ++ interface.c | 6 +++--- remote.c | 6 ++++-- remote.h | 6 +++--- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 7b75ac85..70b0b07e 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -426,6 +426,8 @@ Oliver Endriss one remote control for reporting a crash when learning the keys of several remote controls and pressing buttons of those that have already been learned + for making the remote control learn procedure accept key presses only from the + current remote control Reinhard Walter Buchner for adding some satellites to 'sources.conf' diff --git a/HISTORY b/HISTORY index 4f85f517..9b492e53 100644 --- a/HISTORY +++ b/HISTORY @@ -1677,3 +1677,5 @@ Video Disk Recorder Revision History The NEWSTRUCT compile time switch is now obsolete. The required driver is now the CVS HEAD version dated 2002-11-01 or later. - Adjusted the INSTALL file to the 1.1.x version. +- Only accepting key presses from the current remote control when learning (thanks to + Oliver Endriss). diff --git a/interface.c b/interface.c index a9f0d9a9..804747ae 100644 --- a/interface.c +++ b/interface.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: interface.c 1.59 2002/10/27 15:54:05 kls Exp $ + * $Id: interface.c 1.60 2002/11/01 10:50:38 kls Exp $ */ #include "interface.h" @@ -418,9 +418,9 @@ void cInterface::LearnKeys(void) Clear(); cRemote::Clear(); WriteText(1, 1, Headline); - cRemote::SetLearning(true); + cRemote::SetLearning(Remote); QueryKeys(Remote); - cRemote::SetLearning(false); + cRemote::SetLearning(NULL); Clear(); WriteText(1, 1, Headline); WriteText(1, 3, tr("Phase 3: Saving key codes")); diff --git a/remote.c b/remote.c index 6078c26b..415e37ea 100644 --- a/remote.c +++ b/remote.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: remote.c 1.30 2002/10/27 15:15:58 kls Exp $ + * $Id: remote.c 1.31 2002/11/01 10:50:13 kls Exp $ */ #include "remote.h" @@ -27,7 +27,7 @@ eKeys cRemote::keys[MaxKeys]; int cRemote::in = 0; int cRemote::out = 0; -bool cRemote::learning = false; +cRemote *cRemote::learning = NULL; char *cRemote::unknownCode = NULL; cMutex cRemote::mutex; cCondVar cRemote::keyPressed; @@ -109,6 +109,8 @@ bool cRemote::Put(uint64 Code, bool Repeat, bool Release) bool cRemote::Put(const char *Code, bool Repeat, bool Release) { + if (learning && this != learning) + return false; eKeys Key = Keys.Get(Name(), Code); if (Key != kNone) { if (Repeat) diff --git a/remote.h b/remote.h index 2bb9ea53..35cf62e5 100644 --- a/remote.h +++ b/remote.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: remote.h 1.18 2002/10/27 15:16:50 kls Exp $ + * $Id: remote.h 1.19 2002/11/01 10:48:11 kls Exp $ */ #ifndef __REMOTE_H @@ -24,7 +24,7 @@ private: static eKeys keys[MaxKeys]; static int in; static int out; - static bool learning; + static cRemote *learning; static char *unknownCode; static cMutex mutex; static cCondVar keyPressed; @@ -39,7 +39,7 @@ public: virtual ~cRemote(); virtual bool Initialize(void) { return true; } const char *Name(void) { return name; } - static void SetLearning(bool On) { learning = On; } + static void SetLearning(cRemote *Learning) { learning = Learning; } static void Clear(void); static bool Put(eKeys Key); static bool PutMacro(eKeys Key);