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 "build/build_config.h" |
5 #include "device/hid/hid_device_info.h" | 6 #include "device/hid/hid_device_info.h" |
6 #include "device/hid/hid_report_descriptor.h" | 7 #include "device/hid/hid_report_descriptor.h" |
7 | 8 |
8 namespace device { | 9 namespace device { |
9 | 10 |
10 #if !defined(OS_MACOSX) | 11 #if !defined(OS_MACOSX) |
11 const char kInvalidHidDeviceId[] = ""; | 12 const char kInvalidHidDeviceId[] = ""; |
12 #endif | 13 #endif |
13 | 14 |
14 HidDeviceInfo::HidDeviceInfo(const HidDeviceId& device_id, | 15 HidDeviceInfo::HidDeviceInfo(const HidDeviceId& device_id, |
15 uint16_t vendor_id, | 16 uint16_t vendor_id, |
16 uint16_t product_id, | 17 uint16_t product_id, |
17 const std::string& product_name, | 18 const std::string& product_name, |
18 const std::string& serial_number, | 19 const std::string& serial_number, |
19 HidBusType bus_type, | 20 HidBusType bus_type, |
20 const std::vector<uint8> report_descriptor) | 21 const std::vector<uint8_t> report_descriptor) |
21 : device_id_(device_id), | 22 : device_id_(device_id), |
22 vendor_id_(vendor_id), | 23 vendor_id_(vendor_id), |
23 product_id_(product_id), | 24 product_id_(product_id), |
24 product_name_(product_name), | 25 product_name_(product_name), |
25 serial_number_(serial_number), | 26 serial_number_(serial_number), |
26 bus_type_(bus_type), | 27 bus_type_(bus_type), |
27 report_descriptor_(report_descriptor) { | 28 report_descriptor_(report_descriptor) { |
28 HidReportDescriptor descriptor_parser(report_descriptor_); | 29 HidReportDescriptor descriptor_parser(report_descriptor_); |
29 descriptor_parser.GetDetails( | 30 descriptor_parser.GetDetails( |
30 &collections_, &has_report_id_, &max_input_report_size_, | 31 &collections_, &has_report_id_, &max_input_report_size_, |
(...skipping 19 matching lines...) Expand all Loading... |
50 max_input_report_size_(max_input_report_size), | 51 max_input_report_size_(max_input_report_size), |
51 max_output_report_size_(max_output_report_size), | 52 max_output_report_size_(max_output_report_size), |
52 max_feature_report_size_(max_feature_report_size) { | 53 max_feature_report_size_(max_feature_report_size) { |
53 collections_.push_back(collection); | 54 collections_.push_back(collection); |
54 has_report_id_ = !collection.report_ids.empty(); | 55 has_report_id_ = !collection.report_ids.empty(); |
55 } | 56 } |
56 | 57 |
57 HidDeviceInfo::~HidDeviceInfo() {} | 58 HidDeviceInfo::~HidDeviceInfo() {} |
58 | 59 |
59 } // namespace device | 60 } // namespace device |
OLD | NEW |