Commit 36c936af authored by jracle@logitech.com's avatar jracle@logitech.com

HID connection matches wrong hidraw devnode to HID device when a bus driver is present on Linux

Fix : HidConnectionLinux::FindHidrawDevNode should look for presence of
"hidraw" string immediately after matching parent udev path, so that we
do not match devnodes created by bus enumerator driver

BUG=358666
TBR=rockot@chromium.org

Review URL: https://codereview.chromium.org/223803002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@261502 0039d316-1c4b-4281-b951-d872f2087c98
parent 17f2ec7d
...@@ -232,8 +232,11 @@ bool HidConnectionLinux::FindHidrawDevNode(udev_device* parent, ...@@ -232,8 +232,11 @@ bool HidConnectionLinux::FindHidrawDevNode(udev_device* parent,
std::string device_path = udev_device_get_devpath(hid_dev.get()); std::string device_path = udev_device_get_devpath(hid_dev.get());
if (raw_path && if (raw_path &&
!device_path.compare(0, parent_path.length(), parent_path)) { !device_path.compare(0, parent_path.length(), parent_path)) {
*result = raw_path; std::string sub_path = device_path.substr(parent_path.length());
return true; if (sub_path.substr(0, sizeof(kHidrawSubsystem)-1) == kHidrawSubsystem) {
*result = raw_path;
return true;
}
} }
} }
...@@ -241,3 +244,4 @@ bool HidConnectionLinux::FindHidrawDevNode(udev_device* parent, ...@@ -241,3 +244,4 @@ bool HidConnectionLinux::FindHidrawDevNode(udev_device* parent,
} }
} // namespace device } // namespace device
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment