OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <iterator> | 7 #include <iterator> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "device/usb/webusb_descriptors.h" | 10 #include "device/usb/webusb_descriptors.h" |
11 | 11 |
12 namespace device { | 12 namespace device { |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 // These constants are defined by the Universal Serial Device 3.0 Specification | 16 // These constants are defined by the Universal Serial Device 3.0 Specification |
17 // Revision 1.0. | 17 // Revision 1.0. |
18 const uint8_t kBosDescriptorType = 0x0F; | 18 const uint8_t kBosDescriptorType = 0x0F; |
19 const uint8_t kDeviceCapabilityDescriptorType = 0x10; | 19 const uint8_t kDeviceCapabilityDescriptorType = 0x10; |
20 | 20 |
21 const uint8_t kPlatformDevCapabilityType = 0x05; | 21 const uint8_t kPlatformDevCapabilityType = 0x05; |
22 | 22 |
23 // These constants are defined by the WebUSB specification: | 23 // These constants are defined by the WebUSB specification: |
24 // http://reillyeon.github.io/webusb/ | 24 // http://wicg.github.io/webusb/ |
25 const uint8_t kWebUsbCapabilityUUID[16] = { | 25 const uint8_t kWebUsbCapabilityUUID[16] = { |
26 // Little-endian encoding of {3408b638-09a9-47a0-8bfd-a0768815b665}. | 26 // Little-endian encoding of {3408b638-09a9-47a0-8bfd-a0768815b665}. |
27 0x38, 0xB6, 0x08, 0x34, 0xA9, 0x09, 0xA0, 0x47, | 27 0x38, 0xB6, 0x08, 0x34, 0xA9, 0x09, 0xA0, 0x47, |
28 0x8B, 0xFD, 0xA0, 0x76, 0x88, 0x15, 0xB6, 0x65}; | 28 0x8B, 0xFD, 0xA0, 0x76, 0x88, 0x15, 0xB6, 0x65}; |
29 | 29 |
30 const uint8_t kDescriptorSetDescriptorType = 0x00; | 30 const uint8_t kDescriptorSetDescriptorType = 0x00; |
31 const uint8_t kConfigurationSubsetDescriptorType = 0x01; | 31 const uint8_t kConfigurationSubsetDescriptorType = 0x01; |
32 const uint8_t kFunctionSubsetDescriptorType = 0x02; | 32 const uint8_t kFunctionSubsetDescriptorType = 0x02; |
33 const uint8_t kUrlDescriptorType = 0x03; | 33 const uint8_t kUrlDescriptorType = 0x03; |
34 | 34 |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 } | 295 } |
296 uint8_t length = bytes[0]; | 296 uint8_t length = bytes[0]; |
297 if (length != bytes.size() || bytes[1] != kUrlDescriptorType) { | 297 if (length != bytes.size() || bytes[1] != kUrlDescriptorType) { |
298 return false; | 298 return false; |
299 } | 299 } |
300 std::vector<uint8_t>::const_iterator it = bytes.begin(); | 300 std::vector<uint8_t>::const_iterator it = bytes.begin(); |
301 return ParseUrl(output, &it, bytes.end()); | 301 return ParseUrl(output, &it, bytes.end()); |
302 } | 302 } |
303 | 303 |
304 } // namespace device | 304 } // namespace device |
OLD | NEW |