summaryrefslogtreecommitdiffstats
path: root/rbutil
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2009-12-17 21:54:07 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2009-12-17 21:54:07 +0000
commit3e0e14b592200c2516eb03c6a3b1838cd971e0f4 (patch)
treec36b639250bc73bad258316eaca8b343fd8e3546 /rbutil
parent5a4ca2f04d21322a81a776ac823040e385158204 (diff)
downloadrockbox-3e0e14b592200c2516eb03c6a3b1838cd971e0f4.tar.gz
rockbox-3e0e14b592200c2516eb03c6a3b1838cd971e0f4.tar.bz2
rockbox-3e0e14b592200c2516eb03c6a3b1838cd971e0f4.zip
Remove scanning for Ipod from Ipod bootloader installation and clean it up a bit. The Ipod is specified by its mountpoint, so there is no need to scan at all.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24056 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil')
-rw-r--r--rbutil/rbutilqt/base/bootloaderinstallipod.cpp65
-rw-r--r--rbutil/rbutilqt/base/bootloaderinstallipod.h1
2 files changed, 23 insertions, 43 deletions
diff --git a/rbutil/rbutilqt/base/bootloaderinstallipod.cpp b/rbutil/rbutilqt/base/bootloaderinstallipod.cpp
index eaf69e4773..48b35f930f 100644
--- a/rbutil/rbutilqt/base/bootloaderinstallipod.cpp
+++ b/rbutil/rbutilqt/base/bootloaderinstallipod.cpp
@@ -55,23 +55,24 @@ bool BootloaderInstallIpod::install(void)
emit done(true);
return false;
}
+ memset(&ipod, 0, sizeof(struct ipod_t));
- struct ipod_t ipod;
+ if(!ipodInitialize(&ipod)) {
+ emit done(true);
+ return false;
+ }
- int n = ipod_scan(&ipod);
- if(n == -1) {
- emit logItem(tr("No Ipod detected\n"
- "Permission for disc access denied!"),
- LOGERROR);
+ if(ipod.nimages <= 0) {
+ emit logItem(tr("Failed to read firmware directory"), LOGERROR);
emit done(true);
return false;
}
- if(n == 0) {
- emit logItem(tr("No Ipod detected!"), LOGERROR);
+ if(getmodel(&ipod,(ipod.ipod_directory[ipod.ososimage].vers>>8)) < 0) {
+ emit logItem(tr("Unknown version number in firmware (%1)").arg(
+ ipod.ipod_directory[0].vers), LOGERROR);
emit done(true);
return false;
}
-
if(ipod.macpod) {
emit logItem(tr("Warning: This is a MacPod, Rockbox only runs on WinPods. \n"
"See http://www.rockbox.org/wiki/IpodConversionToFAT32"), LOGERROR);
@@ -88,41 +89,15 @@ bool BootloaderInstallIpod::install(void)
void BootloaderInstallIpod::installStage2(void)
{
- struct ipod_t ipod;
-
emit logItem(tr("Installing Rockbox bootloader"), LOGINFO);
QCoreApplication::processEvents();
- if(!ipodInitialize(&ipod)) {
- emit done(true);
- return;
- }
-
- read_directory(&ipod);
-
- if(ipod.nimages <= 0) {
- emit logItem(tr("Failed to read firmware directory"), LOGERROR);
- emit done(true);
- return;
- }
- if(getmodel(&ipod,(ipod.ipod_directory[ipod.ososimage].vers>>8)) < 0) {
- emit logItem(tr("Unknown version number in firmware (%1)").arg(
- ipod.ipod_directory[0].vers), LOGERROR);
- emit done(true);
- return;
- }
-
- if(ipod.macpod) {
- emit logItem(tr("Warning: This is a MacPod, Rockbox only runs on WinPods. \n"
- "See http://www.rockbox.org/wiki/IpodConversionToFAT32"), LOGERROR);
- emit done(true);
- return;
- }
if(ipod_reopen_rw(&ipod) < 0) {
emit logItem(tr("Could not open Ipod in R/W mode"), LOGERROR);
emit done(true);
return;
}
+ QCoreApplication::processEvents();
m_tempfile.open();
QString blfile = m_tempfile.fileName();
@@ -174,8 +149,6 @@ bool BootloaderInstallIpod::uninstall(void)
return false;
}
- read_directory(&ipod);
-
if (ipod.nimages <= 0) {
emit logItem(tr("Failed to read firmware directory"),LOGERROR);
emit done(true);
@@ -266,16 +239,20 @@ bool BootloaderInstallIpod::ipodInitialize(struct ipod_t *ipod)
<< ipod->diskname;
}
else {
- ipod_scan(ipod);
- qDebug() << "[BootloaderInstallIpod] ipodpatcher: scanning, found device"
- << ipod->diskname;
+ emit logItem(tr("Error: no mountpoint specified!"), LOGERROR);
+ qDebug() << "[BootloaderInstallIpod] no mountpoint specified!";
+ }
+ int result = ipod_open(ipod, 1);
+ if(result == -2) {
+ emit logItem(tr("Could not open Ipod: permission denied"), LOGERROR);
+ return false;
}
- if(ipod_open(ipod, 0) < 0) {
+ else if(result < 0) {
emit logItem(tr("Could not open Ipod"), LOGERROR);
return false;
}
- if(read_partinfo(ipod, 0) < 0) {
+ if(read_partinfo(ipod, 1) < 0) {
emit logItem(tr("Error reading partition table - possibly not an Ipod"), LOGERROR);
ipod_close(ipod);
return false;
@@ -286,6 +263,8 @@ bool BootloaderInstallIpod::ipodInitialize(struct ipod_t *ipod)
ipod_close(ipod);
return false;
}
+ read_directory(ipod);
+ ipod_close(ipod);
return true;
}
diff --git a/rbutil/rbutilqt/base/bootloaderinstallipod.h b/rbutil/rbutilqt/base/bootloaderinstallipod.h
index 622c0730ed..2e369cda95 100644
--- a/rbutil/rbutilqt/base/bootloaderinstallipod.h
+++ b/rbutil/rbutilqt/base/bootloaderinstallipod.h
@@ -44,6 +44,7 @@ class BootloaderInstallIpod : public BootloaderInstallBase
private:
bool ipodInitialize(struct ipod_t *);
+ struct ipod_t ipod;
};