summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt/base/system.cpp
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2013-09-16 22:05:43 +0200
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2013-09-18 23:37:39 +0200
commitf3b56eba58780df99a00646aaf9064761cb46635 (patch)
treedafb4137c48dc30228522110d9c46bf5cbbeda1f /rbutil/rbutilqt/base/system.cpp
parent935c7fbff741349b4ecebda212a870a31c8cb97d (diff)
downloadrockbox-f3b56eba58780df99a00646aaf9064761cb46635.tar.gz
rockbox-f3b56eba58780df99a00646aaf9064761cb46635.zip
Handle multiple devices with identical USB IDs correctly when listing.
Use insertMulti() instead of insert() when adding found USB devices to the list. This means the keys of the list will now be ambiguous. This is not a problem since the value is only used to display the user a nice string. Previously we'd loose two identical devices attached to the system since the second one would overwrite the first. This does not apply for Windows, since Windows will list each function of a composite device. This results in a device running Rockbox (with HID enabled) showing up twice, which isn't wanted. Change-Id: I1306b71122a210c55871ff8e14d2b5a04012cc4e
Diffstat (limited to 'rbutil/rbutilqt/base/system.cpp')
-rw-r--r--rbutil/rbutilqt/base/system.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/rbutil/rbutilqt/base/system.cpp b/rbutil/rbutilqt/base/system.cpp
index ffd667995a..fd3b04e338 100644
--- a/rbutil/rbutilqt/base/system.cpp
+++ b/rbutil/rbutilqt/base/system.cpp
@@ -276,7 +276,7 @@ QMap<uint32_t, QString> System::listUsbDevices(void)
276 if(name.isEmpty()) 276 if(name.isEmpty())
277 name = tr("(no description available)"); 277 name = tr("(no description available)");
278 if(id) { 278 if(id) {
279 usbids.insert(id, name); 279 usbids.insertMulti(id, name);
280 qDebug("[System] USB: 0x%08x, %s", id, name.toLocal8Bit().data()); 280 qDebug("[System] USB: 0x%08x, %s", id, name.toLocal8Bit().data());
281 } 281 }
282 } 282 }
@@ -322,7 +322,7 @@ QMap<uint32_t, QString> System::listUsbDevices(void)
322 if(name.isEmpty()) name = tr("(no description available)"); 322 if(name.isEmpty()) name = tr("(no description available)");
323 323
324 if(id) { 324 if(id) {
325 usbids.insert(id, name); 325 usbids.insertMulti(id, name);
326 qDebug() << "[System] USB:" << QString("0x%1").arg(id, 8, 16) << name; 326 qDebug() << "[System] USB:" << QString("0x%1").arg(id, 8, 16) << name;
327 } 327 }
328 u = u->next; 328 u = u->next;
@@ -403,7 +403,7 @@ QMap<uint32_t, QString> System::listUsbDevices(void)
403 } 403 }
404 404
405 if(id) { 405 if(id) {
406 usbids.insert(id, name); 406 usbids.insertMulti(id, name);
407 qDebug() << "[System] USB:" << QString("0x%1").arg(id, 8, 16) << name; 407 qDebug() << "[System] USB:" << QString("0x%1").arg(id, 8, 16) << name;
408 } 408 }
409 409