summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt/base/autodetection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'rbutil/rbutilqt/base/autodetection.cpp')
-rw-r--r--rbutil/rbutilqt/base/autodetection.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/rbutil/rbutilqt/base/autodetection.cpp b/rbutil/rbutilqt/base/autodetection.cpp
index 58e844b4c3..63ed9ad9ff 100644
--- a/rbutil/rbutilqt/base/autodetection.cpp
+++ b/rbutil/rbutilqt/base/autodetection.cpp
@@ -19,7 +19,6 @@
19#include <QtCore> 19#include <QtCore>
20#include "autodetection.h" 20#include "autodetection.h"
21#include "rbsettings.h" 21#include "rbsettings.h"
22#include "systeminfo.h"
23#include "playerbuildinfo.h" 22#include "playerbuildinfo.h"
24 23
25#include "../ipodpatcher/ipodpatcher.h" 24#include "../ipodpatcher/ipodpatcher.h"
@@ -82,30 +81,25 @@ bool Autodetection::detect(void)
82 */ 81 */
83void Autodetection::detectUsb() 82void Autodetection::detectUsb()
84{ 83{
85 // usbids holds the mapping in the form
86 // ((VID<<16)|(PID)), targetname
87 // the ini file needs to hold the IDs as hex values.
88 QMap<int, QStringList> usbids = SystemInfo::usbIdMap(SystemInfo::MapDevice);
89 QMap<int, QStringList> usberror = SystemInfo::usbIdMap(SystemInfo::MapError);
90
91 // usb pid detection 84 // usb pid detection
92 QList<uint32_t> attached; 85 QList<uint32_t> attached;
93 attached = System::listUsbIds(); 86 attached = System::listUsbIds();
94 87
95 int i = attached.size(); 88 int i = attached.size();
96 while(i--) { 89 while(i--) {
97 if(usbids.contains(attached.at(i))) { 90 QStringList a = PlayerBuildInfo::instance()->value(PlayerBuildInfo::UsbIdTargetList, attached.at(i)).toStringList();
98 // we found a USB device that might be ambiguous. 91 if(a.size() > 0) {
99 struct Detected d; 92 struct Detected d;
100 d.status = PlayerOk; 93 d.status = PlayerOk;
101 d.usbdevices = usbids.value(attached.at(i)); 94 d.usbdevices = a;
102 m_detected.append(d); 95 m_detected.append(d);
103 LOG_INFO() << "[USB] detected supported player" << d.usbdevices; 96 LOG_INFO() << "[USB] detected supported player" << d.usbdevices;
104 } 97 }
105 if(usberror.contains(attached.at(i))) { 98 QStringList b = PlayerBuildInfo::instance()->value(PlayerBuildInfo::UsbIdErrorList, attached.at(i)).toStringList();
99 if(b.size() > 0) {
106 struct Detected d; 100 struct Detected d;
107 d.status = PlayerMtpMode; 101 d.status = PlayerMtpMode;
108 d.device = usberror.value(attached.at(i)).at(0); 102 d.usbdevices = b;
109 m_detected.append(d); 103 m_detected.append(d);
110 LOG_WARNING() << "[USB] detected problem with player" << d.device; 104 LOG_WARNING() << "[USB] detected problem with player" << d.device;
111 } 105 }