summaryrefslogtreecommitdiffstats
path: root/rbutil
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2008-04-05 21:48:54 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2008-04-05 21:48:54 +0000
commit229c64ba67b2efad976417314eaef31de20af1a0 (patch)
tree645749d7996c748f68a5460b91dba349de6f8179 /rbutil
parent00a3e13b1fb1bdcd9dd1c56ccefcbe0c9b1e13dc (diff)
downloadrockbox-229c64ba67b2efad976417314eaef31de20af1a0.tar.gz
rockbox-229c64ba67b2efad976417314eaef31de20af1a0.tar.bz2
rockbox-229c64ba67b2efad976417314eaef31de20af1a0.zip
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
Diffstat (limited to 'rbutil')
-rw-r--r--rbutil/rbutilqt/autodetection.cpp16
-rw-r--r--rbutil/rbutilqt/autodetection.h2
-rw-r--r--rbutil/rbutilqt/configure.cpp12
-rw-r--r--rbutil/rbutilqt/rbsettings.cpp25
-rw-r--r--rbutil/rbutilqt/rbsettings.h2
5 files changed, 55 insertions, 2 deletions
diff --git a/rbutil/rbutilqt/autodetection.cpp b/rbutil/rbutilqt/autodetection.cpp
index 7c194c8bbf..3684d55908 100644
--- a/rbutil/rbutilqt/autodetection.cpp
+++ b/rbutil/rbutilqt/autodetection.cpp
@@ -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);
}
diff --git a/rbutil/rbutilqt/autodetection.h b/rbutil/rbutilqt/autodetection.h
index ed70233c52..ed0ba99bf8 100644
--- a/rbutil/rbutilqt/autodetection.h
+++ b/rbutil/rbutilqt/autodetection.h
@@ -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;
};
diff --git a/rbutil/rbutilqt/configure.cpp b/rbutil/rbutilqt/configure.cpp
index 61d3d7e457..8361d7e45e 100644
--- a/rbutil/rbutilqt/configure.cpp
+++ b/rbutil/rbutilqt/configure.cpp
@@ -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() != "" )
{
diff --git a/rbutil/rbutilqt/rbsettings.cpp b/rbutil/rbutilqt/rbsettings.cpp
index fd74cbb2b5..78457809a3 100644
--- a/rbutil/rbutilqt/rbsettings.cpp
+++ b/rbutil/rbutilqt/rbsettings.cpp
@@ -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()
{
diff --git a/rbutil/rbutilqt/rbsettings.h b/rbutil/rbutilqt/rbsettings.h
index d7c0ab2d97..89064aa899 100644
--- a/rbutil/rbutilqt/rbsettings.h
+++ b/rbutil/rbutilqt/rbsettings.h
@@ -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();