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

Unified Diff: device/usb/usb_device_filter.cc

Issue 1337413003: Match against all configurations in UsbDeviceFilter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
Index: device/usb/usb_device_filter.cc
diff --git a/device/usb/usb_device_filter.cc b/device/usb/usb_device_filter.cc
index 796b514e2348d8853143f135fc707c9f3ebc9868..a83d12c88e847ecb21e451ac5dcabdd611c82855 100644
--- a/device/usb/usb_device_filter.cc
+++ b/device/usb/usb_device_filter.cc
@@ -68,29 +68,24 @@ bool UsbDeviceFilter::Matches(scoped_refptr<UsbDevice> device) const {
}
if (interface_class_set_) {
- const UsbConfigDescriptor* config = device->GetActiveConfiguration();
- 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.
-
bool foundMatch = false;
- for (const UsbInterfaceDescriptor& iface : config->interfaces) {
- if (iface.interface_class == interface_class_ &&
- (!interface_subclass_set_ ||
- (iface.interface_subclass == interface_subclass_ &&
- (!interface_protocol_set_ ||
- iface.interface_protocol == interface_protocol_)))) {
- foundMatch = true;
+ for (const UsbConfigDescriptor& config : device->configurations()) {
+ for (const UsbInterfaceDescriptor& iface : config.interfaces) {
+ if (iface.interface_class == interface_class_ &&
+ (!interface_subclass_set_ ||
+ (iface.interface_subclass == interface_subclass_ &&
+ (!interface_protocol_set_ ||
+ iface.interface_protocol == interface_protocol_)))) {
Ken Rockot(use gerrit already) 2015/09/15 17:40:09 I think foundMatch is unnecessary, and you can jus
Reilly Grant (use Gerrit) 2015/09/15 17:45:54 Done.
+ foundMatch = true;
+ break;
+ }
}
+ if (foundMatch)
+ break;
}
- if (!foundMatch) {
+ if (!foundMatch)
return false;
- }
}
return true;

Powered by Google App Engine
This is Rietveld 408576698