neutrino: start to use hardware_caps

Use hardware_caps instead of cs_get_revision() and #ifdef HAVE_FOO_HW
to distinguish between different boxtypes.
This commit is contained in:
Stefan Seyfried
2012-09-23 21:32:40 +02:00
parent 1a62480581
commit 04ee2e87f3
5 changed files with 104 additions and 44 deletions

View File

@@ -38,7 +38,6 @@
#include <global.h>
#include <neutrino.h>
#include <mymenu.h>
#include <cs_api.h>
#include <gui/widget/icons.h>
#include <gui/widget/stringinput.h>
@@ -128,7 +127,6 @@ const CMenuOptionChooser::keyval AUDIOMENU_HDMI_DD_OPTIONS[AUDIOMENU_HDMI_DD_OPT
/* audio settings menu */
int CAudioSetup::showAudioSetup()
{
unsigned int system_rev = cs_get_revision();
//menue init
CMenuWidget* audioSettings = new CMenuWidget(LOCALE_MAINSETTINGS_HEAD, NEUTRINO_ICON_SETTINGS, width);
audioSettings->setSelected(selected);
@@ -142,11 +140,7 @@ int CAudioSetup::showAudioSetup()
//dd via hdmi
CMenuOptionChooser *as_oj_dd_hdmi = NULL;
/* system_rev == 0x01 is a hack: no Coolstream box has this value, but libtriple
defines it for the Tripledragon, so 0x01 identifies the TD. */
#ifndef HAVE_SPARK_HARDWARE
if (system_rev != 0x01)
#endif
if (g_info.hw_caps->has_HDMI)
as_oj_dd_hdmi = new CMenuOptionChooser(LOCALE_AUDIOMENU_HDMI_DD, &g_settings.hdmi_dd, AUDIOMENU_HDMI_DD_OPTIONS, AUDIOMENU_HDMI_DD_OPTION_COUNT, true, audioSetupNotifier);
//dd via spdif
@@ -161,6 +155,8 @@ int CAudioSetup::showAudioSetup()
//clock rec
// CMenuOptionChooser * as_oj_clockrec new CMenuOptionChooser(LOCALE_AUDIOMENU_CLOCKREC, &g_settings.clockrec, AUDIOMENU_CLOCKREC_OPTIONS, AUDIOMENU_CLOCKREC_OPTION_COUNT, true, audioSetupNotifier);
#if HAVE_COOL_HARDWARE
/* only coolstream has SRS stuff, so only compile it there */
//SRS
//SRS algo
CMenuOptionChooser * as_oj_algo = new CMenuOptionChooser(LOCALE_AUDIO_SRS_ALGO, &g_settings.srs_algo, AUDIOMENU_SRS_OPTIONS, AUDIOMENU_SRS_OPTION_COUNT, g_settings.srs_enable, audioSetupNotifier);
@@ -174,6 +170,7 @@ int CAudioSetup::showAudioSetup()
//SRS on/off
CTruVolumeNotifier truevolSetupNotifier(as_oj_algo, as_oj_noise, as_oj_volrev);
CMenuOptionChooser * as_oj_srsonoff = new CMenuOptionChooser(LOCALE_AUDIO_SRS_IQ, &g_settings.srs_enable, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, &truevolSetupNotifier);
#endif
#if 0
CStringInput * audio_PCMOffset = new CStringInput(LOCALE_AUDIOMENU_PCMOFFSET, g_settings.audio_PCMOffset, 2, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "0123456789 ", audioSetupNotifier);
@@ -186,9 +183,7 @@ int CAudioSetup::showAudioSetup()
audioSettings->addItem(as_oj_analogmode);
audioSettings->addItem(GenericMenuSeparatorLine);
//---------------------------------------------------------
#ifndef HAVE_SPARK_HARDWARE
if (system_rev != 0x01)
#endif
if (g_info.hw_caps->has_HDMI)
audioSettings->addItem(as_oj_dd_hdmi);
audioSettings->addItem(as_oj_dd_spdif);
audioSettings->addItem(as_oj_ddsubchn);
@@ -198,19 +193,14 @@ int CAudioSetup::showAudioSetup()
audioSettings->addItem(as_oj_vsteps);
// audioSettings->addItem(as_clockrec);
//---------------------------------------------------------
if (system_rev != 0x01) {
audioSettings->addItem(GenericMenuSeparatorLine);
audioSettings->addItem(as_oj_srsonoff);
audioSettings->addItem(as_oj_algo);
audioSettings->addItem(as_oj_noise);
audioSettings->addItem(as_oj_volrev);
} else {
/* if it's not added, we need to delete it manually */
delete as_oj_srsonoff;
delete as_oj_algo;
delete as_oj_noise;
delete as_oj_volrev;
}
#if HAVE_COOL_HARDWARE
/* only coolstream has SRS stuff, so only compile it there */
audioSettings->addItem(GenericMenuSeparatorLine);
audioSettings->addItem(as_oj_srsonoff);
audioSettings->addItem(as_oj_algo);
audioSettings->addItem(as_oj_noise);
audioSettings->addItem(as_oj_volrev);
#endif
#if 0
audioSettings->addItem(mf);
#endif

View File

@@ -50,8 +50,6 @@
#include <system/debug.h>
#include <cs_api.h>
//#define ONE_KEY_PLUGIN
extern CPlugins * g_PluginList;
@@ -172,9 +170,7 @@ int CMiscMenue::showMiscSettingsMenu()
misc_menue.addItem(new CMenuForwarder(LOCALE_MISCSETTINGS_GENERAL, true, NULL, &misc_menue_general, NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED));
//energy, shutdown
#if !defined(HAVE_SPARK_HARDWARE) && !defined(HAVE_AZBOX_HARDWARE)
if(cs_get_revision() > 7)
#endif
if (g_info.hw_caps->can_shutdown)
{
CMenuWidget *misc_menue_energy = new CMenuWidget(LOCALE_MISCSETTINGS_HEAD, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_MISCSETUP_ENERGY);
showMiscSettingsMenuEnergy(misc_menue_energy);
@@ -194,14 +190,16 @@ int CMiscMenue::showMiscSettingsMenu()
misc_menue.addItem(GenericMenuSeparatorLine);
//cec settings
#if !HAVE_TRIPLEDRAGON
CCECSetup cecsetup;
misc_menue.addItem(new CMenuForwarder(LOCALE_VIDEOMENU_HDMI_CEC, true, NULL, &cecsetup, NULL, CRCInput::RC_1));
#else
CSleepTimerWidget sleeptimer;
misc_menue->addItem(new CMenuForwarder(LOCALE_MISCSETTINGS_SLEEPTIMER, true, g_settings.shutdown_min, &sleeptimer, "permanent", CRCInput::RC_1));
#endif
if (g_info.hw_caps->can_cec) {
CCECSetup cecsetup;
misc_menue.addItem(new CMenuForwarder(LOCALE_VIDEOMENU_HDMI_CEC, true, NULL, &cecsetup, NULL, CRCInput::RC_1));
}
if (!g_info.hw_caps->can_shutdown) {
/* we don't have the energy menu, but put the sleeptimer directly here */
CSleepTimerWidget sleeptimer;
misc_menue.addItem(new CMenuForwarder(LOCALE_MISCSETTINGS_SLEEPTIMER, true, g_settings.shutdown_min, &sleeptimer, "permanent", CRCInput::RC_1));
}
//channellist
CMenuWidget misc_menue_chanlist(LOCALE_MISCSETTINGS_HEAD, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_MISCSETUP_CHANNELLIST);
showMiscSettingsMenuChanlist(&misc_menue_chanlist);

View File

@@ -220,12 +220,10 @@ static void initGlobals(void)
g_Radiotext = NULL;
g_volume = NULL;
#if HAVE_SPARK_HARDWARE || HAVE_AZBOX_HARDWARE
/* spark has revision == 1 like tripledragon for now */
can_deepstandby = true;
#else
can_deepstandby = (cs_get_revision() > 7);
#endif
g_info.hw_caps = get_hwcaps();
can_deepstandby = g_info.hw_caps->can_shutdown;
g_info.has_fan = g_info.hw_caps->has_fan;
}
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@@ -1866,9 +1864,7 @@ fprintf(stderr, "[neutrino start] %d -> %5ld ms\n", __LINE__, time_monotonic_ms
cpuFreq = new cCpuFreqManager();
cpuFreq->SetCpuFreq(g_settings.cpufreq * 1000 * 1000);
g_info.delivery_system = CFEManager::getInstance()->getLiveFE()->getInfo()->type == FE_QPSK ? DVB_S : DVB_C;
#if !HAVE_COOL_HARDWARE
g_info.has_fan = 0;
#else
#if HAVE_COOL_HARDWARE
/* only SAT-hd1 before rev 8 has fan */
g_info.has_fan = (cs_get_revision() < 8 && g_info.delivery_system == DVB_S);
#endif

View File

@@ -40,6 +40,8 @@
#include <zapit/client/zapitclient.h>
#include <zapit/client/zapittools.h>
#include <hardware_caps.h>
#include <string>
#if HAVE_COOL_HARDWARE
@@ -662,6 +664,7 @@ struct SglobalInfo
unsigned char box_Type;
delivery_system_t delivery_system;
bool has_fan;
hw_caps_t *hw_caps;
};
const int RECORDING_OFF = 0;