diff options
author | Cástor Muñoz <cmvidal@gmail.com> | 2015-12-20 12:25:41 +0100 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2015-12-20 12:25:41 +0100 |
commit | ad65f8cc71bfe9e98936d5f781263850a9d50cc0 (patch) | |
tree | 6110cb2fe7ac348be488822d103c69d516e63f68 /rbutil/rbutilqt/base | |
parent | 7d7359ae6388dfd5b629422eb6bd40e2b55abfa5 (diff) | |
download | rockbox-ad65f8cc71bfe9e98936d5f781263850a9d50cc0.tar.gz rockbox-ad65f8cc71bfe9e98936d5f781263850a9d50cc0.zip |
Handle mixed case in Windows USB ID detection.
Windows XP might use mixed case in hardware ID (VID / PID) string.
Cherry-picked from G#1221.
Change-Id: I86fa63e050cd9b9de5a1beac65b81028e0f86a9d
Signed-off-by: Dominik Riebeling <Dominik.Riebeling@gmail.com>
Diffstat (limited to 'rbutil/rbutilqt/base')
-rw-r--r-- | rbutil/rbutilqt/base/system.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/rbutil/rbutilqt/base/system.cpp b/rbutil/rbutilqt/base/system.cpp index 855d9e3b06..3e3f18fd81 100644 --- a/rbutil/rbutilqt/base/system.cpp +++ b/rbutil/rbutilqt/base/system.cpp | |||
@@ -467,9 +467,10 @@ QMap<uint32_t, QString> System::listUsbDevices(void) | |||
467 | 467 | ||
468 | if(buffer) { | 468 | if(buffer) { |
469 | // convert buffer text to upper case to avoid depending on the case of | 469 | // convert buffer text to upper case to avoid depending on the case of |
470 | // the keys (W7 uses different casing than XP at least). | 470 | // the keys (W7 uses different casing than XP at least), in addition |
471 | QString data = QString::fromWCharArray(buffer); | 471 | // XP may use "Vid_" and "Pid_". |
472 | QRegExp rex("USB\\\\VID_([0-9a-fA-F]{4})&PID_([0-9a-fA-F]{4}).*"); | 472 | QString data = QString::fromWCharArray(buffer).toUpper(); |
473 | QRegExp rex("USB\\\\VID_([0-9A-F]{4})&PID_([0-9A-F]{4}).*"); | ||
473 | if(rex.indexIn(data) >= 0) { | 474 | if(rex.indexIn(data) >= 0) { |
474 | uint32_t id; | 475 | uint32_t id; |
475 | id = rex.cap(1).toUInt(0, 16) << 16 | rex.cap(2).toUInt(0, 16); | 476 | id = rex.cap(1).toUInt(0, 16) << 16 | rex.cap(2).toUInt(0, 16); |