From patchwork Tue Nov 8 07:39:21 2005 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucian Muresan X-Patchwork-Id: 12084 Received: from moutng.kundenserver.de ([212.227.126.177]) by www.linuxtv.org with esmtp (Exim 4.50) id 1EZO4s-0005nk-I0 for vdr@linuxtv.org; Tue, 08 Nov 2005 08:39:34 +0100 Received: from p54951A3C.dip0.t-ipconnect.de [84.149.26.60] (helo=gugumirx.no-ip.org) by mrelayeu.kundenserver.de (node=mrelayeu3) with ESMTP (Nemesis), id 0MKxQS-1EZO4s09XG-0005Pt; Tue, 08 Nov 2005 08:39:34 +0100 Received: from localhost (localhost [127.0.0.1]) by gugumirx.no-ip.org (Postfix) with ESMTP id 21A516EEFD for ; Tue, 8 Nov 2005 08:39:33 +0100 (CET) Received: from gugumirx.no-ip.org ([127.0.0.1]) by localhost (gugumirx.no-ip.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 04524-01 for ; Tue, 8 Nov 2005 08:39:24 +0100 (CET) Received: from [192.168.178.36] (jazz.gugumirx.no-ip.org [192.168.178.36]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by gugumirx.no-ip.org (Postfix) with ESMTP id E1AE16EE54 for ; Tue, 8 Nov 2005 08:39:23 +0100 (CET) Message-ID: <43705629.8000403@users.sourceforge.net> Date: Tue, 08 Nov 2005 08:39:21 +0100 From: Lucian Muresan User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: vdr@linuxtv.org X-Virus-Scanned: amavisd-new at gugumirx.no-ip.org X-Provags-ID: kundenserver.de abuse@kundenserver.de login:bc0772ca0f677a4ff000d75d9f89eb79 Subject: [vdr] [PATCH] turn all VDR remotes on/off 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: Tue, 08 Nov 2005 07:39:34 -0000 Status: O X-Status: X-Keywords: X-UID: 5990 Hi, following your suggestions in the thread "@Klaus, before I start working on this patch..." I made a patch that disables/enables all remotes in VDR, only triggerd by a plugin. So the default behaviour remains the same, and if I load my plugin I can quickly enable/disable the remotes (I even need to reenable them right before every HITK and disable them back right after that, therefore the way this was solved in vdr-externalplayer by destroying/creating the cRemote Objects all the time didn't suit me, therefore I need such a quick way of turning them on and off). I hope this gets included in some form, and maybe vdr-externalplayer can then too switch to this method of enabling/disabling the remotes. Sorry that the patch is against 1.3.34, but I think it should apply well even to 1.3.36. Lucian P.S. For those interested, my plugin "vdr-freevo" doesn't do much for now (I guess it will later), but enabling/disabling the remotes via SVDRP command "plug freevo rctl on/off", more details to come later today on the Freevo MLs. diff -Naur vdr-1.3.34_orig/remote.c vdr-1.3.34/remote.c --- vdr-1.3.34_orig/remote.c 2005-09-03 14:29:48.000000000 +0200 +++ vdr-1.3.34/remote.c 2005-11-05 01:03:46.000000000 +0100 @@ -28,6 +28,7 @@ cMutex cRemote::mutex; cCondVar cRemote::keyPressed; const char *cRemote::plugin = NULL; +bool cRemote::Enabled = true; cRemote::cRemote(const char *Name) { @@ -73,6 +74,8 @@ bool cRemote::Put(eKeys Key, bool AtFront) { + if (!Enabled) + return true; if (Key != kNone) { cMutexLock MutexLock(&mutex); if (in != out && (keys[out] & k_Repeat) && (Key & k_Release)) @@ -101,6 +104,8 @@ bool cRemote::PutMacro(eKeys Key) { + if (!Enabled) + return true; const cKeyMacro *km = KeyMacros.Get(Key); if (km) { plugin = km->Plugin(); @@ -118,6 +123,8 @@ bool cRemote::Put(uint64 Code, bool Repeat, bool Release) { + if (!Enabled) + return true; char buffer[32]; snprintf(buffer, sizeof(buffer), "%016LX", Code); return Put(buffer, Repeat, Release); @@ -125,6 +132,8 @@ bool cRemote::Put(const char *Code, bool Repeat, bool Release) { + if (!Enabled) + return true; if (learning && this != learning) return false; eKeys Key = Keys.Get(Name(), Code); @@ -175,6 +184,11 @@ } } +void cRemote::EnableRemote(bool bEnable) +{ + Enabled = bEnable; +} + // --- cRemotes -------------------------------------------------------------- cRemotes Remotes; diff -Naur vdr-1.3.34_orig/remote.h vdr-1.3.34/remote.h --- vdr-1.3.34_orig/remote.h 2005-09-03 14:28:42.000000000 +0200 +++ vdr-1.3.34/remote.h 2005-11-05 00:52:01.000000000 +0100 @@ -29,6 +29,7 @@ static cCondVar keyPressed; static const char *plugin; char *name; + static bool Enabled; protected: cRemote(const char *Name); const char *GetSetup(void); @@ -51,6 +52,7 @@ static const char *GetPlugin(void) { return plugin; } static bool HasKeys(void); static eKeys Get(int WaitMs = 1000, char **UnknownCode = NULL); + static void EnableRemote(bool bEnable = true); }; class cRemotes : public cList {};