port hardware_caps from Neutrino-MP

Origin commit data
------------------
Commit: 29fd05002f
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-03-06 (Mon, 06 Mar 2017)

Origin message was:
------------------
- port hardware_caps from Neutrino-MP
This commit is contained in:
vanhofen
2017-03-06 21:49:32 +01:00
parent 4f6d09bc1f
commit 459cf4d8ea
8 changed files with 141 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
noinst_LIBRARIES = libhwcaps.a
AM_CXXFLAGS = -fno-rtti -fno-exceptions -fno-strict-aliasing
if BOXMODEL_CS_HD2
AM_CPPFLAGS = -I$(top_srcdir)/lib/libcoolstream2
else
AM_CPPFLAGS = -I$(top_srcdir)/lib/libcoolstream
endif
libhwcaps_a_SOURCES = \
hardware_caps.cpp

View File

@@ -0,0 +1,72 @@
/*
* determine the capabilities of the hardware.
* part of libstb-hal
*
* (C) 2010-2012,2016 Stefan Seyfried
*
* License: GPL v2 or later
*/
#include "cs_api.h"
#include <stdio.h>
#include <string.h>
#include "hardware_caps.h"
static int initialized = 0;
static hw_caps_t caps;
hw_caps_t *get_hwcaps(void) {
if (initialized)
return &caps;
int rev = cs_get_revision();
caps.has_fan = (rev < 8);
caps.has_HDMI = 1;
caps.has_SCART = (rev != 10);
caps.has_SCART_input = 0;
caps.has_YUV_cinch = 1;
caps.can_shutdown = (rev > 7);
caps.can_cec = 1;
caps.display_type = HW_DISPLAY_LINE_TEXT;
caps.display_xres = 12;
caps.display_yres = 0;
caps.can_set_display_brightness = 1;
caps.can_ar_14_9 = 1;
caps.can_ps_14_9 = 1;
caps.force_tuner_2G = 0;
strcpy(caps.boxvendor, "Coolstream");
/* list of boxnames from neutrinoyparser.cpp */
strcpy(caps.boxarch, "Nevis");
switch (rev) {
case 6:
case 7: // Black Stallion Edition
strcpy(caps.boxname, "HD1");
caps.force_tuner_2G = 1;
break;
case 8:
strcpy(caps.boxname, "Neo");
caps.force_tuner_2G = 1;
break;
case 9:
strcpy(caps.boxname, "Tank");
strcpy(caps.boxarch, "Apollo");
break;
case 10:
strcpy(caps.boxname, "Zee");
caps.force_tuner_2G = 1;
break;
case 11:
strcpy(caps.boxname, "Trinity");
strcpy(caps.boxarch, "Shiner");
break;
case 12:
strcpy(caps.boxname, "Zee2");
strcpy(caps.boxarch, "Kronos");
break;
default:
strcpy(caps.boxname, "UNKNOWN_BOX");
strcpy(caps.boxarch, "Unknown");
fprintf(stderr, "[%s] unhandled box revision %d\n", __func__, rev);
}
initialized = 1;
return &caps;
}

View File

@@ -0,0 +1,43 @@
/*
* determine the capabilities of the hardware.
* part of libstb-hal
*
* (C) 2010-2012,2016 Stefan Seyfried
*
* License: GPL v2 or later
*/
#ifndef __HARDWARE_CAPS_H__
#define __HARDWARE_CAPS_H__
typedef enum
{
HW_DISPLAY_NONE,
HW_DISPLAY_LED_NUM, /* simple 7 segment LED display */
HW_DISPLAY_LINE_TEXT, /* 1 line text display */
HW_DISPLAY_GFX
} display_type_t;
typedef struct hw_caps
{
int has_fan;
int has_HDMI;
int has_SCART;
int has_SCART_input;
int has_YUV_cinch;
int can_shutdown;
int can_cec;
int can_ar_14_9; /* video drivers have 14:9 aspect ratio mode */
int can_ps_14_9; /* video drivers have 14:9 panscan mode */
int force_tuner_2G; /* force DVB-S2 even though driver may not advertise it */
display_type_t display_type;
int display_xres; /* x resolution or chars per line */
int display_yres;
int can_set_display_brightness;
char boxvendor[64];
char boxname[64];
char boxarch[64];
} hw_caps_t;
hw_caps_t *get_hwcaps(void);
#endif