Chromium Code Reviews| 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; |