[vdr-plugin-remote] 01/03: Imported Upstream version 0.6.0

Tobias Grimm tiber-guest at moszumanska.debian.org
Thu Sep 3 17:03:00 UTC 2015


This is an automated email from the git hooks/post-receive script.

tiber-guest pushed a commit to annotated tag debian/0.6.0-1
in repository vdr-plugin-remote.

commit 768b710a714218e9c9bb78b7e15f77fa56794ec1
Author: etobi <git at e-tobi.net>
Date:   Thu Sep 3 19:00:55 2015 +0200

    Imported Upstream version 0.6.0
---
 CONTRIBUTORS                              |   5 +-
 HISTORY                                   |  11 ++
 README                                    |  14 +--
 misc/remote.conf.event5.wheelmouse        |   5 +
 misc/remote.conf.event5.wheelmouse.readme |  14 +++
 remote.c                                  |  12 +-
 ttystatus.c                               | 195 +++++++++++++++++++-----------
 ttystatus.h                               |  14 ++-
 8 files changed, 181 insertions(+), 89 deletions(-)

diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 54ae469..7635b89 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -29,5 +29,8 @@ Waldemar Nikel
 Joachim Selinger <selinger at idefix dot s dot bawue dot de>
  for suggesting to implement selection of the input device by path.
 
-Tobias Grimm tobias dot grimm at e-tobi dot net
+Tobias Grimm <tobias dot grimm at e-tobi dot net>
  for providing a better gettext detection using i18n.h.
+
+Thomas Reufer <thomas at reufer dot ch>
+ for adding support for event type 2 (mouse wheel, rotary-encoder).
diff --git a/HISTORY b/HISTORY
index 7f52eb5..f904822 100644
--- a/HISTORY
+++ b/HISTORY
@@ -130,3 +130,14 @@ VDR Plugin 'remote' Revision History
 - Access /proc/av7110_ir in write-only mode (required by kernel 2.6.34+).
 - Adopt Makefile for vdr 1.7.34+.
 
+
+2015-04-12: Version 0.6.0
+- Use Repeat Delay/Repeat Delta settings (VDR->Setup->Miscellaneous).
+- Support event type 2 (mouse wheel, rotary-encoder) as a remote control
+  (thanks to Thomas Reufer).
+- Improved OSD emulation:
+  o Reworked tabulator processing.
+  o Optimal use of limited screen width.
+  o Avoid display errors with VDR 2.2.0.
+  o Fixed misaligned output caused by multi-byte characters.
+  o Some speed improvements.
diff --git a/README b/README
index 9e3bc7f..2865f93 100644
--- a/README
+++ b/README
@@ -1,7 +1,7 @@
 remote - Remote Control plugin for the Video Disk Recorder (VDR)
 ================================================================
 
-Version:                      0.5.0
+Version:                      0.6.0
 
 Written by:                   Oliver Endriss <o.endriss at gmx.de>
 
@@ -24,7 +24,7 @@ The following remote control devices are supported:
     - Built-in remote control port of the av711x-based DVB cards
       (SD full-featured cards), e.g. DVB-S Nexus.
     - Remote control port of some budget cards, e.g. Nova-CI.
-    - Other input devices.
+    - Other input devices (rotary-encoder, wheel mouse).
     See file FAQ for a list of cards which have been reported to work.
 
 (b) keyboard (tty driver): /dev/console, /dev/ttyX
@@ -33,17 +33,13 @@ The following remote control devices are supported:
 
 (d) LIRC
 
-Notes:
-[1] supported by DVB and dvb-kernel
-[2] supported by dvb-kernel only
-
 
 Installation:
 -------------
 The Remote Control plugin is installed the same way as any other plugin:
 - cd VDR/PLUGINS/src
-- tar xfz vdr-remote-0.5.0.tgz
-- ln -s remote-0.5.0 remote
+- tar xfz vdr-remote-0.6.0.tgz
+- ln -s remote-0.6.0 remote
 - cd ../..
 - make plugins
 
@@ -94,7 +90,7 @@ for all remote controls.)
 
 Notes:
 [3] There is a restriction:
