From f3b56eba58780df99a00646aaf9064761cb46635 Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Mon, 16 Sep 2013 22:05:43 +0200 Subject: 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 --- rbutil/rbutilqt/base/system.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'rbutil/rbutilqt') 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 System::listUsbDevices(void) if(name.isEmpty()) name = tr("(no description available)"); if(id) { - usbids.insert(id, name); + usbids.insertMulti(id, name); qDebug("[System] USB: 0x%08x, %s", id, name.toLocal8Bit().data()); } } @@ -322,7 +322,7 @@ QMap System::listUsbDevices(void) if(name.isEmpty()) name = tr("(no description available)"); if(id) { - usbids.insert(id, name); + usbids.insertMulti(id, name); qDebug() << "[System] USB:" << QString("0x%1").arg(id, 8, 16) << name; } u = u->next; @@ -403,7 +403,7 @@ QMap System::listUsbDevices(void) } if(id) { - usbids.insert(id, name); + usbids.insertMulti(id, name); qDebug() << "[System] USB:" << QString("0x%1").arg(id, 8, 16) << name; } -- cgit v1.2.3