Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(387)

Side by Side Diff: device/hid/hid_service_linux.cc

Issue 317783010: chrome.hid: enrich model with report IDs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Enrich JavaScript model (no incoming report filter) Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698