diff --git a/data/neutrino-scripts/flash.start b/data/neutrino-scripts/flash.start index 1a2485251..8d6aaa457 100755 --- a/data/neutrino-scripts/flash.start +++ b/data/neutrino-scripts/flash.start @@ -1 +1,28 @@ #!/bin/sh + +if pidof vsftpd > /dev/null; then + echo "Kill vsftpd" + killall vsftpd +fi + +if pidof ushare > /dev/null; then + echo "Kill ushare" + trap "" INT + kill -INT `pidof ushare` +fi + +if [ -e /var/etc/.djmount ]; then + echo "Kill djmount" + fusermount -u /media/upnp +fi + +## remount rootfs readonly ################# +mount -no remount,ro / +RET=$? +echo -n "remount rootfs readonly " +if [ "$RET" = "0" ]; then + echo "successful." +else + echo "failed." +fi +############################################ diff --git a/src/gui/update.cpp b/src/gui/update.cpp index 685e34340..165cc9ba3 100644 --- a/src/gui/update.cpp +++ b/src/gui/update.cpp @@ -463,7 +463,6 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &actionKey) printf("[update] flash/install filename %s type %c\n", filename.c_str(), fileType); #endif if(fileType < '3') { - CNeutrinoApp::getInstance()->exec(NULL, "savesettings"); //flash it... if (g_settings.apply_settings) { if (ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_APPLY_SETTINGS), CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbNo, NEUTRINO_ICON_UPDATE) == CMessageBox::mbrYes) diff --git a/src/gui/update_ext.cpp b/src/gui/update_ext.cpp index 99ce39241..320107e46 100644 --- a/src/gui/update_ext.cpp +++ b/src/gui/update_ext.cpp @@ -62,8 +62,6 @@ CExtUpdate::CExtUpdate() imgFilename = ""; mtdRamError = ""; mtdNumber = -1; - MTDBufSize = 0xFFFF; - MTDBuf = new char[MTDBufSize]; backupList = CONFIGDIR "/settingsupdate.conf"; defaultBackup = CONFIGDIR; @@ -84,8 +82,6 @@ CExtUpdate::CExtUpdate() CExtUpdate::~CExtUpdate() { - if (MTDBuf != NULL) - delete[] MTDBuf; if(FileHelpers) delete[] FileHelpers; copyList.clear(); @@ -107,7 +103,7 @@ bool CExtUpdate::ErrorReset(bool modus, const std::string & msg1, const std::str if (modus & RESET_UNLOAD) { umount(mountPkt.c_str()); - my_system(2,"rmmod", mtdramDriver.c_str()); +// my_system(2,"rmmod", mtdramDriver.c_str()); } if (modus & RESET_FD1) close(fd1); @@ -272,6 +268,8 @@ bool CExtUpdate::applySettings() } } + int MTDBufSize = 0xFFFF; + char *MTDBuf = new char[MTDBufSize]; // copy image to mtdblock if (MTDBuf == NULL) return ErrorReset(RESET_UNLOAD, "malloc error"); @@ -362,6 +360,8 @@ bool CExtUpdate::applySettings() if(hintBox) hintBox->hide(); + delete[] MTDBuf; + MTDBuf = NULL; sync(); return true; } diff --git a/src/gui/update_ext.h b/src/gui/update_ext.h index fa196f658..18280d161 100644 --- a/src/gui/update_ext.h +++ b/src/gui/update_ext.h @@ -46,8 +46,6 @@ class CExtUpdate std::string imgFilename; std::string mtdRamError; int mtdNumber; - int MTDBufSize; - char *MTDBuf; int fd1, fd2; FILE *f1; std::string mtdramDriver; diff --git a/src/gui/widget/progressstatus.h b/src/gui/widget/progressstatus.h index 1e2358ffb..82b76bf10 100644 --- a/src/gui/widget/progressstatus.h +++ b/src/gui/widget/progressstatus.h @@ -34,6 +34,7 @@ class CProgress_StatusViewer virtual unsigned int getGlobalStatus(void) = 0; virtual void showLocalStatus(const unsigned int prog) = 0; virtual void showStatusMessageUTF(const std::string & text) = 0; + virtual void paint(); }; #endif diff --git a/src/gui/widget/progresswindow.cpp b/src/gui/widget/progresswindow.cpp index 0e06617e7..7d587fe47 100644 --- a/src/gui/widget/progresswindow.cpp +++ b/src/gui/widget/progresswindow.cpp @@ -119,6 +119,8 @@ void CProgressWindow::showLocalStatus(const unsigned int prog) #ifdef VFD_UPDATE CVFD::getInstance()->showProgressBar2(local_progress); +#else + CVFD::getInstance()->showPercentOver(local_progress); #endif // VFD_UPDATE } diff --git a/src/gui/widget/progresswindow.h b/src/gui/widget/progresswindow.h index 667920087..9b4282d4f 100644 --- a/src/gui/widget/progresswindow.h +++ b/src/gui/widget/progresswindow.h @@ -57,13 +57,12 @@ class CProgressWindow : public CMenuTarget, public CProgress_StatusViewer //---------------------------- - virtual void paint(); - public: CProgressWindow(); void setTitle(const neutrino_locale_t title); virtual void hide(); + virtual void paint(); virtual int exec( CMenuTarget* parent, const std::string & actionKey ); diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 33207c2ef..3d5fab1ce 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -148,7 +148,7 @@ extern cAudio * audioDecoder; cPowerManager *powerManager; cCpuFreqManager * cpuFreq; -void stop_daemons(bool stopall = true); +void stop_daemons(bool stopall = true, bool for_flash = false); void stop_video(void); // uncomment if you want to have a "test" menue entry (rasc) @@ -3554,11 +3554,20 @@ bool CNeutrinoApp::changeNotify(const neutrino_locale_t OptionName, void * /*dat return false; } +void CNeutrinoApp::stopDaemonsForFlash() +{ + stop_daemons(false, true); +} + /************************************************************************************** * Main programm - no function here * **************************************************************************************/ -void stop_daemons(bool stopall) +void stop_daemons(bool stopall, bool for_flash) { + CVFD::getInstance()->Clear(); + CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO); + CVFD::getInstance()->ShowText("Stop daemons..."); + dvbsub_close(); tuxtxt_stop(); tuxtxt_close(); @@ -3574,7 +3583,7 @@ void stop_daemons(bool stopall) } printf("httpd shutdown done\n"); CStreamManager::getInstance()->Stop(); - if(stopall) { + if(stopall && !for_flash) { printf("timerd shutdown\n"); if (g_Timerd) g_Timerd->shutdown(); @@ -3589,15 +3598,16 @@ void stop_daemons(bool stopall) #endif tuxtx_stop_subtitle(); printf("zapit shutdown\n"); - if(!stopall && g_settings.hdmi_cec_mode && g_settings.hdmi_cec_standby){ + if(!for_flash && !stopall && g_settings.hdmi_cec_mode && g_settings.hdmi_cec_standby){ videoDecoder->SetCECMode((VIDEO_HDMI_CEC_MODE)0); } delete &CMoviePlayerGui::getInstance(); CZapit::getInstance()->Stop(); printf("zapit shutdown done\n"); - CVFD::getInstance()->Clear(); - if(stopall) { + if (!for_flash) + CVFD::getInstance()->Clear(); + if(stopall && !for_flash) { if (cpuFreq) { cpuFreq->SetCpuFreq(g_settings.cpufreq * 1000 * 1000); delete cpuFreq; @@ -3614,6 +3624,13 @@ void stop_daemons(bool stopall) } cs_deregister_messenger(); } + + if (for_flash) { + delete CRecordManager::getInstance(); + delete videoDemux; + my_system(NEUTRINO_ENTER_FLASH_SCRIPT); + } + CVFD::getInstance()->ShowText("Stop daemons done"); } void stop_video() diff --git a/src/neutrino.h b/src/neutrino.h index bf470f6ad..b79678e08 100644 --- a/src/neutrino.h +++ b/src/neutrino.h @@ -138,7 +138,6 @@ private: void radioMode( bool rezap = true ); void scartMode( bool bOnOff ); void standbyMode( bool bOnOff, bool fromDeepStandby = false ); - void saveEpg(bool cvfd_mode); void getAnnounceEpgName(CTimerd::RecordingInfo * eventinfo, std::string &name); void ExitRun(const bool write_si = true, int retcode = 0); @@ -233,6 +232,9 @@ public: void showInfo(void); CConfigFile* getConfigFile() {return &configfile;}; bool SDTreloadChannels; + + void saveEpg(bool cvfd_mode); + void stopDaemonsForFlash(); }; #endif diff --git a/src/system/flashtool.cpp b/src/system/flashtool.cpp index 1e1333783..2b5c9d136 100644 --- a/src/system/flashtool.cpp +++ b/src/system/flashtool.cpp @@ -38,7 +38,7 @@ #include #include - +#include CFlashTool::CFlashTool() { @@ -155,6 +155,8 @@ bool CFlashTool::program( const std::string & filename, int globalProgressEndEra ssize_t filesize; int globalProgressBegin = 0; + CNeutrinoApp::getInstance()->saveEpg(false); + if(statusViewer) statusViewer->showLocalStatus(0); @@ -190,10 +192,12 @@ bool CFlashTool::program( const std::string & filename, int globalProgressEndEra if(statusViewer) { if(globalProgressEndErase!=-1) statusViewer->showGlobalStatus(globalProgressEndErase); - statusViewer->showLocalStatus(0); statusViewer->showStatusMessageUTF(g_Locale->getText(LOCALE_FLASHUPDATE_PROGRAMMINGFLASH)); // UTF-8 } +#ifndef VFD_UPDATE + CVFD::getInstance()->ShowText("Write Flash"); +#endif if( (fd = open( mtdDevice.c_str(), O_WRONLY )) < 0 ) { ErrorMessage = g_Locale->getText(LOCALE_FLASHUPDATE_CANTOPENMTD); @@ -262,6 +266,7 @@ bool CFlashTool::program( const std::string & filename, int globalProgressEndEra // FIXME error message if (fsize) return false; + CVFD::getInstance()->ShowText("Flash OK."); return true; } @@ -297,12 +302,18 @@ bool CFlashTool::erase(int globalProgressEnd) return false; } - printf("sectionsd shutdown\n"); - CEitManager::getInstance()->Stop(); - printf("sectionsd shutdown done\n"); + CNeutrinoApp::getInstance()->stopDaemonsForFlash(); - if(statusViewer) +#ifndef VFD_UPDATE + CVFD::getInstance()->ShowText("Erase Flash"); +#endif + + if(statusViewer) { globalProgressBegin = statusViewer->getGlobalStatus(); + statusViewer->paint(); + statusViewer->showLocalStatus(0); + statusViewer->showGlobalStatus(globalProgressBegin); + } lerase.length = meminfo.erasesize; @@ -329,17 +340,15 @@ bool CFlashTool::erase(int globalProgressEnd) continue; } } - if(ioctl( fd, MEMERASE, &lerase) != 0) { ErrorMessage = g_Locale->getText(LOCALE_FLASHUPDATE_ERASEFAILED); close(fd); return false; } - printf( "Erasing %u Kbyte @ %x -- %2u %% complete.\n", - meminfo.erasesize/1024, lerase.start, - prog /* lerase.start*100/meminfo.size */); + printf( "Erasing %u Kbyte @ 0x%08X -- %2u %% complete.\n", meminfo.erasesize/1024, lerase.start, prog); } + printf("\n"); close(fd); return true; @@ -376,7 +385,6 @@ bool CFlashTool::check_md5( const std::string & filename, const std::string & sm void CFlashTool::reboot() { - ::sync(); ::reboot(RB_AUTOBOOT); ::exit(0); }