Skip to content

Commit

Permalink
HID connection matches wrong hidraw devnode to HID device when a bus …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
jracle@logitech.com committed Apr 3, 2014
1 parent 17f2ec7 commit 36c936a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions device/hid/hid_connection_linux.cc
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,16 @@ 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;
}
}
}

return false;
}

} // namespace device

0 comments on commit 36c936a

Please sign in to comment.