-    By default, /proc/av7110 is owned by root with permissions -rw-r-r- (0644).
+    By default, /proc/av7110 is owned by root with permissions --w------- (0200).
     Therefore, the new autodetect feature can be used only,
     - if vdr runs as root
     or
diff --git a/misc/remote.conf.event5.wheelmouse b/misc/remote.conf.event5.wheelmouse
new file mode 100644
index 0000000..459bfb3
--- /dev/null
+++ b/misc/remote.conf.event5.wheelmouse
@@ -0,0 +1,5 @@
+remote-event5.0        0000000100010112
+remote-event5.7        0000000100010110
+remote-event5.9        0000000100010111
+remote-event5.4        0000000100020008
+remote-event5.6        FFFFFFFF00020008
diff --git a/misc/remote.conf.event5.wheelmouse.readme b/misc/remote.conf.event5.wheelmouse.readme
new file mode 100644
index 0000000..7689e87
--- /dev/null
+++ b/misc/remote.conf.event5.wheelmouse.readme
@@ -0,0 +1,14 @@
+Configuration for a rotary-encoder/wheel mouse
+==============================================
+
+Notes:
+- This is an example how a standard wheel mouse can be used to move editing marks.
+- See http://www.vdr-portal.de/board18-vdr-hardware/board13-fernbedienungen/125341-schneiden-wie-die-profis
+
+vdr key            code                mouse action                  vdr action
+-------------------------------------------------------------------------------------
+remote-event5.0    0000000100010112    press wheel (middle button)   toggle mark
+remote-event5.7    0000000100010110    press left button             previous mark
+remote-event5.9    0000000100010111    press right button            next mark
+remote-event5.4    0000000100020008    turn wheel up                 move mark left
+remote-event5.6    FFFFFFFF00020008    turn wheel down               move mark right
diff --git a/remote.c b/remote.c
index 9b2d79f..a8c654a 100644
--- a/remote.c
+++ b/remote.c
@@ -3,7 +3,7 @@
  *
  * remote.c: main source file
  *
- * Copyright (C) 2002-2012 Oliver Endriss <o.endriss at gmx.de>
+ * Copyright (C) 2002-2015 Oliver Endriss <o.endriss at gmx.de>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -48,7 +48,7 @@
 #define AV7110_PARM_INVERSION     "/sys/module/dvb_ttpci/parameters/ir_inversion"
 #endif
 
-static const char *VERSION        = "0.5.0";
+static const char *VERSION        = "0.6.0";
 static const char *DESCRIPTION    = trNOOP("Remote control");
 
 
@@ -137,6 +137,10 @@ void cRemoteGeneric::Action(void)
                 Put(code);
                 DSYSLOG("%s: press %016llx\n", device, code);
                 lastcode = code;
+#if APIVERSNUM >= 10741
+                repeatdelay = Setup.RcRepeatDelay;
+                repeatfreq = Setup.RcRepeatDelta;
+#endif
 #if VDRVERSNUM <= 10317
                 last = first = now;
 #else
@@ -443,11 +447,11 @@ uint64_t cRemoteDevInput::getKey(void)
 
     do
         n = read(fh, &ev, sizeof ev);
-    while (n == sizeof ev && ev.type != 1);
+    while (n == sizeof ev && ev.type != 1 && ev.type != 2);
 
     if (n == sizeof ev)
     {
-        if (ev.value)
+        if (ev.value && ev.type == 1)
             ev.value = 1;
         code = ((uint64_t)ev.value << 32) | ((uint64_t)ev.type << 16) | (uint64_t)ev.code;
     }
diff --git a/ttystatus.c b/ttystatus.c
index 61caaeb..3ed0bdc 100644
--- a/ttystatus.c
+++ b/ttystatus.c
@@ -3,7 +3,7 @@
  *
  * ttystatus.c: tty osd emulation
  *
- * Copyright (C) 2002-2012 Oliver Endriss <o.endriss at gmx.de>
+ * Copyright (C) 2002-2015 Oliver Endriss <o.endriss at gmx.de>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -24,72 +24,97 @@
 
 #include <vdr/plugin.h>
 #include <vdr/status.h>
