Adapt neutrino-mp for CST hardware part #3

- Adapt and extend hw_caps for cst hardware


Origin commit data
------------------
Commit: fe9a2c19e4
Author: Michael Liebmann <tuxcode.bbg@gmail.com>
Date: 2016-01-15 (Fri, 15 Jan 2016)
This commit is contained in:
Michael Liebmann
2016-01-15 16:19:57 +01:00
parent 1668e85cfd
commit 48e4e8cba8
10 changed files with 309 additions and 23 deletions

View File

@@ -2,7 +2,15 @@ noinst_LIBRARIES = libhwcaps.a
AM_CXXFLAGS = -fno-rtti -fno-exceptions -fno-strict-aliasing
AM_CPPFLAGS = -I$(top_srcdir)/lib/libcoolstream
AM_CPPFLAGS = \
-I$(top_builddir) \
-I$(top_srcdir)/src \
-I$(top_srcdir)/src/zapit/include \
-I$(top_srcdir)/lib \
-I$(top_srcdir)/lib/libeventserver \
-I$(top_srcdir)/lib/libconfigfile \
-I$(top_srcdir)/lib/libcoolstream \
@HWLIB_CFLAGS@
libhwcaps_a_SOURCES = \
hardware_caps.cpp

View File

@@ -3,34 +3,77 @@
* part of libstb-hal
*
* (C) 2010-2012 Stefan Seyfried
* (C) 2016 M. Liebmann
*
* License: GPL v2 or later
*/
#include <global.h>
#include <zapit/femanager.h>
#include "hardware_caps.h"
static int initialized = 0;
static bool frontend_check = false;
static hw_caps_t caps;
hw_caps_t *get_hwcaps(void) {
if (initialized)
hw_caps_t *get_hwcaps(void)
{
if (initialized && frontend_check)
return &caps;
caps.has_fan = (cs_get_revision() < 8);
unsigned int system_rev = cs_get_revision();
CFEManager* fem = CFEManager::getInstance();
int frontendCount = fem->getFrontendCount();
frontend_check = frontendCount > 0;
caps.has_fan = (system_rev < 8);
caps.has_HDMI = 1;
caps.has_SCART = (cs_get_revision() != 10);
caps.has_SCART = (system_rev != 10);
caps.has_SCART_input = 0;
caps.has_YUV_cinch = 1;
caps.can_shutdown = (cs_get_revision() > 7);
caps.can_shutdown = (system_rev > 7);
caps.can_cec = 1;
caps.display_type = HW_DISPLAY_LINE_TEXT;
caps.display_type = (system_rev != 10) ? HW_DISPLAY_LINE_TEXT : HW_DISPLAY_NONE;
caps.display_xres = 12;
caps.display_yres = 0;
caps.can_set_display_brightness = 1;
strcpy(caps.boxvendor, "Coolstream");
if (cs_get_revision() < 8)
strcpy(caps.boxname, "HD1");
else if (cs_get_revision() == 10)
strcpy(caps.boxname, "ZEE");
else
strcpy(caps.boxname, "NEO");
strcpy(caps.boxvendor, "CST");
const char* boxname;
switch (system_rev) {
case 6:
boxname = "HD1";
break;
case 7:
boxname = "BSE";
break;
case 8:
boxname = "Neo";
break;
case 10:
boxname = "Zee";
break;
default:
char buffer[512];
snprintf(buffer, sizeof(buffer)-1, "Unknown nr. %u\n", system_rev);
boxname = buffer;
break;
}
strcpy(caps.boxname, boxname);
CFrontend *frontend = fem->getFE(0);
uint32_t mask = frontend->getSupportedDeliverySystems();
std::string tuner = "";
if (frontendCount > 1)
tuner += "Twin ";
tuner += ((mask & DVB_C) == DVB_C) ? g_Locale->getText(LOCALE_SATSETUP_FE_DELSYS_MODE_CABLE) : "Sat";
strcpy(caps.frontend, tuner.c_str());
strcpy(caps.chipset, "Nevis");
initialized = 1;
return &caps;
}

View File

@@ -3,6 +3,7 @@
* part of libstb-hal
*
* (C) 2010-2012 Stefan Seyfried
* (C) 2016 M. Liebmann
*
* License: GPL v2 or later
*/
@@ -11,9 +12,9 @@
#include "cs_api.h"
#include <string.h>
#include <string>
typedef enum
{
typedef enum {
HW_DISPLAY_NONE,
HW_DISPLAY_LED_NUM, /* simple 7 segment LED display */
HW_DISPLAY_LINE_TEXT, /* 1 line text display */
@@ -21,8 +22,7 @@ typedef enum
} display_type_t;
typedef struct hw_caps
{
typedef struct hw_caps {
int has_fan;
int has_HDMI;
int has_SCART;
@@ -36,7 +36,10 @@ typedef struct hw_caps
int can_set_display_brightness;
char boxvendor[64];
char boxname[64];
char chipset[64];
char frontend[64];
} hw_caps_t;
std::string getTuner();
hw_caps_t *get_hwcaps(void);
#endif