udev: rules: improve usb integration detection#40899
Open
howl wants to merge 1 commit intosystemd:mainfrom
Open
udev: rules: improve usb integration detection#40899howl wants to merge 1 commit intosystemd:mainfrom
howl wants to merge 1 commit intosystemd:mainfrom
Conversation
usb hubs tend to expose removable attribute as unknown. This makes some problems like a hub for external usb ports in pogo pins is unknown and also soldered hubs in laptops for keyboard+touchpad. Let's set internal when the device removable attribute is fixed and external when removable, but when it's unknown lets check the main device (not the port devnum=0) attribute to decide. This makes us to missdetect pogo ping connected external usb hubs but let us to correctly detect laptop internal keyboards and touchpads that are wired through hubs instead directly. This behaviour is more desirable, as actually there are a bunch of laptops with this setup. Fixes: a4381ca.
3da2486 to
af928ef
Compare
yuwata
requested changes
Mar 2, 2026
Comment on lines
+17
to
+20
| DRIVERS=="usb", ATTRS{maxchild}=="0", ATTRS{removable}=="fixed", ENV{ID_INTEGRATION}="internal", GOTO="libinput_integration_compat" | ||
| DRIVERS=="usb", ATTRS{maxchild}=="0", ATTRS{removable}=="removable", ENV{ID_INTEGRATION}="external", GOTO="libinput_integration_compat" | ||
| DRIVERS=="usb", ATTRS{devnum}!="1", ATTRS{removable}=="fixed", ENV{ID_INTEGRATION}="internal", GOTO="libinput_integration_compat" | ||
| DRIVERS=="usb", ATTRS{devnum}!="1", ATTRS{removable}=="removable|unknown", ENV{ID_INTEGRATION}="external" |
Member
There was a problem hiding this comment.
Please use GOTO="usb_integration_end", or drop LABEL="usb_integration_end".
Maybe better to also set GOTO for the last line for consistency? Though that's redundant of course.
From the commit message, the latter two lines should be ATTRS{devnum}!="0" rather than "1"?? First of all, what is the devnum attribute?
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.
This fix arise from https://gitlab.freedesktop.org/libinput/libinput/-/issues/1255, a laptop that have internal usb keyboard wired to a internal usb hub instead directly to the port. While the port itself is tagged as fixed, the hub is unknown.
usb hubs tend to expose removable attribute as unknown. This makes some problems like a hub for external usb ports in pogo pins is unknown and also soldered hubs in laptops for keyboard+touchpad.
Let's set internal when the device removable attribute is fixed and external when removable, but when it's unknown lets check the main device (not the port devnum=0) attribute to decide.
This makes us to missdetect pogo ping connected external usb hubs but let us to correctly detect laptop internal keyboards and touchpads that are wired through hubs instead directly.
This behaviour is more desirable, as actually there are a bunch of laptops with this setup.
Fixes: a4381ca.