mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-18 09:32:40 -05:00
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
This commit is contained in:
parent
5a4ca2f04d
commit
3e0e14b592
2 changed files with 26 additions and 46 deletions
|
|
@ -55,23 +55,24 @@ bool BootloaderInstallIpod::install(void)
|
||||||
emit done(true);
|
emit done(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
memset(&ipod, 0, sizeof(struct ipod_t));
|
||||||
|
|
||||||
struct ipod_t ipod;
|
if(!ipodInitialize(&ipod)) {
|
||||||
|
|
||||||
int n = ipod_scan(&ipod);
|
|
||||||
if(n == -1) {
|
|
||||||
emit logItem(tr("No Ipod detected\n"
|
|
||||||
"Permission for disc access denied!"),
|
|
||||||
LOGERROR);
|
|
||||||
emit done(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if(n == 0) {
|
|
||||||
emit logItem(tr("No Ipod detected!"), LOGERROR);
|
|
||||||
emit done(true);
|
emit done(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(ipod.nimages <= 0) {
|
||||||
|
emit logItem(tr("Failed to read firmware directory"), LOGERROR);
|
||||||
|
emit done(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
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) {
|
if(ipod.macpod) {
|
||||||
emit logItem(tr("Warning: This is a MacPod, Rockbox only runs on WinPods. \n"
|
emit logItem(tr("Warning: This is a MacPod, Rockbox only runs on WinPods. \n"
|
||||||
"See http://www.rockbox.org/wiki/IpodConversionToFAT32"), LOGERROR);
|
"See http://www.rockbox.org/wiki/IpodConversionToFAT32"), LOGERROR);
|
||||||
|
|
@ -88,41 +89,15 @@ bool BootloaderInstallIpod::install(void)
|
||||||
|
|
||||||
void BootloaderInstallIpod::installStage2(void)
|
void BootloaderInstallIpod::installStage2(void)
|
||||||
{
|
{
|
||||||
struct ipod_t ipod;
|
|
||||||
|
|
||||||
emit logItem(tr("Installing Rockbox bootloader"), LOGINFO);
|
emit logItem(tr("Installing Rockbox bootloader"), LOGINFO);
|
||||||
QCoreApplication::processEvents();
|
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) {
|
if(ipod_reopen_rw(&ipod) < 0) {
|
||||||
emit logItem(tr("Could not open Ipod in R/W mode"), LOGERROR);
|
emit logItem(tr("Could not open Ipod in R/W mode"), LOGERROR);
|
||||||
emit done(true);
|
emit done(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
QCoreApplication::processEvents();
|
||||||
|
|
||||||
m_tempfile.open();
|
m_tempfile.open();
|
||||||
QString blfile = m_tempfile.fileName();
|
QString blfile = m_tempfile.fileName();
|
||||||
|
|
@ -174,8 +149,6 @@ bool BootloaderInstallIpod::uninstall(void)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
read_directory(&ipod);
|
|
||||||
|
|
||||||
if (ipod.nimages <= 0) {
|
if (ipod.nimages <= 0) {
|
||||||
emit logItem(tr("Failed to read firmware directory"),LOGERROR);
|
emit logItem(tr("Failed to read firmware directory"),LOGERROR);
|
||||||
emit done(true);
|
emit done(true);
|
||||||
|
|
@ -266,16 +239,20 @@ bool BootloaderInstallIpod::ipodInitialize(struct ipod_t *ipod)
|
||||||
<< ipod->diskname;
|
<< ipod->diskname;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ipod_scan(ipod);
|
emit logItem(tr("Error: no mountpoint specified!"), LOGERROR);
|
||||||
qDebug() << "[BootloaderInstallIpod] ipodpatcher: scanning, found device"
|
qDebug() << "[BootloaderInstallIpod] no mountpoint specified!";
|
||||||
<< ipod->diskname;
|
|
||||||
}
|
}
|
||||||
if(ipod_open(ipod, 0) < 0) {
|
int result = ipod_open(ipod, 1);
|
||||||
|
if(result == -2) {
|
||||||
|
emit logItem(tr("Could not open Ipod: permission denied"), LOGERROR);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if(result < 0) {
|
||||||
emit logItem(tr("Could not open Ipod"), LOGERROR);
|
emit logItem(tr("Could not open Ipod"), LOGERROR);
|
||||||
return false;
|
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);
|
emit logItem(tr("Error reading partition table - possibly not an Ipod"), LOGERROR);
|
||||||
ipod_close(ipod);
|
ipod_close(ipod);
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -286,6 +263,8 @@ bool BootloaderInstallIpod::ipodInitialize(struct ipod_t *ipod)
|
||||||
ipod_close(ipod);
|
ipod_close(ipod);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
read_directory(ipod);
|
||||||
|
ipod_close(ipod);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ class BootloaderInstallIpod : public BootloaderInstallBase
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool ipodInitialize(struct ipod_t *);
|
bool ipodInitialize(struct ipod_t *);
|
||||||
|
struct ipod_t ipod;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue