Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
With keventd handling input devices, every rule-created
/dev/input/by-id/usb-*link was broken, and the names were missing the USB interface number:Two independent bugs were causing this, fixed with this combined PR.
Issue 1
symlink_add()built the target as one../per/in the link name followed by the basename of the node. That is only right for nodes directly in/dev(disk/by-id/x -> ../../sda). ForSYMLINK+="input/by-id/..."and the node/dev/input/event17it gave../../event17. Any rule-created link to a node in a subdirectory (input/,dri/,snd/, ...) was dangling.The target is now computed relative to the link's directory. Nodes directly in
/devcome out exactly as before. A path that does not fit the buffer is reported instead of truncated.Issue 2
The installed
60-persistent-input.rulesbuilds the name withIn udev,
$attr{}and%s{}read the attribute from the event device and, if it has none, from the parent selected by a precedingKERNELS/SUBSYSTEMS/DRIVERS/ATTRS==key. Herematch_parent_chain()found the USB interface but discarded it, andsubst_value()only looked at the event device, so the number expanded to nothing.The syspath of the matched parent is now remembered and used as a fallback. It is cleared at the start of every rule and again after the rule has been applied, so it cannot leak into the next rule or into the deferred
RUN+=expansion.Testing
usb-X-if-event-kbdusb-X-if02-event-kbdusb-X-event-ifusb-X-event-if01usb-X-event-mouse