Exemplo n.º 1
0
void CFlashExpert::readmtd(int readmtd)
{
	char tmp[10];
	sprintf(tmp, "%d", readmtd);
	string filename = "/tmp/mtd" + string(tmp) + string(".img");
	if(readmtd==-1)
	{
		//ganzes flashimage lesen
		filename = "/tmp/flashimage.img";
		readmtd = 4;
	}
	setTitle(g_Locale->getText("flashupdate.titlereadflash"));
	paint();
	showGlobalStatus(0);
	showStatusMessage(g_Locale->getText("flashupdate.actionreadflash") + " (" + string(CMTDInfo::getInstance()->getMTDName(readmtd)) + ")");
	CFlashTool ft;
	ft.setStatusViewer( this );
	ft.setMTDDevice(CMTDInfo::getInstance()->getMTDFileName(readmtd));
	if(!ft.readFromMTD(filename, 100))
	{
		showStatusMessage( ft.getErrorMessage() );
		sleep(10);
	}
	else
	{
		showGlobalStatus(100);
		showStatusMessage( g_Locale->getText("flashupdate.ready"));
		char message[500];
		sprintf(message, g_Locale->getText("flashupdate.savesuccess").c_str(), filename.c_str() );
		sleep(1);
		hide();
		ShowHint ( "messagebox.info", message );
	}
}
Exemplo n.º 2
0
void CSetupReadFlash::DoAction( std::string _action )
{
	std::string file = "/tmp/";
	int num = CMTDInfo::getInstance()->findMTDNumberByName( _action );

	file += _action;
	file += ".img";

	unsigned int i = 0;
	for ( i = 0; i < file.size(); i++ )
	{
		if( 
			file[i] == ' '
			|| file[i] == '('
			|| file[i] == ')' ) 
		{
			file[i] = '_';
		}
	}

	std::cout << "File : " << file << std::endl;	
	std::cout << "Partition : " << _action << std::endl;	
	std::cout << "MTD Device : " << CMTDInfo::getInstance()->getMTDFileName( num ) << std::endl;	

	if( num >= 0 )
	{
		CFlashTool ft;
		ft.setMTDDevice( CMTDInfo::getInstance()->getMTDFileName( num ) );
		if( false == ft.readFromMTD( file, 100 ) )
		{
			std::cout << ft.getErrorMessage() << std::endl;
		}
	}	

	remove = true;
}