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

Side by Side Diff: device/usb/usb_descriptors.h

Issue 1707453002: Reland of Parse USB interface association descriptors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 4 years, 8 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
« no previous file with comments | « no previous file | device/usb/usb_descriptors.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef DEVICE_USB_USB_DESCRIPTORS_H_ 5 #ifndef DEVICE_USB_USB_DESCRIPTORS_H_
6 #define DEVICE_USB_USB_DESCRIPTORS_H_ 6 #define DEVICE_USB_USB_DESCRIPTORS_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 UsbInterfaceDescriptor(const UsbInterfaceDescriptor& other); 80 UsbInterfaceDescriptor(const UsbInterfaceDescriptor& other);
81 ~UsbInterfaceDescriptor(); 81 ~UsbInterfaceDescriptor();
82 82
83 uint8_t interface_number; 83 uint8_t interface_number;
84 uint8_t alternate_setting; 84 uint8_t alternate_setting;
85 uint8_t interface_class; 85 uint8_t interface_class;
86 uint8_t interface_subclass; 86 uint8_t interface_subclass;
87 uint8_t interface_protocol; 87 uint8_t interface_protocol;
88 std::vector<UsbEndpointDescriptor> endpoints; 88 std::vector<UsbEndpointDescriptor> endpoints;
89 std::vector<uint8_t> extra_data; 89 std::vector<uint8_t> extra_data;
90 // First interface of the function to which this interface belongs.
91 uint8_t first_interface;
90 }; 92 };
91 93
92 struct UsbConfigDescriptor { 94 struct UsbConfigDescriptor {
93 UsbConfigDescriptor(uint8_t configuration_value, 95 UsbConfigDescriptor(uint8_t configuration_value,
94 bool self_powered, 96 bool self_powered,
95 bool remote_wakeup, 97 bool remote_wakeup,
96 uint16_t maximum_power); 98 uint16_t maximum_power);
97 UsbConfigDescriptor() = delete; 99 UsbConfigDescriptor() = delete;
98 UsbConfigDescriptor(const UsbConfigDescriptor& other); 100 UsbConfigDescriptor(const UsbConfigDescriptor& other);
99 ~UsbConfigDescriptor(); 101 ~UsbConfigDescriptor();
100 102
103 // Scans through |extra_data| for interface association descriptors and
104 // populates |first_interface| for each interface in this configuration.
105 void AssignFirstInterfaceNumbers();
106
101 uint8_t configuration_value; 107 uint8_t configuration_value;
102 bool self_powered; 108 bool self_powered;
103 bool remote_wakeup; 109 bool remote_wakeup;
104 uint16_t maximum_power; 110 uint16_t maximum_power;
105 std::vector<UsbInterfaceDescriptor> interfaces; 111 std::vector<UsbInterfaceDescriptor> interfaces;
106 std::vector<uint8_t> extra_data; 112 std::vector<uint8_t> extra_data;
107 }; 113 };
108 114
109 bool ParseUsbStringDescriptor(const std::vector<uint8_t>& descriptor, 115 bool ParseUsbStringDescriptor(const std::vector<uint8_t>& descriptor,
110 base::string16* output); 116 base::string16* output);
111 117
112 void ReadUsbStringDescriptors( 118 void ReadUsbStringDescriptors(
113 scoped_refptr<UsbDeviceHandle> device_handle, 119 scoped_refptr<UsbDeviceHandle> device_handle,
114 scoped_ptr<std::map<uint8_t, base::string16>> index_map, 120 scoped_ptr<std::map<uint8_t, base::string16>> index_map,
115 const base::Callback<void(scoped_ptr<std::map<uint8_t, base::string16>>)>& 121 const base::Callback<void(scoped_ptr<std::map<uint8_t, base::string16>>)>&
116 callback); 122 callback);
117 123
118 } // namespace device 124 } // namespace device
119 125
120 #endif // DEVICE_USB_USB_DESCRIPTORS_H_ 126 #endif // DEVICE_USB_USB_DESCRIPTORS_H_
OLDNEW
« no previous file with comments | « no previous file | device/usb/usb_descriptors.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698