diff --git a/rules.d/60-persistent-input.rules b/rules.d/60-persistent-input.rules index 7ac43a8074..95037f88c6 100644 --- a/rules.d/60-persistent-input.rules +++ b/rules.d/60-persistent-input.rules @@ -5,20 +5,24 @@ SUBSYSTEM!="input", GOTO="persistent_input_end" SUBSYSTEMS=="bluetooth", ENV{ID_BUS}="bluetooth", GOTO="persistent_input_end" # Bluetooth devices don't always have the bluetooth subsystem ATTRS{id/bustype}=="0005", ENV{ID_BUS}="bluetooth", GOTO="persistent_input_end" -SUBSYSTEMS=="acpi", ENV{ID_BUS}="acpi" -# platform must be before serio as serio can be child -SUBSYSTEMS=="platform", ENV{ID_BUS}="platform" + +# we have to assign the most specific bus, so first check for leaf buses SUBSYSTEMS=="i2c", ENV{ID_BUS}="i2c" SUBSYSTEMS=="rmi4", ENV{ID_BUS}="rmi" SUBSYSTEMS=="serio", ENV{ID_BUS}="i8042" SUBSYSTEMS=="spi", ENV{ID_BUS}="spi" +# then only assign something less specific if ID_BUS was not set yet.. +# usb has middle specificity (e.g. could have an i2c bridge on it, but is under acpi/pci/platform) SUBSYSTEMS=="usb", ENV{ID_BUS}=="", IMPORT{builtin}="usb_id" -# subsystems before (usb, platform, i2c) can be under pci so only set them if we still have no ID_BUS. -# we could set this the first but will break the ENV{ID_BUS}=="" condition for usb. +# pci is usually below acpi/platform SUBSYSTEMS=="pci", ENV{ID_BUS}=="", ENV{ID_BUS}="pci" +# finally, these are the root buses +SUBSYSTEMS=="acpi", ENV{ID_BUS}=="", ENV{ID_BUS}="acpi" +SUBSYSTEMS=="platform", ENV{ID_BUS}=="", ENV{ID_BUS}="platform" + # determine class name for persistent symlinks ENV{ID_INPUT_KEYBOARD}=="?*", ENV{.INPUT_CLASS}="kbd" ENV{ID_INPUT_MOUSE}=="?*", ENV{.INPUT_CLASS}="mouse"