From 5f105f2ee329c00ec51d7ca8dead24735500b544 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Tue, 29 Jan 2013 14:24:47 +0400 Subject: [PATCH] gui/update.cpp: use mtd0 as default on apollo, disable uboot/uldr partitions write --- src/gui/update.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/gui/update.cpp b/src/gui/update.cpp index 51ed5e007..0fb653b95 100644 --- a/src/gui/update.cpp +++ b/src/gui/update.cpp @@ -85,7 +85,11 @@ extern int allow_flash; #define FILEBROWSER_UPDATE_FILTER "img" #define MTD_OF_WHOLE_IMAGE 0 -#define MTD_DEVICE_OF_UPDATE_PART "/dev/mtd2" +#ifdef BOXMODEL_APOLLO +#define MTD_DEVICE_OF_UPDATE_PART "/dev/mtd0" +#else +#define MTD_DEVICE_OF_UPDATE_PART "/dev/mtd3" +#endif CFlashUpdate::CFlashUpdate() :CProgressWindow() @@ -93,6 +97,8 @@ CFlashUpdate::CFlashUpdate() width = w_max (40, 10); setTitle(LOCALE_FLASHUPDATE_HEAD); sysfs = CMTDInfo::getInstance()->findMTDsystem(); + if (sysfs.empty()) + sysfs = MTD_DEVICE_OF_UPDATE_PART; printf("Mtd partition to update: %s\n", sysfs.c_str()); } @@ -458,9 +464,7 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &actionKey) #endif if(fileType < '3') { CNeutrinoApp::getInstance()->exec(NULL, "savesettings"); - sleep(2); //flash it... - if (ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_APPLY_SETTINGS), CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbNo, NEUTRINO_ICON_UPDATE) == CMessageBox::mbrYes) if (!CExtUpdate::getInstance()->applySettings(filename, CExtUpdate::MODE_SOFTUPDATE)) return menu_return::RETURN_REPAINT; @@ -486,9 +490,9 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &actionKey) CFSMounter::umount(); ShowHintUTF(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_FLASHREADYREBOOT)); // UTF-8 + sleep(2); //my_system("/etc/init.d/rcK"); ft.reboot(); - sleep(20000); } else if(fileType == 'T') // display file contents { @@ -604,7 +608,7 @@ void CFlashExpert::writemtd(const std::string & filename, int mtdNumber) } else { showGlobalStatus(100); showStatusMessageUTF(g_Locale->getText(LOCALE_FLASHUPDATE_READY)); // UTF-8 - sleep(1); + sleep(2); hide(); ShowHintUTF(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_FLASHREADYREBOOT)); // UTF-8 ft.reboot(); @@ -629,9 +633,15 @@ void CFlashExpert::showMTDSelector(const std::string & actionkey) for(int lx=0;lxgetMTDCount();lx++) { char sActionKey[20]; bool enabled = true; +#ifdef BOXMODEL_APOLLO + // disable write uboot / uldr, FIXME correct numbers + if ((actionkey == "writemtd") && (lx == 5 || lx == 6)) + enabled = false; +#else // disable write uboot if ((actionkey == "writemtd") && (lx == 0)) enabled = false; +#endif sprintf(sActionKey, "%s%d", actionkey.c_str(), lx); mtdselector->addItem(new CMenuForwarderNonLocalized(mtdInfo->getMTDName(lx).c_str(), enabled, NULL, this, sActionKey, CRCInput::convertDigitToKey(shortcut++))); }