| 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.GetDetails(&device_info.collections, |
| 151 &device_info.max_input_report_size, |
| 152 &device_info.max_output_report_size, |
| 153 &device_info.max_feature_report_size); |
| 151 | 154 |
| 152 AddDevice(device_info); | 155 AddDevice(device_info); |
| 153 } | 156 } |
| 154 | 157 |
| 155 void HidServiceLinux::OnDeviceRemoved(udev_device* device) { | 158 void HidServiceLinux::OnDeviceRemoved(udev_device* device) { |
| 156 const char* device_path = udev_device_get_syspath(device);; | 159 const char* device_path = udev_device_get_syspath(device);; |
| 157 if (device_path) | 160 if (device_path) |
| 158 RemoveDevice(device_path); | 161 RemoveDevice(device_path); |
| 159 } | 162 } |
| 160 | 163 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 *result = raw_path; | 195 *result = raw_path; |
| 193 return true; | 196 return true; |
| 194 } | 197 } |
| 195 } | 198 } |
| 196 } | 199 } |
| 197 | 200 |
| 198 return false; | 201 return false; |
| 199 } | 202 } |
| 200 | 203 |
| 201 } // namespace device | 204 } // namespace device |
| OLD | NEW |