* Software update: Rework preparing the flash process

- Finish all unnecessary threads and processes before the flash process
- Use flash.start to stop other (user-defined) processes
This commit is contained in:
Michael Liebmann
2013-06-08 14:45:26 +02:00
parent d74ce0da45
commit c26fd64759
10 changed files with 81 additions and 28 deletions

View File

@@ -38,7 +38,7 @@
#include <linux/version.h>
#include <global.h>
#include <neutrino.h>
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);
}