| OLD | NEW |
| 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_descriptors.h" | 5 #include "device/usb/usb_descriptors.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 callback.Run(std::move(desc)); | 142 callback.Run(std::move(desc)); |
| 143 return; | 143 return; |
| 144 } | 144 } |
| 145 | 145 |
| 146 uint8_t num_configurations = desc->num_configurations; | 146 uint8_t num_configurations = desc->num_configurations; |
| 147 UsbDeviceDescriptor* desc_ptr = desc.get(); | 147 UsbDeviceDescriptor* desc_ptr = desc.get(); |
| 148 base::Closure closure = base::BarrierClosure( | 148 base::Closure closure = base::BarrierClosure( |
| 149 num_configurations, | 149 num_configurations, |
| 150 base::Bind(OnDoneReadingConfigDescriptors, device_handle, | 150 base::Bind(OnDoneReadingConfigDescriptors, device_handle, |
| 151 base::Passed(&desc), callback)); | 151 base::Passed(&desc), callback)); |
| 152 for (uint8_t i = 1; i <= num_configurations; ++i) { | 152 for (uint8_t i = 0; i < num_configurations; ++i) { |
| 153 scoped_refptr<IOBufferWithSize> header = new IOBufferWithSize(4); | 153 scoped_refptr<IOBufferWithSize> header = new IOBufferWithSize(4); |
| 154 device_handle->ControlTransfer( | 154 device_handle->ControlTransfer( |
| 155 USB_DIRECTION_INBOUND, UsbDeviceHandle::STANDARD, | 155 USB_DIRECTION_INBOUND, UsbDeviceHandle::STANDARD, |
| 156 UsbDeviceHandle::DEVICE, kGetDescriptorRequest, | 156 UsbDeviceHandle::DEVICE, kGetDescriptorRequest, |
| 157 kConfigurationDescriptorType << 8 | i, 0, header, header->size(), | 157 kConfigurationDescriptorType << 8 | i, 0, header, header->size(), |
| 158 kControlTransferTimeout, | 158 kControlTransferTimeout, |
| 159 base::Bind(&OnReadConfigDescriptorHeader, device_handle, desc_ptr, i, | 159 base::Bind(&OnReadConfigDescriptorHeader, device_handle, desc_ptr, i, |
| 160 closure)); | 160 closure)); |
| 161 } | 161 } |
| 162 } | 162 } |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 callback.Run(std::move(index_map)); | 518 callback.Run(std::move(index_map)); |
| 519 return; | 519 return; |
| 520 } | 520 } |
| 521 | 521 |
| 522 ReadStringDescriptor(device_handle, 0, 0, | 522 ReadStringDescriptor(device_handle, 0, 0, |
| 523 base::Bind(&OnReadLanguageIds, device_handle, | 523 base::Bind(&OnReadLanguageIds, device_handle, |
| 524 base::Passed(&index_map), callback)); | 524 base::Passed(&index_map), callback)); |
| 525 } | 525 } |
| 526 | 526 |
| 527 } // namespace device | 527 } // namespace device |
| OLD | NEW |