Skip to content

udev: rules: improve usb integration detection#40899

Open
howl wants to merge 1 commit intosystemd:mainfrom
howl:integration-improve
Open

udev: rules: improve usb integration detection#40899
howl wants to merge 1 commit intosystemd:mainfrom
howl:integration-improve

Conversation

@howl
Copy link
Contributor

@howl howl commented Mar 1, 2026

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.

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.
@github-actions github-actions bot added udev please-review PR is ready for (re-)review by a maintainer labels Mar 1, 2026
@howl howl force-pushed the integration-improve branch from 3da2486 to af928ef Compare March 1, 2026 19:06
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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@yuwata yuwata added reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks and removed please-review PR is ready for (re-)review by a maintainer labels Mar 2, 2026
@yuwata yuwata added this to the v260 milestone Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-critical reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks udev

Development

Successfully merging this pull request may close these issues.

2 participants