+#include <wchar.h>
 #include "ttystatus.h"
 
 
-void cTtyStatus::display(const char *buf)
+void cTtyStatus::dprintf(const char *Text)
 {
-    int n = strlen(buf);
-    int tabs = 0;
-    int tabstop = 30;
-    int pos = 0;
+    char *text = strdup(Text);
 
-    for (int i = 0; i < n; i++)
+    if (text)
     {
-        if (buf[i] == '\t')
-            tabs++;
+        for (int i = 0; i < (int)strlen(text); i++)
+        {
+            switch(text[i])
+            {
+                case '\t':
+                    text[i] = '|';
+                    break;
+            }
+        }
+        printf("%s: '%s'\n", __func__, text);
+        free(text);
     }
+}
 
-    if (tabs == 1)
-        tabstop = 40;
-    else if (tabs == 2)
-        tabstop = 10;
-    else if (tabs == 3)
-        tabstop = 8;
-    else
-        tabstop = 4;
-  
-    for (int i = 0; i < n && pos < 80; i++)
+
+void cTtyStatus::display(const char *buf, const bool fillEOL, const int limit)
+{
+    int n = strlen(buf);
+    int pos = 0;
+    int t = 0;
+    mbstate_t ps;
+    static const char blanks[] = "                    ";
+
+    memset(&ps, 0, sizeof ps);
+
+    for (int i = 0; i < n && pos < limit; )
     {
         switch (buf[i])
         {
             case '\t':
                 do 
                 {
-                    write(fd, " ", 1);
+                    write(fd, blanks, 1);
                     pos++;
                 }
-                while (pos % tabstop != 0);
+                while (t < numTabs && pos <= tabPos[t] + t+1);
+                if (t < numTabs)
+                    t++;
+                i++;
                 break;
 
             case '\n':
                 write(fd, "\r\n", 2);
+                i++;
                 break;
 
             default:
-                write(fd, buf+i, 1);
+#if 1
+                // first calculate number of bytes, then perform a single 'write'
+                const char *p = buf+i;
+                int l = 0;
+                while (*p != '\t' && *p != '\n' && pos < limit)
+                {
+                    int l2 = mbrlen(p, MB_CUR_MAX, &ps);
+                    if (l2 == 0)
+                        break;
+                    if (l2 < 0)
+                        l2 = 1;
+                    p += l2;
+                    l += l2;
+                    pos++;
+                }
+#else
+                // simple but suboptimal: one 'write' for each character
+                int l = mbrlen(buf+i, MB_CUR_MAX, &ps);
+                if (l < 0)
+                    l = 1;
                 pos++;
+#endif
+                write(fd, buf+i, l);
+                i += l;
                 break;
         }
     }
-}
-
 
-void cTtyStatus::display2(const char *buf)
-{
-    for (size_t i = 0; i < strlen(buf); i++)
+    while (fillEOL && pos < limit)
     {
-        switch(buf[i])
-        {
-            case '\n':
-                write(fd, "\r\n", 2);
-                break;
-
-            default:
-                write(fd, buf+i, 1);
-                break;
-        }
-    } 
+        n = min(limit-pos, (int)sizeof(blanks)-1);
+        write(fd, blanks, n);
+        pos += n;
+    }
 }
 
 
@@ -98,35 +123,35 @@ void cTtyStatus::set_color(int col)
     switch(col)
     {
         case WHITE_BLACK:
-            print("\e[1m\e[37m\e[40m");
+            display("\e[1m\e[37m\e[40m");
 	    break;
 
         case YELLOW_BLACK:
-            print("\e[1m\e[33m\e[40m");
+            display("\e[1m\e[33m\e[40m");
 	    break;
 
         case CYAN_BLACK:
-            print("\e[1m\e[36m\e[40m");
+            display("\e[1m\e[36m\e[40m");
 	    break;
 
         case BLACK_CYAN:
-            print("\e[0m\e[30m\e[46m");
+            display("\e[0m\e[30m\e[46m");
 	    break;
 
         case BLACK_RED:
-            print("\e[0m\e[30m\e[41m");
+            display("\e[0m\e[30m\e[41m");
 	    break;
 
         case BLACK_GREEN:
-            print("\e[0m\e[30m\e[42m");
+            display("\e[0m\e[30m\e[42m");
             break;
 
         case BLACK_YELLOW:
-            print("\e[0m\e[30m\e[43m");
+            display("\e[0m\e[30m\e[43m");
             break;
 
         case WHITE_BLUE:
-            print("\e[1m\e[37m\e[44m");
+            display("\e[1m\e[37m\e[44m");
             break;
     }
 }		  
