Index: device/hid/hid_connection_linux.cc |
diff --git a/device/hid/hid_connection_linux.cc b/device/hid/hid_connection_linux.cc |
index 503a3c55fb9f24f126681b122e9ce2577313f4be..936c7b1bd23fe95a13c2fd29453fe2119ab59089 100644 |
--- a/device/hid/hid_connection_linux.cc |
+++ b/device/hid/hid_connection_linux.cc |
@@ -232,8 +232,11 @@ bool HidConnectionLinux::FindHidrawDevNode(udev_device* parent, |
std::string device_path = udev_device_get_devpath(hid_dev.get()); |
if (raw_path && |
!device_path.compare(0, parent_path.length(), parent_path)) { |
- *result = raw_path; |
- return true; |
+ std::string sub_path = device_path.substr(parent_path.length()); |
+ if (sub_path.substr(0, sizeof(kHidrawSubsystem)-1) == kHidrawSubsystem) { |
+ *result = raw_path; |
+ return true; |
+ } |
} |
} |
@@ -241,3 +244,4 @@ bool HidConnectionLinux::FindHidrawDevNode(udev_device* parent, |
} |
} // namespace device |
+ |