From: GetAway Date: Sat, 10 Mar 2018 19:15:55 +0000 (+0100) Subject: shellexec: add RC Support for more Hardware X-Git-Url: https://git.webhop.me/?a=commitdiff_plain;h=bc70c3d1b41ba94caf8c7cfdc8e5f1d3c325491d;p=shellexec.git shellexec: add RC Support for more Hardware - fix CONFIGDIR - fix FONTDIR - bump version 2.15 please build with -DHAVE_ARM_HARDWARE -DHAVE_COOL_HARDWARE --- diff --git a/io.c b/io.c index 0b74a78..b0c8cca 100644 --- 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__ " "); diff --git a/io.h b/io.h index 27782bd..bb0af03 100644 --- 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 index 0000000..bad11e3 --- /dev/null +++ b/rc_device.h @@ -0,0 +1,21 @@ +#ifdef HAVE_CONFIG_H +#include +#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 + diff --git a/shellexec.c b/shellexec.c index 237f02c..c376dcd 100644 --- a/shellexec.c +++ b/shellexec.c @@ -11,14 +11,22 @@ #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__ " "); @@ -1779,7 +1789,7 @@ int main (int argc, char **argv) } else desc.face_id = FONT; - printf("%s \n", __plugin__, desc.face_id); + printf("%s \n", __plugin__, (char*)desc.face_id); use_kerning = FT_HAS_KERNING(face); desc.flags = FT_LOAD_RENDER | FT_LOAD_FORCE_AUTOHINT; diff --git a/shellexec.h b/shellexec.h index 9e0ef48..40725bc 100644 --- a/shellexec.h +++ b/shellexec.h @@ -23,7 +23,13 @@ #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 5df9d67..407ea00 100644 --- 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;