65-integration.rules: USB devices behind a monitor's/dock's built-in hub get ID_INTEGRATION=internal
systemd version the issue has been seen with
udev 261.3-1 (Artix Linux package, rule unchanged in current main)
Used distribution
Artix Linux (udev only, dinit as init)
Linux kernel version used
7.2.7-hardened1-1-hardened
CPU architectures issue was seen on
x86_64
Component
udev rule files
Expected behaviour you didn't see
An input device (Logitech USB receiver, 046d:c548) plugged into a USB-C dock gets ID_INTEGRATION=external, because the dock itself is connected to a removable port. When plugged directly into the laptop, it correctly gets external.
Unexpected behaviour you saw
Behind the dock it gets ID_INTEGRATION=internal.
Lenovo ThinkVision T27h-30 monitor with built-in USB-C hub (two nested Realtek RTS5411 hubs, 0bda:5411)
The receiver itself has removable=unknown and maxchild=0, so the first two USB rules don't match. The next rule
DRIVERS=="usb", ATTRS{devpath}!="0", ATTRS{removable}=="fixed", ENV{ID_INTEGRATION}="internal", ...matches the first fixed ancestor (the dock's inner hub). The removable outer hub further up is never considered.
Impact: since libinput 1.32.0 (commit 819e943a, "evdev: use udev's ID_INTEGRATION") the keyboard is treated as an internal keyboard and paired with the lid switch. Any key press while the lid is closed makes libinput report the lid as open, and the compositor (KWin) turns the internal panel back on. A touchpad on such a device could also be treated as internal.
Steps to reproduce the problem
- Connect a USB-C dock that has a built-in hub behind its upstream hub to a laptop (
ThinkPad X13 2-in-1 Gen 5). - Plug a USB input device into the dock.
udevadm info /dev/input/eventX | grep ID_INTEGRATIONshowsinternal.- Plug the same device directly into the laptop:
external.
Additional program output to the terminal or log subsystem illustrating the issue
`udevadm info -a /dev/input/event6`, reduced to the USB devices:
| Device | devpath | maxchild | removable |
|---|---|---|---|
| USB Receiver | 3.2.4 | 0 | unknown |
| USB2.1 Hub (inside dock) | 3.2 | 4 | fixed |
| USB2.1 Hub (dock upstream) | 3 | 4 | removable |
| xHCI Host Controller | 0 | 12 | unknown |
Possible fix (tested): treat a device as external if any ancestor is `removable`, before checking for a `fixed` ancestor:
DRIVERS=="usb", ATTRS{devpath}!="0", ATTRS{removable}=="removable", ENV{ID_INTEGRATION}="external", GOTO="libinput_integration_compat"
Confirmed and tested Workaround: a local rule setting `ENV{ID_INTEGRATION}="external"` for the receiver.Source: systemd/systemd