summaryrefslogtreecommitdiff
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
parentb6e1f1c0ad3153c2193cb3ba04857d5a5bced296 (diff)
downloadrockbox-34e60dde601e509ad2528e3078229bb85de693c9.tar.gz
rockbox-34e60dde601e509ad2528e3078229bb85de693c9.zip
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
-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)
339 for(letter = 'A'; letter <= 'Z'; letter++) { 339 for(letter = 'A'; letter <= 'Z'; letter++) {
340 if(resolveDevicename(QString(letter)).toUInt() == driveno) { 340 if(resolveDevicename(QString(letter)).toUInt() == driveno) {
341 result = letter; 341 result = letter;
342 qDebug() << "[Autodetect] resolved mountpoint is:" << result;
342 break; 343 break;
343 } 344 }
344 } 345 }
345 qDebug() << "[Autodetect] resolved mountpoint is:" << result;
346 if(!result.isEmpty()) 346 if(!result.isEmpty())
347 return result + ":/"; 347 return result + ":/";
348#endif 348#endif
349 qDebug() << "[Autodetect] resolving mountpoint failed!";
349 return QString(""); 350 return QString("");
350} 351}
351 352
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)
226bool BootloaderInstallIpod::ipodInitialize(struct ipod_t *ipod) 226bool BootloaderInstallIpod::ipodInitialize(struct ipod_t *ipod)
227{ 227{
228 if(!m_blfile.isEmpty()) { 228 if(!m_blfile.isEmpty()) {
229 QString devicename = Autodetection::resolveDevicename(m_blfile);
230 if(devicename.isEmpty()) {
231 emit logItem(tr("Error: could not retrieve device name"), LOGERROR);
232 return false;
233 }
229#if defined(Q_OS_WIN32) 234#if defined(Q_OS_WIN32)
230 sprintf(ipod->diskname, "\\\\.\\PhysicalDrive%i", 235 sprintf(ipod->diskname, "\\\\.\\PhysicalDrive%i", diskname.toInt());
231 Autodetection::resolveDevicename(m_blfile).toInt());
232#elif defined(Q_OS_MACX) 236#elif defined(Q_OS_MACX)
233 sprintf(ipod->diskname, "%s", 237 sprintf(ipod->diskname, "%s",
234 qPrintable(Autodetection::resolveDevicename(m_blfile) 238 qPrintable(devicename.remove(QRegExp("s[0-9]+$"))));
235 .remove(QRegExp("s[0-9]+$"))));
236#else 239#else
237 sprintf(ipod->diskname, "%s", 240 sprintf(ipod->diskname, "%s",
238 qPrintable(Autodetection::resolveDevicename(m_blfile) 241 qPrintable(devicename.remove(QRegExp("[0-9]+$"))));
239 .remove(QRegExp("[0-9]+$"))));
240#endif 242#endif
241 qDebug() << "[BootloaderInstallIpod] ipodpatcher: overriding scan, using" 243 qDebug() << "[BootloaderInstallIpod] ipodpatcher: overriding scan, using"
242 << ipod->diskname; 244 << 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)
242bool BootloaderInstallSansa::sansaInitialize(struct sansa_t *sansa) 242bool BootloaderInstallSansa::sansaInitialize(struct sansa_t *sansa)
243{ 243{
244 if(!m_blfile.isEmpty()) { 244 if(!m_blfile.isEmpty()) {
245 QString devicename = Autodetection::resolveDevicename(m_blfile);
246 if(devicename.isEmpty()) {
247 emit logItem(tr("Error: could not retrieve device name"), LOGERROR);
248 return false;
249 }
245#if defined(Q_OS_WIN32) 250#if defined(Q_OS_WIN32)
246 sprintf(sansa->diskname, "\\\\.\\PhysicalDrive%i", 251 sprintf(sansa->diskname, "\\\\.\\PhysicalDrive%i", devicename.toInt());
247 Autodetection::resolveDevicename(m_blfile).toInt());
248#elif defined(Q_OS_MACX) 252#elif defined(Q_OS_MACX)
249 sprintf(sansa->diskname, 253 sprintf(sansa->diskname,
250 qPrintable(Autodetection::resolveDevicename(m_blfile).remove(QRegExp("s[0-9]+$")))); 254 qPrintable(devicename.remove(QRegExp("s[0-9]+$"))));
251#else 255#else
252 sprintf(sansa->diskname, 256 sprintf(sansa->diskname,
253 qPrintable(Autodetection::resolveDevicename(m_blfile).remove(QRegExp("[0-9]+$")))); 257 qPrintable(devicename.remove(QRegExp("[0-9]+$"))));
254#endif 258#endif
255 qDebug() << "[BootloaderInstallSansa] sansapatcher: overriding scan, using" 259 qDebug() << "[BootloaderInstallSansa] sansapatcher: overriding scan, using"
256 << sansa->diskname; 260 << sansa->diskname;