From c225c2d4b68ce24e25206ed668a9f2f8c2fc6984 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Sun, 19 Mar 2017 01:04:48 +0100 Subject: [PATCH 01/12] - hardware_caps: fix has_fan and add detection of Neo Twin --- lib/hardware/coolstream/Makefile.am | 7 +++++++ lib/hardware/coolstream/hardware_caps.cpp | 19 +++++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/lib/hardware/coolstream/Makefile.am b/lib/hardware/coolstream/Makefile.am index b2a96b31e..82f3ab83c 100644 --- a/lib/hardware/coolstream/Makefile.am +++ b/lib/hardware/coolstream/Makefile.am @@ -1,6 +1,13 @@ AM_CXXFLAGS = -fno-rtti -fno-exceptions -fno-strict-aliasing AM_CPPFLAGS = \ + -I$(top_builddir) \ + -I$(top_srcdir) \ + -I$(top_srcdir)/src \ + -I$(top_srcdir)/src/zapit/include \ + -I$(top_srcdir)/lib \ + -I$(top_srcdir)/lib/libconfigfile \ + -I$(top_srcdir)/lib/libeventserver \ @HWLIB_CFLAGS@ noinst_LIBRARIES = libhwcaps.a diff --git a/lib/hardware/coolstream/hardware_caps.cpp b/lib/hardware/coolstream/hardware_caps.cpp index 592202285..b4d4c0a46 100644 --- a/lib/hardware/coolstream/hardware_caps.cpp +++ b/lib/hardware/coolstream/hardware_caps.cpp @@ -11,6 +11,8 @@ #include #include "hardware_caps.h" +#include + static int initialized = 0; static hw_caps_t caps; @@ -19,7 +21,7 @@ hw_caps_t *get_hwcaps(void) { return ∩︀ int rev = cs_get_revision(); int chip = cs_get_chip_type(); - caps.has_fan = (rev < 8); + caps.has_fan = (rev < 8 && CFEManager::getInstance()->getFE(0)->hasSat()); // only SAT-HD1 before rev 8 has fan caps.has_HDMI = 1; caps.has_SCART = (rev != 10); caps.has_SCART_input = 0; @@ -34,15 +36,23 @@ hw_caps_t *get_hwcaps(void) { caps.can_ps_14_9 = 1; caps.force_tuner_2G = 0; strcpy(caps.boxvendor, "Coolstream"); - strcpy(caps.boxarch, "Nevis"); switch (rev) { case 6: case 7: // Black Stallion Edition strcpy(caps.boxname, "HD1"); + strcpy(caps.boxarch, "Nevis"); caps.force_tuner_2G = 1; break; - case 8: // TODO: Neo2 - Twin - strcpy(caps.boxname, "Neo"); + case 8: + if (CFEManager::getInstance()->getFrontendCount() < 2) + { + strcpy(caps.boxname, "Neo"); + } + else + { + strcpy(caps.boxname, "Neo Twin"); + } + strcpy(caps.boxarch, "Nevis"); caps.force_tuner_2G = 1; break; case 9: @@ -51,6 +61,7 @@ hw_caps_t *get_hwcaps(void) { break; case 10: strcpy(caps.boxname, "Zee"); + strcpy(caps.boxarch, "Nevis"); caps.force_tuner_2G = 1; break; case 11: From 9e5c30f7547c212a9278ac5251e8e1f39f631976 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Sun, 19 Mar 2017 01:04:48 +0100 Subject: [PATCH 02/12] - controlapi: use "CST" instead of "Coolstream" ... because I don't know the current legal situation. --- src/nhttpd/tuxboxapi/controlapi.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/nhttpd/tuxboxapi/controlapi.cpp b/src/nhttpd/tuxboxapi/controlapi.cpp index bb5eb829b..38e47231d 100644 --- a/src/nhttpd/tuxboxapi/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/controlapi.cpp @@ -810,7 +810,15 @@ void CControlAPI::HWInfoCGI(CyhookHandler *hh) std::string eth_id = netadapter.getMacAddr(); std::transform(eth_id.begin(), eth_id.end(), eth_id.begin(), ::tolower); - hh->printf("%s %s (%s)\nMAC:%s\n", g_info.hw_caps->boxvendor, g_info.hw_caps->boxname, g_info.hw_caps->boxarch, eth_id.c_str()); + std::string boxvendor(g_info.hw_caps->boxvendor); + /* + I don't know the current legal situation. + So better let's change the vendor's name to CST. + */ + if (boxvendor.compare("Coolstream") == 0) + boxvendor = "CST"; + + hh->printf("%s %s (%s)\nMAC:%s\n", boxvendor.c_str(), g_info.hw_caps->boxname, g_info.hw_caps->boxarch, eth_id.c_str()); } //----------------------------------------------------------------------------- void CControlAPI::ShutdownCGI(CyhookHandler *hh) From 59adc884918471b60edbaec0e2978c898106052e Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Sun, 19 Mar 2017 01:04:48 +0100 Subject: [PATCH 03/12] - neutrinoyparser: remove workaround for Neo Twin --- src/nhttpd/tuxboxapi/neutrinoyparser.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/nhttpd/tuxboxapi/neutrinoyparser.cpp b/src/nhttpd/tuxboxapi/neutrinoyparser.cpp index f7ab07684..04dd13a4f 100644 --- a/src/nhttpd/tuxboxapi/neutrinoyparser.cpp +++ b/src/nhttpd/tuxboxapi/neutrinoyparser.cpp @@ -839,14 +839,16 @@ std::string CNeutrinoYParser::func_get_partition_list(CyhookHandler *, std::str std::string CNeutrinoYParser::func_get_boxtype(CyhookHandler *, std::string) { std::string boxvendor(g_info.hw_caps->boxvendor); - /* stay compatible with present code in Y_Blocks.txt */ + /* + I don't know the current legal situation. + So better let's change the vendor's name to CST. + + After change this, you'll have to align code in Y_Blocks.txt + */ if (boxvendor.compare("Coolstream") == 0) boxvendor = "CST"; std::string boxname(g_info.hw_caps->boxname); - /* workaround for Neo2 */ - if ((boxname.compare("Neo") == 0) && (CFEManager::getInstance()->getFrontendCount() > 1)) - boxname += " Twin"; return boxvendor + " " + boxname; } From 4f202b19d6009da0fc1e3f674827b0bc252d0b60 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Sun, 19 Mar 2017 01:04:48 +0100 Subject: [PATCH 04/12] - use g_info.hw_caps->has_fan; remove old g_info.has_fan --- src/gui/miscsettings_menu.cpp | 2 +- src/neutrino.cpp | 14 +++++--------- src/system/settings.h | 1 - 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/gui/miscsettings_menu.cpp b/src/gui/miscsettings_menu.cpp index af84c0213..f9e3d86c3 100644 --- a/src/gui/miscsettings_menu.cpp +++ b/src/gui/miscsettings_menu.cpp @@ -326,7 +326,7 @@ void CMiscMenue::showMiscSettingsMenuGeneral(CMenuWidget *ms_general) ms_general->addItem(mc); //fan speed - if (g_info.has_fan) + if (g_info.hw_caps->has_fan) { CMenuOptionNumberChooser * mn = new CMenuOptionNumberChooser(LOCALE_FAN_SPEED, &g_settings.fan_speed, true, 1, 14, fanNotifier, CRCInput::RC_nokey, NULL, 0, 0, LOCALE_OPTIONS_OFF); mn->setHint("", LOCALE_MENU_HINT_FAN_SPEED); diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 598beedd1..1c9bfeadd 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -2153,13 +2153,9 @@ TIMER_START(); cpuFreq = new cCpuFreqManager(); cpuFreq->SetCpuFreq(g_settings.cpufreq * 1000 * 1000); -#if HAVE_COOL_HARDWARE - /* only SAT-hd1 before rev 8 has fan */ - g_info.has_fan = (cs_get_revision() < 8 && CFEManager::getInstance()->getFE(0)->hasSat()); -#endif - dprintf(DEBUG_NORMAL, "g_info.has_fan: %d\n", g_info.has_fan); + //fan speed - if (g_info.has_fan) + if (g_info.hw_caps->has_fan) CFanControlNotifier::setSpeed(g_settings.fan_speed); dvbsub_init(); @@ -3661,7 +3657,7 @@ void CNeutrinoApp::ExitRun(const bool /*write_si*/, int retcode) delete g_RCInput; my_system("/etc/init.d/rcK"); //fan speed - if (g_info.has_fan) { + if (g_info.hw_caps->has_fan) { CFanControlNotifier::setSpeed(0); } //CVFD::getInstance()->ShowText(g_Locale->getText(LOCALE_MAINMENU_REBOOT)); @@ -3869,7 +3865,7 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby ) cpuFreq->SetCpuFreq(g_settings.standby_cpufreq * 1000 * 1000); //fan speed - if (g_info.has_fan) + if (g_info.hw_caps->has_fan) CFanControlNotifier::setSpeed(1); frameBuffer->setActive(false); @@ -3898,7 +3894,7 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby ) } frameBuffer->setActive(true); //fan speed - if (g_info.has_fan) + if (g_info.hw_caps->has_fan) CFanControlNotifier::setSpeed(g_settings.fan_speed); puts("[neutrino.cpp] executing " NEUTRINO_LEAVE_STANDBY_SCRIPT "."); diff --git a/src/system/settings.h b/src/system/settings.h index c8aef6895..6e9578c11 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -927,7 +927,6 @@ struct SglobalInfo { unsigned char box_Type; delivery_system_t delivery_system; - bool has_fan; hw_caps_t *hw_caps; }; From 233886df8df2956da51d122199be8941dc6558e0 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Sun, 19 Mar 2017 01:04:48 +0100 Subject: [PATCH 05/12] - remove unused g_info.box_Type --- src/driver/lcdd.cpp | 2 ++ src/system/settings.h | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/driver/lcdd.cpp b/src/driver/lcdd.cpp index 3ff7e111c..183988a90 100644 --- a/src/driver/lcdd.cpp +++ b/src/driver/lcdd.cpp @@ -341,6 +341,7 @@ void CLCD::setlcdparameter(int dimm, const int contrast, const int power, const perror("[lcdd] set invert failed!"); } +#if 0 if (g_info.box_Type == CControld::TUXBOX_MAKER_PHILIPS) { if (ioctl(fd, LCD_IOCTL_BIAS, &bias) < 0) @@ -348,6 +349,7 @@ void CLCD::setlcdparameter(int dimm, const int contrast, const int power, const perror("[lcdd] set bias failed!"); } } +#endif close(fd); } #endif diff --git a/src/system/settings.h b/src/system/settings.h index 6e9578c11..2b5f6831f 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -925,7 +925,6 @@ const time_settings_struct_t timing_setting[SNeutrinoSettings::TIMING_SETTING_CO struct SglobalInfo { - unsigned char box_Type; delivery_system_t delivery_system; hw_caps_t *hw_caps; }; From 720269c99ab7411dc15f0cd4d017dc91174c06c0 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Sun, 19 Mar 2017 01:04:48 +0100 Subject: [PATCH 06/12] - remove unused g_info.delivery_system --- src/system/settings.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/system/settings.h b/src/system/settings.h index 2b5f6831f..6b81674f6 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -925,7 +925,6 @@ const time_settings_struct_t timing_setting[SNeutrinoSettings::TIMING_SETTING_CO struct SglobalInfo { - delivery_system_t delivery_system; hw_caps_t *hw_caps; }; From 9801c3100c6a7242fce1f7eba3ab55056b553aa2 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 19 Mar 2017 15:58:31 +0100 Subject: [PATCH 07/12] CColorChooser: fix missing rewrite current values to *value[selected] Supplement to commit: CColorChooser: fix compile conversion warnings 3b5cd00bf4af7ef65fad1490c346b249d5ce2365 --- src/gui/widget/colorchooser.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/widget/colorchooser.cpp b/src/gui/widget/colorchooser.cpp index 589f49fe7..5eef2d02e 100644 --- a/src/gui/widget/colorchooser.cpp +++ b/src/gui/widget/colorchooser.cpp @@ -197,6 +197,7 @@ int CColorChooser::exec(CMenuTarget* parent, const std::string &) val += 2; else val = 100; + (*value[selected]) = (uint8_t)val; paintSlider(x + 10, y + hheight + mheight * selected, value[selected], colorchooser_names[selected], iconnames[selected], true); setColor(); @@ -211,6 +212,7 @@ int CColorChooser::exec(CMenuTarget* parent, const std::string &) val -= 2; else val = 0; + (*value[selected]) = (uint8_t)val; paintSlider(x + 10, y + hheight + mheight * selected, value[selected], colorchooser_names[selected], iconnames[selected], true); setColor(); From 96e05c69dcf521a334dcc59f048647f54c651b41 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 19 Mar 2017 22:15:36 +0100 Subject: [PATCH 08/12] CNeutrinoFonts: reduce debug spam In some cases with many following dynamic size changes, it could be better to suppress this output. --- src/driver/neutrinofonts.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/driver/neutrinofonts.cpp b/src/driver/neutrinofonts.cpp index 80b40377e..8c200a301 100644 --- a/src/driver/neutrinofonts.cpp +++ b/src/driver/neutrinofonts.cpp @@ -269,10 +269,12 @@ int CNeutrinoFonts::getDynFontSize(int dx, int dy, std::string text, int style) if (text.empty()) tmpText = "x"; _width = dynFont->getRenderWidth(tmpText); if ((_height > dy) || (_width > dx)) { - if (dynFlag) + if (dynFlag){ dynSize--; - else - printf("##### [%s] Specified size (dx=%d, dy=%d) too small, use minimal font size.\n", __FUNCTION__, dx, dy); + }else{ + if (debug) + printf("##### [%s] Specified size (dx=%d, dy=%d) too small, use minimal font size.\n", __FUNCTION__, dx, dy); + } break; } else if ((_height < dy) || (_width < dx)) { From 3eb8f8bef8bb13dd9d6fcab539dda9e873d716df Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Sun, 19 Mar 2017 23:50:52 +0100 Subject: [PATCH 09/12] - move src/timerd/doku.html to doc/timerd.html --- src/timerd/doku.html => doc/timerd.html | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/timerd/doku.html => doc/timerd.html (100%) diff --git a/src/timerd/doku.html b/doc/timerd.html similarity index 100% rename from src/timerd/doku.html rename to doc/timerd.html From de1ee8b73af3daae56d3d782ac920215533e2f6f Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Sun, 19 Mar 2017 23:50:52 +0100 Subject: [PATCH 10/12] - use g_info.hw_caps->can_shutdown; mostly ported from neutrino-mp --- src/gui/miscsettings_menu.cpp | 3 +-- src/neutrino.cpp | 14 ++++++++------ src/neutrino_menue.cpp | 4 ++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/gui/miscsettings_menu.cpp b/src/gui/miscsettings_menu.cpp index f9e3d86c3..ba352cd63 100644 --- a/src/gui/miscsettings_menu.cpp +++ b/src/gui/miscsettings_menu.cpp @@ -55,7 +55,6 @@ #include #include -#include #include #include @@ -245,7 +244,7 @@ int CMiscMenue::showMiscSettingsMenu() misc_menue.addItem(mf); //energy, shutdown - if(cs_get_revision() > 7) + if(g_info.hw_caps->can_shutdown) { mf = new CMenuForwarder(LOCALE_MISCSETTINGS_ENERGY, true, NULL, this, "energy", CRCInput::RC_green); mf->setHint("", LOCALE_MENU_HINT_MISC_ENERGY); diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 1c9bfeadd..5a29b0baa 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -456,12 +456,14 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.hdd_noise = configfile.getInt32( "hdd_noise", 254); g_settings.hdd_statfs_mode = configfile.getInt32( "hdd_statfs_mode", SNeutrinoSettings::HDD_STATFS_RECORDING); - g_settings.shutdown_real = configfile.getBool("shutdown_real" , false ); + g_settings.shutdown_real = false; + if (g_info.hw_caps->can_shutdown) + g_settings.shutdown_real = configfile.getBool("shutdown_real" , false ); g_settings.shutdown_real_rcdelay = configfile.getBool("shutdown_real_rcdelay", false ); g_settings.shutdown_count = configfile.getInt32("shutdown_count", 0); g_settings.shutdown_min = 0; - if(cs_get_revision() > 7) + if (g_info.hw_caps->can_shutdown) g_settings.shutdown_min = configfile.getInt32("shutdown_min", 180); g_settings.sleeptimer_min = configfile.getInt32("sleeptimer_min", 0); @@ -2268,7 +2270,7 @@ TIMER_STOP("################################## after all ####################### } RealRun(); - ExitRun(true, (cs_get_revision() > 7)); + ExitRun(true, g_info.hw_caps->can_shutdown); return 0; } @@ -3321,7 +3323,7 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) return messages_return::handled; } } - if(g_settings.shutdown_real) + if (g_settings.shutdown_real) g_RCInput->postMsg(NeutrinoMessages::SHUTDOWN, 0); else g_RCInput->postMsg(NeutrinoMessages::STANDBY_ON, 0); @@ -3366,7 +3368,7 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) } else if( msg == NeutrinoMessages::SHUTDOWN ) { if(!skipShutdownTimer) { - ExitRun(true, (cs_get_revision() > 7)); + ExitRun(true, g_info.hw_caps->can_shutdown); } else { skipShutdownTimer=false; @@ -3541,6 +3543,7 @@ extern bool timer_is_rec;//timermanager.cpp void CNeutrinoApp::ExitRun(const bool /*write_si*/, int retcode) { + printf("[neutrino] %s retcode: %d can_shutdown: %d\n", __func__, retcode, g_info.hw_caps->can_shutdown); bool do_shutdown = true; CRecordManager::getInstance()->StopAutoRecord(); @@ -3556,7 +3559,6 @@ void CNeutrinoApp::ExitRun(const bool /*write_si*/, int retcode) //SDTreloadChannels = false; } - dprintf(DEBUG_INFO, "exit\n"); StopSubtitles(); stopPlayBack(); diff --git a/src/neutrino_menue.cpp b/src/neutrino_menue.cpp index 7665c847f..82d7b8aaf 100644 --- a/src/neutrino_menue.cpp +++ b/src/neutrino_menue.cpp @@ -252,7 +252,7 @@ void CNeutrinoApp::InitMenuMain() personalize.addItem(MENU_MAIN, mf, &g_settings.personalize[SNeutrinoSettings::P_MAIN_REBOOT]); //shutdown - if(system_rev >= 8) { + if (g_info.hw_caps->can_shutdown) { mf = new CMenuForwarder(LOCALE_MAINMENU_SHUTDOWN, true, NULL, this, "shutdown", CRCInput::RC_standby); mf->setHint(NEUTRINO_ICON_HINT_SHUTDOWN, LOCALE_MENU_HINT_SHUTDOWN); personalize.addItem(MENU_MAIN, mf, &g_settings.personalize[SNeutrinoSettings::P_MAIN_SHUTDOWN]); @@ -298,7 +298,7 @@ void CNeutrinoApp::InitMenuMain() personalize.addItem(MENU_SHUTDOWN, mf, &g_settings.personalize[SNeutrinoSettings::P_MAIN_REBOOT]); //shutdown - if(system_rev >= 8) { + if (g_info.hw_caps->can_shutdown) { mf = new CMenuForwarder(LOCALE_MAINMENU_SHUTDOWN, true, NULL, this, "shutdown", CRCInput::RC_blue); mf->setHint(NEUTRINO_ICON_HINT_SHUTDOWN, LOCALE_MENU_HINT_SHUTDOWN); personalize.addItem(MENU_SHUTDOWN, mf, &g_settings.personalize[SNeutrinoSettings::P_MAIN_SHUTDOWN]); From ec6e863e6f34ddc8c6ac680d96be041acc559085 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Sun, 19 Mar 2017 23:50:52 +0100 Subject: [PATCH 11/12] - neutrino: remove unused write_si from ExitRun() function ... and rename retcode to can_shutdown for a better readability --- src/neutrino.cpp | 25 +++++++++++++------------ src/neutrino.h | 2 +- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 5a29b0baa..c26982b11 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -2270,7 +2270,7 @@ TIMER_STOP("################################## after all ####################### } RealRun(); - ExitRun(true, g_info.hw_caps->can_shutdown); + ExitRun(g_info.hw_caps->can_shutdown); return 0; } @@ -3368,7 +3368,7 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) } else if( msg == NeutrinoMessages::SHUTDOWN ) { if(!skipShutdownTimer) { - ExitRun(true, g_info.hw_caps->can_shutdown); + ExitRun(g_info.hw_caps->can_shutdown); } else { skipShutdownTimer=false; @@ -3378,7 +3378,7 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) else if( msg == NeutrinoMessages::REBOOT ) { FILE *f = fopen("/tmp/.reboot", "w"); fclose(f); - ExitRun(true); + ExitRun(); } else if (msg == NeutrinoMessages::EVT_POPUP || msg == NeutrinoMessages::EVT_EXTMSG) { if (mode != mode_scart && mode != mode_standby) { @@ -3541,9 +3541,10 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) extern time_t timer_minutes;//timermanager.cpp extern bool timer_is_rec;//timermanager.cpp -void CNeutrinoApp::ExitRun(const bool /*write_si*/, int retcode) +void CNeutrinoApp::ExitRun(int can_shutdown) { - printf("[neutrino] %s retcode: %d can_shutdown: %d\n", __func__, retcode, g_info.hw_caps->can_shutdown); + printf("[neutrino] %s can_shutdown: %d\n", __func__, g_info.hw_caps->can_shutdown); + bool do_shutdown = true; CRecordManager::getInstance()->StopAutoRecord(); @@ -3576,16 +3577,16 @@ void CNeutrinoApp::ExitRun(const bool /*write_si*/, int retcode) } /* on shutdown force load new fst */ - if (retcode) + if (can_shutdown) CheckFastScan(true, false); CVFD::getInstance()->setMode(CVFD::MODE_SHUTDOWN); - stop_daemons(true /*retcode*/);//need here for timer_is_rec before saveSetup + stop_daemons(true /*can_shutdown*/);//need here for timer_is_rec before saveSetup g_settings.shutdown_timer_record_type = timer_is_rec; saveSetup(NEUTRINO_SETTINGS_FILE); - if(retcode) { + if (can_shutdown) { puts("[neutrino.cpp] executing " NEUTRINO_ENTER_DEEPSTANDBY_SCRIPT "."); if (my_system(NEUTRINO_ENTER_DEEPSTANDBY_SCRIPT) != 0) perror(NEUTRINO_ENTER_DEEPSTANDBY_SCRIPT " failed"); @@ -3665,8 +3666,8 @@ void CNeutrinoApp::ExitRun(const bool /*write_si*/, int retcode) //CVFD::getInstance()->ShowText(g_Locale->getText(LOCALE_MAINMENU_REBOOT)); stop_video(); Cleanup(); - //_exit(retcode); - exit(retcode); + //_exit(can_shutdown); + exit(can_shutdown); } } } @@ -4029,13 +4030,13 @@ int CNeutrinoApp::exec(CMenuTarget* parent, const std::string & actionKey) ShowMsg(LOCALE_SETTINGS_HELP, LOCALE_RECORDINGMENU_HELP, CMsgBox::mbrBack, CMsgBox::mbBack); } else if(actionKey=="shutdown") { - ExitRun(true, 1); + ExitRun(1); } else if(actionKey=="reboot") { FILE *f = fopen("/tmp/.reboot", "w"); fclose(f); - ExitRun(true); + ExitRun(); unlink("/tmp/.reboot"); returnval = menu_return::RETURN_NONE; } diff --git a/src/neutrino.h b/src/neutrino.h index 1b15140ea..406a934b7 100644 --- a/src/neutrino.h +++ b/src/neutrino.h @@ -119,7 +119,7 @@ private: void standbyMode( bool bOnOff, bool fromDeepStandby = false ); void getAnnounceEpgName(CTimerd::RecordingInfo * eventinfo, std::string &name); - void ExitRun(const bool write_si = true, int retcode = 0); + void ExitRun(int can_shutdown = 0); void RealRun(); void InitZapper(); void InitTimerdClient(); From b8a97a97ca8c3d44eec89e57ae6276df42a9ae8d Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Sun, 19 Mar 2017 23:50:52 +0100 Subject: [PATCH 12/12] - neutrino: just code cosmetics in ExitRun() --- src/neutrino.cpp | 222 ++++++++++++++++++++++++----------------------- 1 file changed, 114 insertions(+), 108 deletions(-) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index c26982b11..1f1a7d92c 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -3543,133 +3543,139 @@ extern bool timer_is_rec;//timermanager.cpp void CNeutrinoApp::ExitRun(int can_shutdown) { - printf("[neutrino] %s can_shutdown: %d\n", __func__, g_info.hw_caps->can_shutdown); + printf("[neutrino] %s can_shutdown: %d\n", __func__, can_shutdown); bool do_shutdown = true; - CRecordManager::getInstance()->StopAutoRecord(); - if(CRecordManager::getInstance()->RecordingStatus() || cYTCache::getInstance()->isActive()) { + if(CRecordManager::getInstance()->RecordingStatus() || cYTCache::getInstance()->isActive()) + { do_shutdown = (ShowMsg(LOCALE_MESSAGEBOX_INFO, LOCALE_SHUTDOWN_RECORDING_QUERY, CMsgBox::mbrNo, CMsgBox::mbYes | CMsgBox::mbNo, NULL, 450, DEFAULT_TIMEOUT, true) == CMsgBox::mbrYes); } + if (!do_shutdown) + return; - if(do_shutdown) { - if(SDTreloadChannels){ - SDT_ReloadChannels(); - //SDTreloadChannels = false; + if (SDTreloadChannels) + SDT_ReloadChannels(); + + dprintf(DEBUG_INFO, "exit\n"); + StopSubtitles(); + stopPlayBack(); + + frameBuffer->paintBackground(); + frameBuffer->showFrame("shutdown.jpg"); + + delete cHddStat::getInstance(); + delete CRecordManager::getInstance(); + + CEpgScan::getInstance()->Stop(); + if(g_settings.epg_save /* && timeset && g_Sectionsd->getIsTimeSet ()*/) + { + g_Sectionsd->setPauseScanning(true); + saveEpg(true);// true CVFD::MODE_SHUTDOWN + } + + /* on shutdown force load new fst */ + if (can_shutdown) + CheckFastScan(true, false); + + CVFD::getInstance()->setMode(CVFD::MODE_SHUTDOWN); + + stop_daemons(true /*can_shutdown*/); //need here for timer_is_rec before saveSetup + g_settings.shutdown_timer_record_type = timer_is_rec; + saveSetup(NEUTRINO_SETTINGS_FILE); + + if (can_shutdown) + { + puts("[neutrino.cpp] executing " NEUTRINO_ENTER_DEEPSTANDBY_SCRIPT "."); + if (my_system(NEUTRINO_ENTER_DEEPSTANDBY_SCRIPT) != 0) + perror(NEUTRINO_ENTER_DEEPSTANDBY_SCRIPT " failed"); + + printf("entering off state\n"); + mode = mode_off; + //CVFD::getInstance()->ShowText(g_Locale->getText(LOCALE_MAINMENU_SHUTDOWN)); + + fp_standby_data_t standby; + time_t mtime = time(NULL); + struct tm *tmtime = localtime(&mtime); + time_t fp_timer = 0; + + if (timer_minutes) + { + fp_timer = timer_minutes - mtime/60; + if (fp_timer < 1) + fp_timer = 1; } - - dprintf(DEBUG_INFO, "exit\n"); - StopSubtitles(); - stopPlayBack(); - - frameBuffer->paintBackground(); - frameBuffer->showFrame("shutdown.jpg"); - - delete cHddStat::getInstance(); - delete CRecordManager::getInstance(); - - CEpgScan::getInstance()->Stop(); - if(g_settings.epg_save /* && timeset && g_Sectionsd->getIsTimeSet ()*/) { - g_Sectionsd->setPauseScanning(true); - saveEpg(true);// true CVFD::MODE_SHUTDOWN + printf("now: %ld, timer %ld, FP timer %ldmin\n", mtime/60, timer_minutes, fp_timer);fflush(stdout); + int leds = 0x40; + switch (g_settings.led_deep_mode) + { + case 0: + leds = 0x0; //off leds + break; + case 1: + leds = 0x60; //on led1 & 2 + break; + case 2: + leds = 0x20; //led1 on , 2 off + break; + case 3: + leds = 0x40; //led2 off, 2 on + break; + default: + break; } + if (leds && g_settings.led_blink && fp_timer) + leds |= 0x80; - /* on shutdown force load new fst */ - if (can_shutdown) - CheckFastScan(true, false); + standby.brightness = cs_get_revision() == 10 ? 0 : g_settings.lcd_setting[SNeutrinoSettings::LCD_DEEPSTANDBY_BRIGHTNESS]; + standby.flags = leds; + standby.current_hour = tmtime->tm_hour; + standby.current_minute = tmtime->tm_min; + standby.timer_minutes_hi = fp_timer >> 8;; + standby.timer_minutes_lo = fp_timer & 0xFF; - CVFD::getInstance()->setMode(CVFD::MODE_SHUTDOWN); + my_system("/etc/init.d/rcK"); + sync(); + CFSMounter::umount(); // unreachable NFS server + my_system(2,"/bin/umount", "-a"); + sleep(1); - stop_daemons(true /*can_shutdown*/);//need here for timer_is_rec before saveSetup - g_settings.shutdown_timer_record_type = timer_is_rec; - saveSetup(NEUTRINO_SETTINGS_FILE); - - if (can_shutdown) { - puts("[neutrino.cpp] executing " NEUTRINO_ENTER_DEEPSTANDBY_SCRIPT "."); - if (my_system(NEUTRINO_ENTER_DEEPSTANDBY_SCRIPT) != 0) - perror(NEUTRINO_ENTER_DEEPSTANDBY_SCRIPT " failed"); - - printf("entering off state\n"); - mode = mode_off; - //CVFD::getInstance()->ShowText(g_Locale->getText(LOCALE_MAINMENU_SHUTDOWN)); + stop_video(); + int fd = open("/dev/display", O_RDONLY); + if (fd < 0) + { + perror("/dev/display"); + reboot(LINUX_REBOOT_CMD_RESTART); + } + else + { + if (ioctl(fd, IOC_FP_STANDBY, (fp_standby_data_t *) &standby)) { - fp_standby_data_t standby; - time_t mtime = time(NULL); - struct tm *tmtime = localtime(&mtime); - time_t fp_timer = 0; - - if(timer_minutes) { - fp_timer = timer_minutes - mtime/60; - if(fp_timer < 1) - fp_timer = 1; - } - printf("now: %ld, timer %ld, FP timer %ldmin\n", mtime/60, timer_minutes, fp_timer);fflush(stdout); - int leds = 0x40; - switch(g_settings.led_deep_mode){ - case 0: - leds = 0x0;//off leds - break; - case 1: - leds = 0x60;//on led1 & 2 - break; - case 2: - leds = 0x20;//led1 on , 2 off - break; - case 3: - leds = 0x40;//led2 off, 2 on - break; - default: - break; - } - if(leds && g_settings.led_blink && fp_timer) - leds |= 0x80; - - standby.brightness = cs_get_revision() == 10 ? 0 : g_settings.lcd_setting[SNeutrinoSettings::LCD_DEEPSTANDBY_BRIGHTNESS]; - standby.flags = leds; - standby.current_hour = tmtime->tm_hour; - standby.current_minute = tmtime->tm_min; - standby.timer_minutes_hi = fp_timer >> 8;; - standby.timer_minutes_lo = fp_timer & 0xFF; - - my_system("/etc/init.d/rcK"); - sync(); - CFSMounter::umount(); // unreachable NFS server - my_system(2,"/bin/umount", "-a"); - sleep(1); - - stop_video(); - - int fd = open("/dev/display", O_RDONLY); - if (fd < 0) { - perror("/dev/display"); - reboot(LINUX_REBOOT_CMD_RESTART); - } else { - - if (ioctl(fd, IOC_FP_STANDBY, (fp_standby_data_t *) &standby)) { - perror("IOC_FP_STANDBY"); - reboot(LINUX_REBOOT_CMD_RESTART); - } else { - while(true) sleep(1); - } - } + perror("IOC_FP_STANDBY"); + reboot(LINUX_REBOOT_CMD_RESTART); } - } else { - delete g_RCInput; - my_system("/etc/init.d/rcK"); - //fan speed - if (g_info.hw_caps->has_fan) { - CFanControlNotifier::setSpeed(0); + else + { + while (true) + sleep(1); } - //CVFD::getInstance()->ShowText(g_Locale->getText(LOCALE_MAINMENU_REBOOT)); - stop_video(); - Cleanup(); - //_exit(can_shutdown); - exit(can_shutdown); } } + else + { + delete g_RCInput; + my_system("/etc/init.d/rcK"); + //fan speed + if (g_info.hw_caps->has_fan) + CFanControlNotifier::setSpeed(0); + stop_video(); + Cleanup(); + //_exit(0); + exit(0); + } } void CNeutrinoApp::saveEpg(bool cvfd_mode)