Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2704)

Unified Diff: device/serial/serial_device_enumerator_win.cc

Issue 1851673006: Fix serial device PID and VID parsing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/serial/serial_device_enumerator_win.cc
diff --git a/device/serial/serial_device_enumerator_win.cc b/device/serial/serial_device_enumerator_win.cc
index 2e83fd6f96332c2cb99d4c4be04e9a29069c9b70..e94564c5a71febfcce6a027f85901a9524a4c311 100644
--- a/device/serial/serial_device_enumerator_win.cc
+++ b/device/serial/serial_device_enumerator_win.cc
@@ -66,7 +66,7 @@ bool GetDisplayName(const std::string friendly_name,
// vendor_id, and returns whether the operation was successful.
bool GetVendorID(const std::string hardware_id, uint32_t* vendor_id) {
std::string vendor_id_str;
- return RE2::PartialMatch(hardware_id, "VID_([0-9]+)", &vendor_id_str) &&
+ return RE2::PartialMatch(hardware_id, "VID_([0-9a-fA-F]+)", &vendor_id_str) &&
base::HexStringToUInt(vendor_id_str, vendor_id);
}
@@ -74,7 +74,8 @@ bool GetVendorID(const std::string hardware_id, uint32_t* vendor_id) {
// product_id, and returns whether the operation was successful.
bool GetProductID(const std::string hardware_id, uint32_t* product_id) {
std::string product_id_str;
- return RE2::PartialMatch(hardware_id, "PID_([0-9]+)", &product_id_str) &&
+ return RE2::PartialMatch(hardware_id, "PID_([0-9a-fA-F]+)",
+ &product_id_str) &&
base::HexStringToUInt(product_id_str, product_id);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698