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

Side by Side Diff: device/usb/usb_device_handle_impl.cc

Issue 1265833005: Get all the UsbConfigDescriptor for the device configuration (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updated chromeos related code again Created 5 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "device/usb/usb_device_handle_impl.h" 5 #include "device/usb/usb_device_handle_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 if (rv != LIBUSB_SUCCESS) { 769 if (rv != LIBUSB_SUCCESS) {
770 USB_LOG(EVENT) << "Failed to reset device: " 770 USB_LOG(EVENT) << "Failed to reset device: "
771 << ConvertPlatformUsbErrorToString(rv); 771 << ConvertPlatformUsbErrorToString(rv);
772 } 772 }
773 task_runner_->PostTask(FROM_HERE, base::Bind(callback, rv == LIBUSB_SUCCESS)); 773 task_runner_->PostTask(FROM_HERE, base::Bind(callback, rv == LIBUSB_SUCCESS));
774 } 774 }
775 775
776 void UsbDeviceHandleImpl::RefreshEndpointMap() { 776 void UsbDeviceHandleImpl::RefreshEndpointMap() {
777 DCHECK(thread_checker_.CalledOnValidThread()); 777 DCHECK(thread_checker_.CalledOnValidThread());
778 endpoint_map_.clear(); 778 endpoint_map_.clear();
779 const UsbConfigDescriptor* config = device_->GetConfiguration(); 779 const UsbConfigDescriptor* config = device_->GetCurrentConfiguration();
780 if (config) { 780 if (config) {
781 for (const auto& map_entry : claimed_interfaces_) { 781 for (const auto& map_entry : claimed_interfaces_) {
782 int interface_number = map_entry.first; 782 int interface_number = map_entry.first;
783 const scoped_refptr<InterfaceClaimer>& claimed_iface = map_entry.second; 783 const scoped_refptr<InterfaceClaimer>& claimed_iface = map_entry.second;
784 784
785 for (const UsbInterfaceDescriptor& iface : config->interfaces) { 785 for (const UsbInterfaceDescriptor& iface : config->interfaces) {
786 if (iface.interface_number == interface_number && 786 if (iface.interface_number == interface_number &&
787 iface.alternate_setting == claimed_iface->alternate_setting()) { 787 iface.alternate_setting == claimed_iface->alternate_setting()) {
788 for (const UsbEndpointDescriptor& endpoint : iface.endpoints) { 788 for (const UsbEndpointDescriptor& endpoint : iface.endpoints) {
789 endpoint_map_[endpoint.address] = interface_number; 789 endpoint_map_[endpoint.address] = interface_number;
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
978 // Attempt-release all the interfaces. 978 // Attempt-release all the interfaces.
979 // It will be retained until the transfer cancellation is finished. 979 // It will be retained until the transfer cancellation is finished.
980 claimed_interfaces_.clear(); 980 claimed_interfaces_.clear();
981 981
982 // Cannot close device handle here. Need to wait for libusb_cancel_transfer to 982 // Cannot close device handle here. Need to wait for libusb_cancel_transfer to
983 // finish. 983 // finish.
984 device_ = NULL; 984 device_ = NULL;
985 } 985 }
986 986
987 } // namespace device 987 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698