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

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

Issue 223803002: HID connection matches wrong hidraw devnode to HID device when a bus driver is present on Linux (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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_connection_linux.h" 5 #include "device/hid/hid_connection_linux.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <libudev.h> 9 #include <libudev.h>
10 #include <linux/hidraw.h> 10 #include <linux/hidraw.h>
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 parent_path += '/'; 225 parent_path += '/';
226 udev_list_entry* devices = udev_enumerate_get_list_entry(enumerate.get()); 226 udev_list_entry* devices = udev_enumerate_get_list_entry(enumerate.get());
227 for (udev_list_entry* i = devices; i != NULL; 227 for (udev_list_entry* i = devices; i != NULL;
228 i = udev_list_entry_get_next(i)) { 228 i = udev_list_entry_get_next(i)) {
229 ScopedUdevDevicePtr hid_dev( 229 ScopedUdevDevicePtr hid_dev(
230 udev_device_new_from_syspath(udev, udev_list_entry_get_name(i))); 230 udev_device_new_from_syspath(udev, udev_list_entry_get_name(i)));
231 const char* raw_path = udev_device_get_devnode(hid_dev.get()); 231 const char* raw_path = udev_device_get_devnode(hid_dev.get());
232 std::string device_path = udev_device_get_devpath(hid_dev.get()); 232 std::string device_path = udev_device_get_devpath(hid_dev.get());
233 if (raw_path && 233 if (raw_path &&
234 !device_path.compare(0, parent_path.length(), parent_path)) { 234 !device_path.compare(0, parent_path.length(), parent_path)) {
235 *result = raw_path; 235 std::string sub_path = device_path.substr(parent_path.length());
236 return true; 236 if (sub_path.substr(0, sizeof(kHidrawSubsystem)-1) == kHidrawSubsystem) {
237 *result = raw_path;
238 return true;
239 }
237 } 240 }
238 } 241 }
239 242
240 return false; 243 return false;
241 } 244 }
242 245
243 } // namespace device 246 } // namespace device
247
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698