Merge branch 'check/next-cc'

it compiles, but is not really tested...

Conflicts:
	src/driver/netfile.cpp
	src/driver/volume.cpp
	src/eitd/sectionsd.cpp
	src/gui/audioplayer.cpp
	src/gui/bedit/bouqueteditor_bouquets.cpp
	src/gui/bedit/bouqueteditor_channels.cpp
	src/gui/bookmarkmanager.cpp
	src/gui/bouquetlist.cpp
	src/gui/eventlist.cpp
	src/gui/movieplayer.cpp
	src/gui/pictureviewer.cpp
	src/gui/scan.cpp
	src/gui/test_menu.h
	src/gui/timerlist.cpp
	src/gui/update.cpp
	src/gui/widget/listbox.cpp
	src/neutrino.cpp
	src/system/flashtool.cpp
	src/zapit/src/Makefile.am
	src/zapit/src/femanager.cpp
This commit is contained in:
Stefan Seyfried
2013-06-16 21:22:14 +02:00
160 changed files with 6251 additions and 2072 deletions

View File

@@ -25,10 +25,14 @@
#include <libmd5sum.h>
#include <system/flashtool.h>
#include <system/fsmounter.h>
#include <system/helpers.h>
#include <eitd/sectionsd.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <libgen.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/mount.h>
@@ -37,6 +41,8 @@
#include <linux/version.h>
#include <global.h>
#include <neutrino.h>
#include <driver/display.h>
#if HAVE_TRIPLEDRAGON
/* TD kernel 2.6.12 is too old and does not have writesize yet, use oobsize instead */
@@ -104,13 +110,7 @@ bool CFlashTool::readFromMTD( const std::string & filename, int globalProgressEn
filesize = CMTDInfo::getInstance()->getMTDSize(mtdDevice);
unsigned char * buf = new unsigned char[meminfo.writesize];
if (buf == NULL) {
printf("CFlashTool::program: mem alloc failed\n");
close(fd);
close(fd1);
return false;
}
unsigned char buf[meminfo.writesize];
unsigned mtdoffset = 0;
long fsize = filesize;
while(fsize > 0) {
@@ -153,7 +153,6 @@ bool CFlashTool::readFromMTD( const std::string & filename, int globalProgressEn
if(statusViewer)
statusViewer->showLocalStatus(100);
delete[] buf;
close(fd);
close(fd1);
return true;
@@ -165,6 +164,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);
@@ -173,7 +174,32 @@ bool CFlashTool::program( const std::string & filename, int globalProgressEndEra
return false;
}
if( (fd1 = open( filename.c_str(), O_RDONLY )) < 0 ) {
char buf1[1024];
memset(buf1, 0, sizeof(buf1));
strncpy(buf1, filename.c_str(), sizeof(buf1)-1);
char* dn = dirname(buf1);
std::string flashfile;
if (strcmp(dn, "/tmp") != 0) {
memset(buf1, 0, sizeof(buf1));
strncpy(buf1, filename.c_str(), sizeof(buf1)-1);
flashfile = (std::string)"/tmp/" + basename(buf1);
CFileHelpers fh;
printf("##### [CFlashTool::program] copy flashfile to %s\n", flashfile.c_str());
if(statusViewer)
statusViewer->showStatusMessageUTF("Copy Image");
fh.copyFile(filename.c_str(), flashfile.c_str(), 0644);
sync();
if(statusViewer)
statusViewer->showGlobalStatus(statusViewer->getGlobalStatus()+5);
}
else
flashfile = filename;
// Unmount all NFS & CIFS volumes
nfs_mounted_once = false;
CFSMounter::umount();
if( (fd1 = open( flashfile.c_str(), O_RDONLY )) < 0 ) {
ErrorMessage = g_Locale->getText(LOCALE_FLASHUPDATE_CANTOPENFILE);
return false;
}
@@ -200,10 +226,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);
@@ -214,16 +242,10 @@ bool CFlashTool::program( const std::string & filename, int globalProgressEndEra
if(statusViewer)
globalProgressBegin = statusViewer->getGlobalStatus();
unsigned char * buf = new unsigned char[meminfo.writesize];
if (buf == NULL) {
printf("CFlashTool::program: mem alloc failed\n");
close(fd);
close(fd1);
return false;
}
unsigned char buf[meminfo.writesize];
unsigned mtdoffset = 0;
unsigned fsize = filesize;
printf("CFlashTool::program: file %s write size %d, erase size %d\n", filename.c_str(), meminfo.writesize, meminfo.erasesize);
printf("CFlashTool::program: file %s write size %d, erase size %d\n", flashfile.c_str(), meminfo.writesize, meminfo.erasesize);
while(fsize > 0) {
unsigned block = meminfo.writesize;
if (block > fsize)
@@ -231,7 +253,7 @@ bool CFlashTool::program( const std::string & filename, int globalProgressEndEra
unsigned res = read(fd1, buf, block);
if (res != block) {
printf("CFlashTool::program: read from %s failed: %d from %d\n", filename.c_str(), res, block);
printf("CFlashTool::program: read from %s failed: %d from %d\n", flashfile.c_str(), res, block);
}
if (isnand) {
if (block < (unsigned) meminfo.writesize) {
@@ -273,12 +295,12 @@ bool CFlashTool::program( const std::string & filename, int globalProgressEndEra
if(statusViewer)
statusViewer->showLocalStatus(100);
delete[] buf;
close(fd1);
close(fd);
// FIXME error message
if (fsize)
return false;
CVFD::getInstance()->ShowText("Flash OK.");
return true;
}
@@ -293,7 +315,7 @@ bool CFlashTool::getInfo()
meminfo.writesize = 1024;
isnand = (meminfo.type == MTD_NANDFLASH);
printf("CFlashTool::getInfo: NAND: %s\n", isnand ? "yes" : "no");
printf("CFlashTool::getInfo: NAND: %s writesize %d\n", isnand ? "yes" : "no", meminfo.writesize);
return true;
}
@@ -314,8 +336,18 @@ bool CFlashTool::erase(int globalProgressEnd)
return false;
}
if(statusViewer)
CNeutrinoApp::getInstance()->stopDaemonsForFlash();
#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;
@@ -342,17 +374,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;
@@ -389,7 +419,6 @@ bool CFlashTool::check_md5( const std::string & filename, const std::string & sm
void CFlashTool::reboot()
{
::sync();
::reboot(RB_AUTOBOOT);
::exit(0);
}