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