1
0
Fork 0
forked from len0rd/rockbox

Bootloader installation for ipod and sansa: override the scanning with the device pointed to by the mountpoint. This allows selecting the correct player if two of the same brand are connected (FS#10096).

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20832 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dominik Riebeling 2009-04-30 19:14:24 +00:00
parent 549fc95b8d
commit f679cf91cf
5 changed files with 169 additions and 91 deletions

View file

@ -22,6 +22,7 @@
#include "bootloaderinstallipod.h"
#include "../ipodpatcher/ipodpatcher.h"
#include "autodetection.h"
BootloaderInstallIpod::BootloaderInstallIpod(QObject *parent)
@ -36,7 +37,8 @@ BootloaderInstallIpod::BootloaderInstallIpod(QObject *parent)
BootloaderInstallIpod::~BootloaderInstallIpod()
{
free(ipod_sectorbuf);
if(ipod_sectorbuf)
free(ipod_sectorbuf);
}
@ -198,12 +200,15 @@ BootloaderInstallBase::BootloaderType BootloaderInstallIpod::installed(void)
qDebug() << "BootloaderInstallIpod::installed(): BootloaderUnknown";
result = BootloaderUnknown;
}
else if (ipod.ipod_directory[0].entryOffset == 0) {
qDebug() << "BootloaderInstallIpod::installed(): BootloaderOther";
result = BootloaderOther;
}
else {
qDebug() << "BootloaderInstallIpod::installed(): BootloaderRockbox";
read_directory(&ipod);
if(ipod.ipod_directory[0].entryOffset == 0) {
qDebug() << "BootloaderInstallIpod::installed(): BootloaderOther";
result = BootloaderOther;
}
else {
qDebug() << "BootloaderInstallIpod::installed(): BootloaderRockbox";
}
}
ipod_close(&ipod);
@ -219,20 +224,38 @@ BootloaderInstallBase::Capabilities BootloaderInstallIpod::capabilities(void)
bool BootloaderInstallIpod::ipodInitialize(struct ipod_t *ipod)
{
ipod_scan(ipod);
if(!m_blfile.isEmpty()) {
#if defined(Q_OS_WIN32)
sprintf(ipod->diskname, "\\\\.\\PhysicalDrive%i",
Autodetection::resolveDevicename(m_blfile).toInt());
#elif defined(Q_OS_MACX)
sprintf(ipod->diskname,
qPrintable(Autodetection::resolveDevicename(m_blfile)
.remove(QRegExp("s[0-9]+$"))));
#else
sprintf(ipod->diskname,
qPrintable(Autodetection::resolveDevicename(m_blfile)
.remove(QRegExp("[0-9]+$"))));
#endif
qDebug() << "ipodpatcher: overriding scan, using" << ipod->diskname;
}
else {
ipod_scan(ipod);
}
if(ipod_open(ipod, 0) < 0) {
emit logItem(tr("Could not open Ipod"), LOGERROR);
return false;
}
if(read_partinfo(ipod, 0) < 0) {
emit logItem(tr("Could not read partition table"), LOGERROR);
emit logItem(tr("Error reading partition table - possibly not an Ipod"), LOGERROR);
ipod_close(ipod);
return false;
}
if(ipod->pinfo[0].start == 0) {
emit logItem(tr("No firmware partition on disk"), LOGERROR);
ipod_close(ipod);
return false;
}
return true;