[PATCH] turn all VDR remotes on/off

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
-------------- next part --------------
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<cRemote> {};

[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux