forked from len0rd/rockbox
Allow USB IDs to be non-unique.
When retrieving USB IDs create a list of players matching to a USB ID instead of assuming only one player. This prevents non-unique IDs overwriting each other and will be used for improved autodetection later. Currently only the first ID is used during detection, and no additional IDs have been added yet. Change-Id: Ieac5594108bae708e364bd2c8df88f61fcdcbdcd
This commit is contained in:
parent
71f70112b2
commit
c659f9979a
3 changed files with 21 additions and 12 deletions
|
|
@ -159,11 +159,11 @@ QMap<QString, QStringList> SystemInfo::languages(void)
|
|||
}
|
||||
|
||||
|
||||
QMap<int, QString> SystemInfo::usbIdMap(enum MapType type)
|
||||
QMap<int, QStringList> SystemInfo::usbIdMap(enum MapType type)
|
||||
{
|
||||
ensureSystemInfoExists();
|
||||
|
||||
QMap<int, QString> map;
|
||||
QMap<int, QStringList> map;
|
||||
// get a list of ID -> target name
|
||||
QStringList platforms;
|
||||
systemInfos->beginGroup("platforms");
|
||||
|
|
@ -191,9 +191,18 @@ QMap<int, QString> SystemInfo::usbIdMap(enum MapType type)
|
|||
systemInfos->beginGroup(target);
|
||||
QStringList ids = systemInfos->value(t).toStringList();
|
||||
int j = ids.size();
|
||||
while(j--)
|
||||
map.insert(ids.at(j).toInt(0, 16), target);
|
||||
|
||||
while(j--) {
|
||||
QStringList l;
|
||||
int id = ids.at(j).toInt(0, 16);
|
||||
if(id == 0) {
|
||||
continue;
|
||||
}
|
||||
if(map.keys().contains(id)) {
|
||||
l = map.take(id);
|
||||
}
|
||||
l.append(target);
|
||||
map.insert(id, l);
|
||||
}
|
||||
systemInfos->endGroup();
|
||||
}
|
||||
return map;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue