From 7210e8144d8ee5c6d9e9d832da18f2539ceb43f6 Mon Sep 17 00:00:00 2001 From: GetAway Date: Sat, 10 Mar 2018 21:18:20 +0100 Subject: [PATCH] input: add RC Support for more Hardware - fix CONFIGDIR - fix FONTDIR - bump version 2.13 please build with -DHAVE_ARM_HARDWARE -DHAVE_COOL_HARDWARE --- input.c | 22 ++++++++++++++++------ input.h | 11 +++++++---- io.c | 3 +++ io.h | 2 -- rc_device.h | 21 +++++++++++++++++++++ 5 files changed, 47 insertions(+), 12 deletions(-) create mode 100644 rc_device.h diff --git a/input.c b/input.c index a0cf315..709b057 100644 --- a/input.c +++ b/input.c @@ -10,14 +10,22 @@ #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__ " "); diff --git a/input.h b/input.h index 188c367..e576f36 100644 --- a/input.h +++ b/input.h @@ -22,6 +22,13 @@ #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 6614899..22c058a 100644 --- 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__ " "); diff --git a/io.h b/io.h index 2cb93f8..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 + -- 2.39.5