From dfd4183a7da257a1df9979c3ced830cfd5f1e6e3 Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Sat, 25 Jun 2011 17:21:01 +0000 Subject: [PATCH] Fix bootloader uninstallation on Gigabeat F / X. The "file" bootloader installation method usually can uninstall the bootloader. Some upgrade methods (like the Iaudio players) remove the bootloader file placed on the player after upgrading so those can't uninstall the bootloader. Instead of rejecting uninstallation for all players using this method check the current bootloader and only display an error if no suitable bootloader is found (which would happen in the Iaudio case). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30070 a1c6a512-1295-4272-9138-f99709370657 --- .../rbutilqt/base/bootloaderinstallfile.cpp | 2 +- rbutil/rbutilqt/rbutilqt.cpp | 21 +++++++++++-------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/rbutil/rbutilqt/base/bootloaderinstallfile.cpp b/rbutil/rbutilqt/base/bootloaderinstallfile.cpp index 7649f50e2a..58288d68de 100644 --- a/rbutil/rbutilqt/base/bootloaderinstallfile.cpp +++ b/rbutil/rbutilqt/base/bootloaderinstallfile.cpp @@ -141,6 +141,6 @@ BootloaderInstallBase::BootloaderType BootloaderInstallFile::installed(void) BootloaderInstallBase::Capabilities BootloaderInstallFile::capabilities(void) { qDebug() << "[BootloaderInstallFile] getting capabilities"; - return Install | IsFile | CanCheckInstalled | Backup; + return Install | Uninstall | IsFile | CanCheckInstalled | Backup; } diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp index 56313f155e..59ba9e3c0e 100644 --- a/rbutil/rbutilqt/rbutilqt.cpp +++ b/rbutil/rbutilqt/rbutilqt.cpp @@ -1045,15 +1045,6 @@ void RbUtilQt::uninstallBootloader(void) logger->setFinished(); return; } - if( (bl->capabilities() & BootloaderInstallBase::Uninstall) == 0) - { - logger->addItem(tr("Rockbox Utility can not uninstall the bootloader on this target. " - "Try a normal firmware update to remove the booloader."), LOGERROR); - logger->setFinished(); - delete bl; - return; - } - QStringList blfile = SystemInfo::value(SystemInfo::CurBootloaderFile).toStringList(); QStringList blfilepath; for(int a = 0; a < blfile.size(); a++) { @@ -1062,6 +1053,18 @@ void RbUtilQt::uninstallBootloader(void) } bl->setBlFile(blfilepath); + BootloaderInstallBase::BootloaderType currentbl = bl->installed(); + if((bl->capabilities() & BootloaderInstallBase::Uninstall) == 0 + || currentbl == BootloaderInstallBase::BootloaderUnknown + || currentbl == BootloaderInstallBase::BootloaderOther) + { + logger->addItem(tr("Rockbox Utility can not uninstall the bootloader on this target. " + "Try a normal firmware update to remove the booloader."), LOGERROR); + logger->setFinished(); + delete bl; + return; + } + connect(bl, SIGNAL(logItem(QString, int)), logger, SLOT(addItem(QString, int))); connect(bl, SIGNAL(logProgress(int, int)), logger, SLOT(setProgress(int, int)));