mirror of
https://github.com/systemd/systemd.git
synced 2026-11-06 05:17:24 +00:00
udev: fix usb device integration
If the device or one of its parent devices is marked as removable or unknown, then the device itself should be considered removable. For example, consider a device connected to a USB port of a dock: 1. xHCI Host Controller (devpath=0, maxchild=12, removable=unknown) 2. USB2.1 Hub (dock upstream) (devpath=3, maxchild=4, removable=removable) 3. USB2.1 Hub (inside dock) (devpath=3.2, maxchild=4, removable=fixed) 4. USB Device (devpath=3.2.4, maxchild=0, removable=unknown) Previously, the leaf device was considered as internal. With this change, the device is considered as external, as there is a removable parent. Fixes #43965.
This commit is contained in:
1 parent
20f652ccb1
commit
7580215967
1 file changed
+10
-7
@@ -12,13 +12,16 @@ ENV{ID_BUS}=="acpi|platform|i8042|i2c|rmi|spi|pci", ENV{ID_INTEGRATION}="interna
|
||||
# Bluetooth devices: External by default.
|
||||
ENV{ID_BUS}=="bluetooth", ENV{ID_INTEGRATION}="external", GOTO="libinput_integration_compat"
|
||||
|
||||
# USB devices: Internal if it's connected to a fixed port, external to a removable and if it's unknown we use the main parent device attribute.
|
||||
ENV{ID_BUS}!="usb", GOTO="usb_integration_end"
|
||||
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{devpath}!="0", ATTRS{removable}=="fixed", ENV{ID_INTEGRATION}="internal", GOTO="libinput_integration_compat"
|
||||
DRIVERS=="usb", ATTRS{devpath}!="0", ATTRS{removable}=="removable|unknown", ENV{ID_INTEGRATION}="external", GOTO="libinput_integration_compat"
|
||||
LABEL="usb_integration_end"
|
||||
# USB devices
|
||||
ENV{ID_BUS}!="usb", GOTO="libinput_integration_compat"
|
||||
# Do not set integration for the USB root device.
|
||||
SUBSYSTEM=="usb", ATTR{devpath}=="0", GOTO="libinput_integration_compat"
|
||||
# Assume the device is external if any parent USB device is removable.
|
||||
DRIVERS=="usb", ATTRS{removable}=="removable", ENV{ID_INTEGRATION}="external", GOTO="libinput_integration_compat"
|
||||
# If no parent device is removable, check for fixed parent devices to assume it is internal.
|
||||
DRIVERS=="usb", ATTRS{removable}=="fixed", ENV{ID_INTEGRATION}="internal", GOTO="libinput_integration_compat"
|
||||
# Fallback: if all devices in the USB chain are unknown, assume it is external.
|
||||
ENV{ID_INTEGRATION}="external", GOTO="libinput_integration_compat"
|
||||
|
||||
# libinput compatibility, must be loaded before 70-touchpad.rules to allow hwdb quirks to override.
|
||||
LABEL="libinput_integration_compat"
|
||||
|
||||
Reference in new issue
Block a user