@@ -220,7 +245,8 @@ void cTtyStatus::OsdTitle(const char *Title)
     clear_screen();
     set_color(BLACK_CYAN);
     set_pos(0, 0);
-    print("     %-80s", Title);
+    display("", true, 5);
+    display(Title, true, 75);
     set_color(WHITE_BLACK);
     refresh();
     set_pos(2, 0);
@@ -233,12 +259,13 @@ void cTtyStatus::OsdStatusMessage(const char *Message)
     if (Message)
     {
         set_color(BLACK_YELLOW);
-        print("     %-80s", Message);
+        display("", true, 5);
+        display(Message, true, 75);
     }
     else
     {
         set_color(WHITE_BLACK);
-        print("%-80s", "");
+        display("", true);
     }
     refresh();
     set_pos(2, 0);
@@ -249,20 +276,24 @@ void cTtyStatus::OsdHelpKeys(const char *Red, const char *Green,
                              const char *Yellow, const char *Blue)
 {
     set_color(Red ? BLACK_RED : WHITE_BLACK);
-    set_pos(24,0);
-    print("     %-15s", Red ? Red : "");
+    set_pos(24, 0);
+    display("", true, 5);
+    display(Red ? Red : "", true, 15);
 
     set_color(Green ? BLACK_GREEN: WHITE_BLACK);
-    set_pos(24,20);
-    print("     %-15s", Green ? Green : "");
+    set_pos(24, 20);
+    display("", true, 5);
+    display(Green ? Green : "", true, 15);
 
     set_color(Yellow ? BLACK_YELLOW : WHITE_BLACK);
-    set_pos(24,40);
-    print("     %-15s", Yellow ? Yellow : "");
+    set_pos(24, 40);
+    display("", true, 5);
+    display(Yellow ? Yellow : "", true, 15);
 
     set_color(Blue ? WHITE_BLUE : WHITE_BLACK);
-    set_pos(24,60);
-    print("     %-15s", Blue ? Blue : "");
+    set_pos(24, 60);
+    display("", true, 5);
+    display(Blue ? Blue : "", true, 15);
 
     refresh();
     set_pos(2, 0);
@@ -331,13 +362,35 @@ void cTtyStatus::OsdCurrentItem(const char *Text)
         first = max(first,0);
         last = min(first+20,lastIndex);
 
+        // Update tab positions in window
+        memset(tabPos, 0, sizeof tabPos);
+        numTabs = 0;
+        for (i = first; i <= last; i++)
+        {
+            int n = strlen(lineBuf[i]);
+            int t = 0;
+            for (int j = 0; j < n; j++)
+            {
+                if (lineBuf[i][j] == '\t' && t < maxTabs)
+                {
+                    tabPos[t] = max(tabPos[t], j);
+                    t++;
+                }
+            }
+            numTabs = max(numTabs, t);
+        }
+#if 0
+	for (i = 0; i < numTabs; i++)
+	    printf("tab %d at position %d\n", i, tabPos[i]);
+#endif
+
         set_color(WHITE_BLACK);
         for (i = first; i <= last; i++)
         {
             if (i == currIndex)
                 set_color(BLACK_CYAN);
             set_pos(2+i-first, 0);
-            print("%-80s", lineBuf[i]);
+            display(lineBuf[i], true);
             if (i == currIndex)
                 set_color(WHITE_BLACK);
         }
@@ -346,6 +399,10 @@ void cTtyStatus::OsdCurrentItem(const char *Text)
     }
 }
 
