]> git.webhop.me Git - input.git/commitdiff
input: add RC Support for more Hardware
authorGetAway <get-away@t-online.de>
Sat, 10 Mar 2018 20:18:20 +0000 (21:18 +0100)
committerGetAway <get-away@t-online.de>
Sat, 10 Mar 2018 20:18:20 +0000 (21:18 +0100)
- fix CONFIGDIR
- fix FONTDIR
- bump version 2.13

please build with -DHAVE_ARM_HARDWARE
                  -DHAVE_COOL_HARDWARE

input.c
input.h
io.c
io.h
rc_device.h [new file with mode: 0644]

diff --git a/input.c b/input.c
index a0cf31524fc5768aed8e8a8baeb5890d1fa08efc..709b0572020b80dc1aaadf82d73539ab30d7e2ad 100644 (file)
--- a/input.c
+++ b/input.c
 #include "gfx.h"
 #include "inputd.h"
 
-#define NCF_FILE       "/var/tuxbox/config/neutrino.conf"
-#define BUFSIZE        1024
-#define I_VERSION      2.12
+#define I_VERSION      2.13
+
+#ifndef CONFIGDIR
+#define CONFIGDIR "/var/tuxbox/config"
+#endif
+#ifndef FONTDIR
+#define FONTDIR        "/share/fonts"
+#endif
 
+#define NCF_FILE CONFIGDIR "/neutrino.conf"
 
-char FONT[128]="/share/fonts/neutrino.ttf";
+char FONT[128] = FONTDIR "/neutrino.ttf";
 // if font is not in usual place, we look here:
-#define FONT2 "/share/fonts/pakenham.ttf"
+#define FONT2 FONTDIR "/pakenham.ttf"
+
+#define BUFSIZE        1024
 
 //                                        CMCST,   CMCS,  CMCT,    CMC,    CMCIT,  CMCI,   CMHT,   CMH
 //                                        WHITE,   BLUE0, TRANSP,  CMS,    ORANGE, GREEN,  YELLOW, RED
@@ -241,7 +249,9 @@ char rstr[512]={0}, *title=NULL, *format=NULL, *defstr=NULL, *aptr=NULL, *rptr=N
                }
 
                //init framebuffer before 1st scale2res
-               fb = open(FB_DEVICE, O_RDWR);
+               fb=open(FB_DEVICE, O_RDWR);
+               if (fb < 0)
+                       fb=open(FB_DEVICE_FALLBACK, O_RDWR);
                if(fb == -1)
                {
                        perror(__plugin__ " <open framebuffer device>");
diff --git a/input.h b/input.h
index 188c367ca906f60e8fa6346f7de7992060aa6612..e576f36095fd5ae1e679761e2f5eb5f51717fb5b 100644 (file)
--- a/input.h
+++ b/input.h
 #include FT_CACHE_H
 #include FT_CACHE_SMALL_BITMAPS_H
 
+#ifndef FB_DEVICE
+#define FB_DEVICE      "/dev/fb/0"
+#endif
+#ifndef FB_DEVICE_FALLBACK
+#define FB_DEVICE_FALLBACK     "/dev/fb0"
+#endif
+
 #define BUFSIZE 1024
 
 enum {LEFT, CENTER, RIGHT};
@@ -156,9 +163,5 @@ extern char *butmsg[3];
 extern int buttons,selection;
 extern const char sc[8], tc[8];
 
-#ifndef FB_DEVICE
-#define FB_DEVICE      "/dev/fb/0"
-#endif
-
 #endif
 
diff --git a/io.c b/io.c
index 6614899cec9fee9016f9baa89142551c5efae6f1..22c058a63acc6c44bb03df7b3eae713046f3247c 100644 (file)
--- a/io.c
+++ b/io.c
@@ -19,6 +19,7 @@
 
 #include "current.h"
 #include "io.h"
+#include "rc_device.h"
 
 extern int instance;
 extern int get_instance(void);
@@ -31,6 +32,8 @@ static int rc;
 int InitRC(void)
 {
        rc = open(RC_DEVICE, O_RDONLY | O_CLOEXEC);
+       if(rc == -1)
+               rc = open(RC_DEVICE_FALLBACK, O_RDONLY | O_CLOEXEC);
        if(rc == -1)
        {
                perror(__plugin__ " <open remote control>");
diff --git a/io.h b/io.h
index 2cb93f8d93d55ad582d79db6d098774ccc3ab2f4..bb0af03799e91de3e26c5b5c27701658a7ce321d 100644 (file)
--- a/io.h
+++ b/io.h
@@ -1,8 +1,6 @@
 #ifndef __IO_H__
 #define __IO_H__
 
-#define RC_DEVICE      "/dev/input/nevis_ir"
-
 int InitRC(void);
 int CloseRC(void);
 int RCKeyPressed(void);
diff --git a/rc_device.h b/rc_device.h
new file mode 100644 (file)
index 0000000..bad11e3
--- /dev/null
@@ -0,0 +1,21 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#if HAVE_COOL_HARDWARE
+#define RC_DEVICE "/dev/input/nevis_ir"
+#define RC_DEVICE_FALLBACK "/dev/input/event0"
+
+#elif HAVE_SPARK_HARDWARE
+#define RC_DEVICE "/dev/input/nevis_ir"
+#define RC_DEVICE_FALLBACK "/dev/input/event1"
+
+#elif HAVE_DUCKBOX_HARDWARE
+#define RC_DEVICE "/dev/input/event0"
+#define RC_DEVICE_FALLBACK "/dev/input/event1"
+#else
+#define RC_DEVICE "/dev/input/event1"
+#define RC_DEVICE_FALLBACK "/dev/input/event0"
+
+#endif
+