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 <linux/hidraw.h> | 5 #include <linux/hidraw.h> |
6 #include <sys/ioctl.h> | 6 #include <sys/ioctl.h> |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 res = ioctl(device_file.GetPlatformFile(), HIDIOCGRDESC, &rpt_desc); | 140 res = ioctl(device_file.GetPlatformFile(), HIDIOCGRDESC, &rpt_desc); |
141 if (res < 0) { | 141 if (res < 0) { |
142 LOG(ERROR) << "HIDIOCGRDESC failed."; | 142 LOG(ERROR) << "HIDIOCGRDESC failed."; |
143 device_file.Close(); | 143 device_file.Close(); |
144 return; | 144 return; |
145 } | 145 } |
146 | 146 |
147 device_file.Close(); | 147 device_file.Close(); |
148 | 148 |
149 HidReportDescriptor report_descriptor(rpt_desc.value, rpt_desc.size); | 149 HidReportDescriptor report_descriptor(rpt_desc.value, rpt_desc.size); |
150 report_descriptor.GetTopLevelCollections(&device_info.usages); | 150 report_descriptor.GetTopLevelCollections( |
| 151 &device_info.collections, |
| 152 &device_info.max_input_report_size, |
| 153 &device_info.max_output_report_size, |
| 154 &device_info.max_feature_report_size); |
151 | 155 |
152 AddDevice(device_info); | 156 AddDevice(device_info); |
153 } | 157 } |
154 | 158 |
155 void HidServiceLinux::OnDeviceRemoved(udev_device* device) { | 159 void HidServiceLinux::OnDeviceRemoved(udev_device* device) { |
156 const char* device_path = udev_device_get_syspath(device);; | 160 const char* device_path = udev_device_get_syspath(device);; |
157 if (device_path) | 161 if (device_path) |
158 RemoveDevice(device_path); | 162 RemoveDevice(device_path); |
159 } | 163 } |
160 | 164 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 *result = raw_path; | 196 *result = raw_path; |
193 return true; | 197 return true; |
194 } | 198 } |
195 } | 199 } |
196 } | 200 } |
197 | 201 |
198 return false; | 202 return false; |
199 } | 203 } |
200 | 204 |
201 } // namespace device | 205 } // namespace device |
OLD | NEW |