+
+//
+// Note: Used for event decription, recording info etc.
+//
 void cTtyStatus::OsdTextItem(const char *Text, bool Scroll)
 {
     // dsyslog("%s: '%s' scroll %d", __FUNCTION__, Text, Scroll);
@@ -353,8 +410,8 @@ void cTtyStatus::OsdTextItem(const char *Text, bool Scroll)
     if (Text)
     {
         set_color(CYAN_BLACK);
-        display2(Text);
-        display2("\n\n");
+        display(Text, false, 0x7fff);
+        display("\n\n");
         refresh();
     }
     else
@@ -369,7 +426,7 @@ void cTtyStatus::OsdChannel(const char *Text)
     clear_screen();
     set_color(WHITE_BLACK);
     set_pos(19, 0);
-    print("%-80s", Text);
+    display(Text);
     refresh();
 }
 
@@ -387,16 +444,16 @@ void cTtyStatus::OsdProgramme(time_t PresentTime, const char *PresentTitle,
     {
         set_color(YELLOW_BLACK);
         set_pos(line++, 0);
-        print("%5s ", buffer);
+        display(buffer, true, 6);
         set_color(CYAN_BLACK);
-        print("%s", PresentTitle);
+        display(PresentTitle);
     }
     if (PresentSubtitle)
     {
         if (strlen(PresentSubtitle))
         {
-            set_pos(line++, 0);
-            print("%5s %s", "", PresentSubtitle);
+            set_pos(line++, 6);
+            display(PresentSubtitle);
         }
     }
 
@@ -405,14 +462,14 @@ void cTtyStatus::OsdProgramme(time_t PresentTime, const char *PresentTitle,
     {
         set_color(YELLOW_BLACK);
         set_pos(line++, 0);
-        print("%5s ", buffer);
+        display(buffer, true, 6);
         set_color(CYAN_BLACK);
-        print("%s", FollowingTitle);
+        display(FollowingTitle);
     }
     if (FollowingSubtitle)
     {
-        set_pos(line++, 0);
-        print("%5s %s", "", FollowingSubtitle);
+        set_pos(line++, 6);
+        display(FollowingSubtitle);
     }
 
     refresh();
diff --git a/ttystatus.h b/ttystatus.h
index a906827..5ec3cf2 100644
--- a/ttystatus.h
+++ b/ttystatus.h
@@ -3,7 +3,7 @@
  *
  * ttystatus.h: tty osd emulation
  *
- * Copyright (C) 2002-2012 Oliver Endriss <o.endriss at gmx.de>
+ * Copyright (C) 2002-2015 Oliver Endriss <o.endriss at gmx.de>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -39,10 +39,10 @@
 #include <vdr/status.h>
 
 
-#define clear_screen()   { set_color(WHITE_BLACK); print("\e[2J"); }
+#define clear_screen()   { set_color(WHITE_BLACK); display("\e[2J"); }
 #define refresh()        
 #define set_pos(y,x)     print("\e[%d;%dH", y+1, x+1);
-#define print(fmt...)    { char buf[100]; snprintf(buf,100, fmt); display(buf); }
+#define print(fmt...)    { char buf[140]; snprintf(buf,sizeof buf,fmt); display(buf); }
   
 
 /****************************************************************************/
@@ -54,11 +54,13 @@ private:
   int numEntries;
   int lastIndex;
   int currIndex;
-  int tabstop;
+  static const int maxTabs = 10;
+  int numTabs;
+  int tabPos[maxTabs];
 
 protected:
-  virtual void display(const char *buf);
-  virtual void display2(const char *buf);
+  void dprintf(const char *Text);
+  virtual void display(const char *buf, const bool fillEOL = false, const int limit = 80);
   virtual void set_color(int col);
 #if VDRVERSNUM <= 10337
   virtual void Replaying(const cControl *Control, const char *Name);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-vdr-dvb/vdr-plugin-remote.git



More information about the pkg-vdr-dvb-changes mailing list