Index: device/usb/usb_device_handle_impl.cc |
diff --git a/device/usb/usb_device_handle_impl.cc b/device/usb/usb_device_handle_impl.cc |
index 1ae6816983ad9c7586cc308d7f77ec189ffbdf65..ffe5e0f3353d2a4f832ed5390077c80d225689a7 100644 |
--- a/device/usb/usb_device_handle_impl.cc |
+++ b/device/usb/usb_device_handle_impl.cc |
@@ -683,6 +683,17 @@ void UsbDeviceHandleImpl::GenericTransfer(UsbEndpointDirection direction, |
} |
} |
+bool UsbDeviceHandleImpl::FindInterfaceByEndpoint(uint8_t endpoint_address, |
+ uint8_t* interface_number) { |
+ DCHECK(thread_checker_.CalledOnValidThread()); |
+ const auto endpoint_it = endpoint_map_.find(endpoint_address); |
+ if (endpoint_it != endpoint_map_.end()) { |
+ *interface_number = endpoint_it->second.interface_number; |
+ return true; |
+ } |
+ return false; |
+} |
+ |
UsbDeviceHandleImpl::UsbDeviceHandleImpl( |
scoped_refptr<UsbContext> context, |
scoped_refptr<UsbDeviceImpl> device, |
@@ -827,9 +838,10 @@ void UsbDeviceHandleImpl::RefreshEndpointMap() { |
scoped_refptr<UsbDeviceHandleImpl::InterfaceClaimer> |
UsbDeviceHandleImpl::GetClaimedInterfaceForEndpoint(uint8_t endpoint) { |
- if (ContainsKey(endpoint_map_, endpoint)) |
- return claimed_interfaces_[endpoint_map_[endpoint].interface_number]; |
- return NULL; |
+ const auto endpoint_it = endpoint_map_.find(endpoint); |
+ if (endpoint_it != endpoint_map_.end()) |
+ return claimed_interfaces_[endpoint_it->second.interface_number]; |
+ return nullptr; |
} |
void UsbDeviceHandleImpl::ControlTransferInternal( |