Upon autodetection tell the user if an incompatible player model (newer Sansa / Nano) was found. Detection is usb based only.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16979 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
00a3e13b1f
commit
229c64ba67
5 changed files with 55 additions and 2 deletions
|
@ -172,7 +172,7 @@ bool Autodetection::detect()
|
|||
return true;
|
||||
}
|
||||
|
||||
if(m_mountpoint.isEmpty() && m_device.isEmpty() && m_errdev.isEmpty())
|
||||
if(m_mountpoint.isEmpty() && m_device.isEmpty() && m_errdev.isEmpty() && m_incompat.isEmpty())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
@ -262,6 +262,7 @@ bool Autodetection::detectUsb()
|
|||
// the ini file needs to hold the IDs as hex values.
|
||||
QMap<int, QString> usbids = settings->usbIdMap();
|
||||
QMap<int, QString> usberror = settings->usbIdErrorMap();
|
||||
QMap<int, QString> usbincompat = settings->usbIdIncompatMap();
|
||||
|
||||
// usb pid detection
|
||||
#if defined(Q_OS_LINUX) | defined(Q_OS_MACX)
|
||||
|
@ -293,6 +294,11 @@ bool Autodetection::detectUsb()
|
|||
qDebug() << "detected device with problems via usb!";
|
||||
return true;
|
||||
}
|
||||
if(usbincompat.contains(id)) {
|
||||
m_incompat = usbincompat.value(id);
|
||||
qDebug() << "detected incompatible player variant";
|
||||
return true;
|
||||
}
|
||||
u = u->next;
|
||||
}
|
||||
}
|
||||
|
@ -371,6 +377,14 @@ bool Autodetection::detectUsb()
|
|||
qDebug() << "detected device with problems via usb!";
|
||||
return true;
|
||||
}
|
||||
if(usbincompat.contains(id)) {
|
||||
m_incompat = usbincompat.value(id);
|
||||
// we detected an incompatible player variant
|
||||
if(buffer) free(buffer);
|
||||
SetupDiDestroyDeviceInfoList(deviceInfo);
|
||||
qDebug() << "detectUsb: detected incompatible variant";
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if(buffer) free(buffer);
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ public:
|
|||
QString getDevice() {return m_device;}
|
||||
QString getMountPoint() {return m_mountpoint;}
|
||||
QString errdev(void) { return m_errdev; }
|
||||
QString incompatdev(void) { return m_incompat; }
|
||||
|
||||
private:
|
||||
QStringList getMountpoints(void);
|
||||
|
@ -54,6 +55,7 @@ private:
|
|||
QString m_device;
|
||||
QString m_mountpoint;
|
||||
QString m_errdev;
|
||||
QString m_incompat;
|
||||
QList<int> m_usbconid;
|
||||
RbSettings* settings;
|
||||
};
|
||||
|
|
|
@ -534,6 +534,18 @@ void Config::autodetect()
|
|||
QMessageBox::critical(this, tr("Fatal error"), text, QMessageBox::Ok);
|
||||
return;
|
||||
}
|
||||
if(!detector.incompatdev().isEmpty()) {
|
||||
QString text;
|
||||
// we need to set the platform here to get the brand from the
|
||||
// settings object
|
||||
settings->setCurPlatform(detector.incompatdev());
|
||||
text = tr("Detected an unsupported %1 player variant. Sorry, "
|
||||
"Rockbox doesn't run on your player.").arg(settings->curBrand());
|
||||
|
||||
QMessageBox::critical(this, tr("Fatal error: incompatible player found"),
|
||||
text, QMessageBox::Ok);
|
||||
return;
|
||||
}
|
||||
|
||||
if(detector.getMountPoint() != "" )
|
||||
{
|
||||
|
|
|
@ -461,6 +461,31 @@ QMap<int, QString> RbSettings::usbIdErrorMap()
|
|||
}
|
||||
|
||||
|
||||
QMap<int, QString> RbSettings::usbIdIncompatMap()
|
||||
{
|
||||
|
||||
QMap<int, QString> map;
|
||||
// get a list of ID -> target name
|
||||
QStringList platforms;
|
||||
devices->beginGroup("platforms");
|
||||
platforms = devices->childKeys();
|
||||
devices->endGroup();
|
||||
|
||||
for(int i = 0; i < platforms.size(); i++)
|
||||
{
|
||||
devices->beginGroup("platforms");
|
||||
QString target = devices->value(platforms.at(i)).toString();
|
||||
devices->endGroup();
|
||||
devices->beginGroup(target);
|
||||
QStringList ids = devices->value("usbincompat").toStringList();
|
||||
int j = ids.size();
|
||||
while(j--)
|
||||
map.insert(ids.at(j).toInt(0, 16), target);
|
||||
devices->endGroup();
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
QString RbSettings::curResolution()
|
||||
{
|
||||
|
|
|
@ -83,7 +83,7 @@ class RbSettings : public QObject
|
|||
QStringList allLanguages();
|
||||
QMap<int, QString> usbIdMap();
|
||||
QMap<int, QString> usbIdErrorMap();
|
||||
|
||||
QMap<int, QString> usbIdIncompatMap();
|
||||
|
||||
bool curNeedsBootloader();
|
||||
QString curBrand();
|
||||
|
|
Loading…
Reference in a new issue