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

please build with -DHAVE_ARM_HARDWARE
                  -DHAVE_COOL_HARDWARE

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

diff --git a/io.c b/io.c
index 0b74a78bd05b59c82de21463e21f384f09fb3b2b..b0c8ccad7bdadb0d97f1f4b70200eae43cce6361 100644 (file)
--- a/io.c
+++ b/io.c
@@ -20,6 +20,7 @@
 
 #include "current.h"
 #include "io.h"
+#include "rc_device.h"
 
 extern int instance;
 struct input_event ev;
@@ -29,6 +30,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 27782bd62d4308fcdfe199ffe7cd7865f70a6639..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
+
index 237f02cc33fae7a9ce3ea215a28fed0d911cc057..c376dcd762954e59d86fcf6eb4473e6616fd3f9b 100644 (file)
 #include "gfx.h"
 #include "pngw.h"
 
+#define SH_VERSION 2.15
 
-#define SH_VERSION 2.14
+#ifndef CONFIGDIR
+#define CONFIGDIR "/var/tuxbox/config"
+#endif
+#ifndef FONTDIR
+#define FONTDIR        "/share/fonts"
+#endif
 
-static char CFG_FILE[128]="/var/tuxbox/config/shellexec.conf";
+#define NCF_FILE CONFIGDIR "/neutrino.conf"
 
-#define FONT2 "/share/fonts/pakenham.ttf"
+char FONT[128]= FONTDIR "/neutrino.ttf";
 // if font is not in usual place, we look here:
-char FONT[128]="/share/fonts/neutrino.ttf";
+#define FONT2 FONTDIR "/pakenham.ttf"
+
+static char CFG_FILE[128]= CONFIGDIR "/shellexec.conf";
 
 //                                             CMCST,  CMCS,   CMCT,   CMC,    CMCIT,  CMCI,   CMHT,   CMH
 //                                             WHITE,  BLUE0,  TRANSP, CMS,    ORANGE, GREEN,  YELLOW, RED
@@ -1598,7 +1606,9 @@ int main (int argc, char **argv)
        }
 
        //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>");
@@ -1779,7 +1789,7 @@ int main (int argc, char **argv)
        }
        else
                desc.face_id = FONT;
-       printf("%s <FTC_Manager_LookupFace Font \"%p\" loaded>\n", __plugin__, desc.face_id);
+       printf("%s <FTC_Manager_LookupFace Font \"%s\" loaded>\n", __plugin__, (char*)desc.face_id);
 
        use_kerning = FT_HAS_KERNING(face);
        desc.flags = FT_LOAD_RENDER | FT_LOAD_FORCE_AUTOHINT;
index 9e0ef48ab2b126f69cbdf1bf6565267ac7cf6ea2..40725bcbe95af4c8ce2dfcd2c00890dc386bed11 100644 (file)
 #include FT_CACHE_H
 #include FT_CACHE_SMALL_BITMAPS_H
 
-#define NCF_FILE "/var/tuxbox/config/neutrino.conf"
+#ifndef FB_DEVICE
+#define FB_DEVICE      "/dev/fb/0"
+#endif
+#ifndef FB_DEVICE_FALLBACK
+#define FB_DEVICE_FALLBACK     "/dev/fb0"
+#endif
+
 
 //rc codes
 
@@ -185,10 +191,6 @@ extern int instance;
 int get_instance(void);
 void put_instance(int pval);
 
-#ifndef FB_DEVICE
-#define FB_DEVICE      "/dev/fb/0"
-#endif
-
 int key_count;
 unsigned short lastkey;
 
diff --git a/text.c b/text.c
index 5df9d6799f6ea0a40e70cff5be3187b1572260a6..407ea00c2ff71e4ca079dc45e48afb65b8773e83 100644 (file)
--- a/text.c
+++ b/text.c
@@ -135,17 +135,18 @@ void TranslateString(char *src, size_t size)
                        fptr++;
                        int i;
                        for (i = 0; sc[i] && (sc[i] != *fptr); i++);
-                               if (*fptr == 'd') {
-                                       *tptr++ = 0xC2;
-                                       *tptr++ = 0xb0;
-                                       fptr++;
-                               } else if (sc[i]) {
-                                       *tptr++ = 0xC3;
-                                       *tptr++ = su[i];
-                                       fptr++;
-                               } else
-                                       *tptr++ = '~';
-               } else
+                       if (*fptr == 'd') {
+                               *tptr++ = 0xC2;
+                               *tptr++ = 0xb0;
+                               fptr++;
+                       } else if (sc[i]) {
+                               *tptr++ = 0xC3;
+                               *tptr++ = su[i];
+                               fptr++;
+                       } else
+                               *tptr++ = '~';
+               }
+               else
                        CopyUTF8Char(&tptr, &fptr);
        }
        *tptr = 0;