From c659f9979a482521950c6db74221330dc1895219 Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Sat, 6 Oct 2012 10:44:56 +0200 Subject: 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 --- rbutil/rbutilqt/base/systeminfo.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'rbutil/rbutilqt/base/systeminfo.cpp') diff --git a/rbutil/rbutilqt/base/systeminfo.cpp b/rbutil/rbutilqt/base/systeminfo.cpp index fde43d27dd..971a1196ac 100644 --- a/rbutil/rbutilqt/base/systeminfo.cpp +++ b/rbutil/rbutilqt/base/systeminfo.cpp @@ -159,11 +159,11 @@ QMap SystemInfo::languages(void) } -QMap SystemInfo::usbIdMap(enum MapType type) +QMap SystemInfo::usbIdMap(enum MapType type) { ensureSystemInfoExists(); - QMap map; + QMap map; // get a list of ID -> target name QStringList platforms; systemInfos->beginGroup("platforms"); @@ -191,9 +191,18 @@ QMap 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; -- cgit v1.2.3