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

Unified Diff: device/usb/usb_device_filter.cc

Issue 826283002: Add support for sending a USB SET_CONFIGURATION request. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
Index: device/usb/usb_device_filter.cc
diff --git a/device/usb/usb_device_filter.cc b/device/usb/usb_device_filter.cc
index 2d3f157a1c29c61706f8e0b1136d086b5883ef4b..970bbd041b17c2dc05d1f39f3278dda50d09e8aa 100644
--- a/device/usb/usb_device_filter.cc
+++ b/device/usb/usb_device_filter.cc
@@ -68,21 +68,22 @@ bool UsbDeviceFilter::Matches(scoped_refptr<UsbDevice> device) const {
}
if (interface_class_set_) {
- bool foundMatch = false;
- const UsbConfigDescriptor& config = device->GetConfiguration();
+ const UsbConfigDescriptor* config = device->GetConfiguration();
+ if (!config) {
+ return false;
+ }
// TODO(reillyg): Check device configuration if the class is not defined at
// a per-interface level. This is not really important because most devices
// have per-interface classes. The only counter-examples I know of are hubs.
- for (UsbInterfaceDescriptor::Iterator ifaceIt = config.interfaces.begin();
- ifaceIt != config.interfaces.end() && !foundMatch;
- ++ifaceIt) {
- if (ifaceIt->interface_class == interface_class_ &&
+ bool foundMatch = false;
+ for (const UsbInterfaceDescriptor& iface : config->interfaces) {
+ if (iface.interface_class == interface_class_ &&
(!interface_subclass_set_ ||
- (ifaceIt->interface_subclass == interface_subclass_ &&
+ (iface.interface_subclass == interface_subclass_ &&
(!interface_protocol_set_ ||
- ifaceIt->interface_protocol == interface_protocol_)))) {
+ iface.interface_protocol == interface_protocol_)))) {
foundMatch = true;
}
}

Powered by Google App Engine
This is Rietveld 408576698