mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
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
This commit is contained in:
parent
b6e1f1c0ad
commit
34e60dde60
3 changed files with 18 additions and 11 deletions
|
@ -339,13 +339,14 @@ QString Autodetection::resolveMountPoint(QString device)
|
||||||
for(letter = 'A'; letter <= 'Z'; letter++) {
|
for(letter = 'A'; letter <= 'Z'; letter++) {
|
||||||
if(resolveDevicename(QString(letter)).toUInt() == driveno) {
|
if(resolveDevicename(QString(letter)).toUInt() == driveno) {
|
||||||
result = letter;
|
result = letter;
|
||||||
|
qDebug() << "[Autodetect] resolved mountpoint is:" << result;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
qDebug() << "[Autodetect] resolved mountpoint is:" << result;
|
|
||||||
if(!result.isEmpty())
|
if(!result.isEmpty())
|
||||||
return result + ":/";
|
return result + ":/";
|
||||||
#endif
|
#endif
|
||||||
|
qDebug() << "[Autodetect] resolving mountpoint failed!";
|
||||||
return QString("");
|
return QString("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -226,17 +226,19 @@ BootloaderInstallBase::Capabilities BootloaderInstallIpod::capabilities(void)
|
||||||
bool BootloaderInstallIpod::ipodInitialize(struct ipod_t *ipod)
|
bool BootloaderInstallIpod::ipodInitialize(struct ipod_t *ipod)
|
||||||
{
|
{
|
||||||
if(!m_blfile.isEmpty()) {
|
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)
|
#if defined(Q_OS_WIN32)
|
||||||
sprintf(ipod->diskname, "\\\\.\\PhysicalDrive%i",
|
sprintf(ipod->diskname, "\\\\.\\PhysicalDrive%i", diskname.toInt());
|
||||||
Autodetection::resolveDevicename(m_blfile).toInt());
|
|
||||||
#elif defined(Q_OS_MACX)
|
#elif defined(Q_OS_MACX)
|
||||||
sprintf(ipod->diskname, "%s",
|
sprintf(ipod->diskname, "%s",
|
||||||
qPrintable(Autodetection::resolveDevicename(m_blfile)
|
qPrintable(devicename.remove(QRegExp("s[0-9]+$"))));
|
||||||
.remove(QRegExp("s[0-9]+$"))));
|
|
||||||
#else
|
#else
|
||||||
sprintf(ipod->diskname, "%s",
|
sprintf(ipod->diskname, "%s",
|
||||||
qPrintable(Autodetection::resolveDevicename(m_blfile)
|
qPrintable(devicename.remove(QRegExp("[0-9]+$"))));
|
||||||
.remove(QRegExp("[0-9]+$"))));
|
|
||||||
#endif
|
#endif
|
||||||
qDebug() << "[BootloaderInstallIpod] ipodpatcher: overriding scan, using"
|
qDebug() << "[BootloaderInstallIpod] ipodpatcher: overriding scan, using"
|
||||||
<< ipod->diskname;
|
<< ipod->diskname;
|
||||||
|
|
|
@ -242,15 +242,19 @@ BootloaderInstallBase::BootloaderType BootloaderInstallSansa::installed(void)
|
||||||
bool BootloaderInstallSansa::sansaInitialize(struct sansa_t *sansa)
|
bool BootloaderInstallSansa::sansaInitialize(struct sansa_t *sansa)
|
||||||
{
|
{
|
||||||
if(!m_blfile.isEmpty()) {
|
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)
|
#if defined(Q_OS_WIN32)
|
||||||
sprintf(sansa->diskname, "\\\\.\\PhysicalDrive%i",
|
sprintf(sansa->diskname, "\\\\.\\PhysicalDrive%i", devicename.toInt());
|
||||||
Autodetection::resolveDevicename(m_blfile).toInt());
|
|
||||||
#elif defined(Q_OS_MACX)
|
#elif defined(Q_OS_MACX)
|
||||||
sprintf(sansa->diskname,
|
sprintf(sansa->diskname,
|
||||||
qPrintable(Autodetection::resolveDevicename(m_blfile).remove(QRegExp("s[0-9]+$"))));
|
qPrintable(devicename.remove(QRegExp("s[0-9]+$"))));
|
||||||
#else
|
#else
|
||||||
sprintf(sansa->diskname,
|
sprintf(sansa->diskname,
|
||||||
qPrintable(Autodetection::resolveDevicename(m_blfile).remove(QRegExp("[0-9]+$"))));
|
qPrintable(devicename.remove(QRegExp("[0-9]+$"))));
|
||||||
#endif
|
#endif
|
||||||
qDebug() << "[BootloaderInstallSansa] sansapatcher: overriding scan, using"
|
qDebug() << "[BootloaderInstallSansa] sansapatcher: overriding scan, using"
|
||||||
<< sansa->diskname;
|
<< sansa->diskname;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue