mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 23:42:58 +02:00
Search mtd device to update by name
git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@581 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
@@ -83,6 +83,8 @@ CFlashUpdate::CFlashUpdate()
|
|||||||
:CProgressWindow()
|
:CProgressWindow()
|
||||||
{
|
{
|
||||||
setTitle(LOCALE_FLASHUPDATE_HEAD);
|
setTitle(LOCALE_FLASHUPDATE_HEAD);
|
||||||
|
sysfs = CMTDInfo::getInstance()->findMTDsystem();
|
||||||
|
printf("Mtd partition to update: %s\n", sysfs.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -358,6 +360,11 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &)
|
|||||||
|
|
||||||
paint();
|
paint();
|
||||||
|
|
||||||
|
if(sysfs.size() < 8) {
|
||||||
|
ShowHintUTF(LOCALE_MESSAGEBOX_ERROR, g_Locale->getText(LOCALE_FLASHUPDATE_CANTOPENMTD));
|
||||||
|
hide();
|
||||||
|
return menu_return::RETURN_REPAINT;
|
||||||
|
}
|
||||||
if(!checkVersion4Update()) {
|
if(!checkVersion4Update()) {
|
||||||
hide();
|
hide();
|
||||||
return menu_return::RETURN_REPAINT;
|
return menu_return::RETURN_REPAINT;
|
||||||
@@ -389,7 +396,8 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &)
|
|||||||
showGlobalStatus(40);
|
showGlobalStatus(40);
|
||||||
|
|
||||||
CFlashTool ft;
|
CFlashTool ft;
|
||||||
ft.setMTDDevice(MTD_DEVICE_OF_UPDATE_PART);
|
//ft.setMTDDevice(MTD_DEVICE_OF_UPDATE_PART);
|
||||||
|
ft.setMTDDevice(sysfs);
|
||||||
ft.setStatusViewer(this);
|
ft.setStatusViewer(this);
|
||||||
|
|
||||||
showStatusMessageUTF(g_Locale->getText(LOCALE_FLASHUPDATE_MD5CHECK)); // UTF-8
|
showStatusMessageUTF(g_Locale->getText(LOCALE_FLASHUPDATE_MD5CHECK)); // UTF-8
|
||||||
|
@@ -46,6 +46,7 @@ class CFlashUpdate : public CProgressWindow
|
|||||||
private:
|
private:
|
||||||
std::string filename;
|
std::string filename;
|
||||||
std::string file_md5;
|
std::string file_md5;
|
||||||
|
std::string sysfs;
|
||||||
char fileType;
|
char fileType;
|
||||||
|
|
||||||
std::string installedVersion;
|
std::string installedVersion;
|
||||||
|
@@ -461,6 +461,7 @@ public:
|
|||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
|
extern int cs_test_card(int unit, char * str);
|
||||||
int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey)
|
int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey)
|
||||||
{
|
{
|
||||||
if (parent)
|
if (parent)
|
||||||
@@ -527,7 +528,43 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey)
|
|||||||
close(fd);
|
close(fd);
|
||||||
ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, str, CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_INFO);
|
ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, str, CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_INFO);
|
||||||
}
|
}
|
||||||
else if (actionKey == "card") {
|
else if (actionKey == "card0") {
|
||||||
|
char str[255];
|
||||||
|
int ret = cs_test_card(0, str);
|
||||||
|
switch(ret) {
|
||||||
|
case 0:
|
||||||
|
ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, str, CMessageBox::mbrBack, CMessageBox::mbBack, "info.raw");
|
||||||
|
break;
|
||||||
|
case -1:
|
||||||
|
ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, "Smardcard 1 ATR read failed", CMessageBox::mbrBack, CMessageBox::mbBack, "info");
|
||||||
|
break;
|
||||||
|
case -2:
|
||||||
|
ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, "Smardcard 1 reset failed", CMessageBox::mbrBack, CMessageBox::mbBack, "info");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
case -3:
|
||||||
|
ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, "Smardcard 1 open failed", CMessageBox::mbrBack, CMessageBox::mbBack, "info");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (actionKey == "card1") {
|
||||||
|
char str[255];
|
||||||
|
int ret = cs_test_card(1, str);
|
||||||
|
switch(ret) {
|
||||||
|
case 0:
|
||||||
|
ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, str, CMessageBox::mbrBack, CMessageBox::mbBack, "info.raw");
|
||||||
|
break;
|
||||||
|
case -1:
|
||||||
|
ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, "Smardcard 2 ATR read failed", CMessageBox::mbrBack, CMessageBox::mbBack, "info");
|
||||||
|
break;
|
||||||
|
case -2:
|
||||||
|
ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, "Smardcard 2 reset failed", CMessageBox::mbrBack, CMessageBox::mbBack, "info");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
case -3:
|
||||||
|
ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, "Smardcard 2 open failed", CMessageBox::mbrBack, CMessageBox::mbBack, "info");
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (actionKey == "hdd") {
|
else if (actionKey == "hdd") {
|
||||||
char buffer[255];
|
char buffer[255];
|
||||||
@@ -643,7 +680,8 @@ void CNeutrinoApp::InitMainMenu(CMenuWidget &mainMenu, CMenuWidget &mainSettings
|
|||||||
CTestMenu * testHandler = new CTestMenu();
|
CTestMenu * testHandler = new CTestMenu();
|
||||||
TestMenu->addItem(new CMenuForwarderNonLocalized("VFD", true, NULL, testHandler, "vfd"));
|
TestMenu->addItem(new CMenuForwarderNonLocalized("VFD", true, NULL, testHandler, "vfd"));
|
||||||
TestMenu->addItem(new CMenuForwarderNonLocalized("Network", true, NULL, testHandler, "network"));
|
TestMenu->addItem(new CMenuForwarderNonLocalized("Network", true, NULL, testHandler, "network"));
|
||||||
TestMenu->addItem(new CMenuForwarderNonLocalized("Smartcard", true, NULL, testHandler, "card"));
|
TestMenu->addItem(new CMenuForwarderNonLocalized("Smartcard 1", true, NULL, testHandler, "card0"));
|
||||||
|
TestMenu->addItem(new CMenuForwarderNonLocalized("Smartcard 2", true, NULL, testHandler, "card1"));
|
||||||
TestMenu->addItem(new CMenuForwarderNonLocalized("HDD", true, NULL, testHandler, "hdd"));
|
TestMenu->addItem(new CMenuForwarderNonLocalized("HDD", true, NULL, testHandler, "hdd"));
|
||||||
TestMenu->addItem(new CMenuForwarderNonLocalized("Buttons", true, NULL, testHandler, "buttons"));
|
TestMenu->addItem(new CMenuForwarderNonLocalized("Buttons", true, NULL, testHandler, "buttons"));
|
||||||
TestMenu->addItem(new CMenuForwarderNonLocalized("Scan 12538000", true, NULL, testHandler, "scan"));
|
TestMenu->addItem(new CMenuForwarderNonLocalized("Scan 12538000", true, NULL, testHandler, "scan"));
|
||||||
|
@@ -539,3 +539,16 @@ int CMTDInfo::getMTDEraseSize( const std::string & filename )
|
|||||||
{
|
{
|
||||||
return getMTDEraseSize( findMTDNumber(filename) );
|
return getMTDEraseSize( findMTDNumber(filename) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string CMTDInfo::findMTDsystem()
|
||||||
|
{
|
||||||
|
std::string sysfs = "systemFS";
|
||||||
|
|
||||||
|
for(int i = 0; i < getMTDCount(); i++) {
|
||||||
|
if(getMTDName(i) == sysfs) {
|
||||||
|
printf("systemFS: %d dev %s\n", i, getMTDFileName(i).c_str());
|
||||||
|
return getMTDFileName(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
@@ -124,7 +124,7 @@ class CMTDInfo
|
|||||||
int getMTDEraseSize( const std::string & filename );
|
int getMTDEraseSize( const std::string & filename );
|
||||||
|
|
||||||
int findMTDNumber(const std::string & filename);
|
int findMTDNumber(const std::string & filename);
|
||||||
|
std::string findMTDsystem();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user