summaryrefslogtreecommitdiff
path: root/rbutil
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2010-04-27 21:43:14 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2010-04-27 21:43:14 +0000
commit34e60dde601e509ad2528e3078229bb85de693c9 (patch)
tree6577175a1546ebf7fbc58f1bef670d520da50f57 /rbutil
parentb6e1f1c0ad3153c2193cb3ba04857d5a5bced296 (diff)
Handle device name resolving failures.
Improve tracing of device name resolving. Explicitly fail if resolving the device name from the mountpoint failed during ipod / sansa bootloader installation. Fixes bootloader installation trying to use an empty device name in some cases which can happen if the mountpoint to get resolved uses an incompatible file system. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25743 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil')
-rw-r--r--rbutil/rbutilqt/base/autodetection.cpp3
-rw-r--r--rbutil/rbutilqt/base/bootloaderinstallipod.cpp14
-rw-r--r--rbutil/rbutilqt/base/bootloaderinstallsansa.cpp12
3 files changed, 18 insertions, 11 deletions
diff --git a/rbutil/rbutilqt/base/autodetection.cpp b/rbutil/rbutilqt/base/autodetection.cpp
index ab2b1bd05c..695cb6a204 100644
--- a/rbutil/rbutilqt/base/autodetection.cpp
+++ b/rbutil/rbutilqt/base/autodetection.cpp
@@ -339,13 +339,14 @@ QString Autodetection::resolveMountPoint(QString device)
for(letter = 'A'; letter <= 'Z'; letter++) {
if(resolveDevicename(QString(letter)).toUInt() == driveno) {
result = letter;
+ qDebug() << "[Autodetect] resolved mountpoint is:" << result;
break;
}
}
- qDebug() << "[Autodetect] resolved mountpoint is:" << result;
if(!result.isEmpty())
return result + ":/";
#endif
+ qDebug() << "[Autodetect] resolving mountpoint failed!";
return QString("");
}
diff --git a/rbutil/rbutilqt/base/bootloaderinstallipod.cpp b/rbutil/rbutilqt/base/bootloaderinstallipod.cpp
index 55fd3fcbd8..e784ee9a1f 100644
--- a/rbutil/rbutilqt/base/bootloaderinstallipod.cpp
+++ b/rbutil/rbutilqt/base/bootloaderinstallipod.cpp
@@ -226,17 +226,19 @@ BootloaderInstallBase::Capabilities BootloaderInstallIpod::capabilities(void)
bool BootloaderInstallIpod::ipodInitialize(struct ipod_t *ipod)
{
if(!m_blfile.isEmpty()) {
+ QString devicename = Autodetection::resolveDevicename(m_blfile);
+ if(devicename.isEmpty()) {
+ emit logItem(tr("Error: could not retrieve device name"), LOGERROR);
+ return false;
+ }
#if defined(Q_OS_WIN32)
- sprintf(ipod->diskname, "\\\\.\\PhysicalDrive%i",
- Autodetection::resolveDevicename(m_blfile).toInt());
+ sprintf(ipod->diskname, "\\\\.\\PhysicalDrive%i", diskname.toInt());
#elif defined(Q_OS_MACX)
sprintf(ipod->diskname, "%s",
- qPrintable(Autodetection::resolveDevicename(m_blfile)
- .remove(QRegExp("s[0-9]+$"))));
+ qPrintable(devicename.remove(QRegExp("s[0-9]+$"))));
#else
sprintf(ipod->diskname, "%s",
- qPrintable(Autodetection::resolveDevicename(m_blfile)
- .remove(QRegExp("[0-9]+$"))));
+ qPrintable(devicename.remove(QRegExp("[0-9]+$"))));
#endif
qDebug() << "[BootloaderInstallIpod] ipodpatcher: overriding scan, using"
<< ipod->diskname;
diff --git a/rbutil/rbutilqt/base/bootloaderinstallsansa.cpp b/rbutil/rbutilqt/base/bootloaderinstallsansa.cpp
index 48bd0053ee..0dc94c553c 100644
--- a/rbutil/rbutilqt/base/bootloaderinstallsansa.cpp
+++ b/rbutil/rbutilqt/base/bootloaderinstallsansa.cpp
@@ -242,15 +242,19 @@ BootloaderInstallBase::BootloaderType BootloaderInstallSansa::installed(void)
bool BootloaderInstallSansa::sansaInitialize(struct sansa_t *sansa)
{
if(!m_blfile.isEmpty()) {
+ QString devicename = Autodetection::resolveDevicename(m_blfile);
+ if(devicename.isEmpty()) {
+ emit logItem(tr("Error: could not retrieve device name"), LOGERROR);
+ return false;
+ }
#if defined(Q_OS_WIN32)
- sprintf(sansa->diskname, "\\\\.\\PhysicalDrive%i",
- Autodetection::resolveDevicename(m_blfile).toInt());
+ sprintf(sansa->diskname, "\\\\.\\PhysicalDrive%i", devicename.toInt());
#elif defined(Q_OS_MACX)
sprintf(sansa->diskname,
- qPrintable(Autodetection::resolveDevicename(m_blfile).remove(QRegExp("s[0-9]+$"))));
+ qPrintable(devicename.remove(QRegExp("s[0-9]+$"))));
#else
sprintf(sansa->diskname,
- qPrintable(Autodetection::resolveDevicename(m_blfile).remove(QRegExp("[0-9]+$"))));
+ qPrintable(devicename.remove(QRegExp("[0-9]+$"))));
#endif
qDebug() << "[BootloaderInstallSansa] sansapatcher: overriding scan, using"
<< sansa->diskname;