udev: rules: order ID_BUS assignment by specificity / bus nesting depth
Only PCI was treated as a "less specific" bus that should not be
assigned if USB was already assigned, so non-PCI USB controllers
(under platform/DT or ACPI) would have all their devices *not*
treated as USB at all, resulting in external peripherals being
treated as internal ones on DT platforms.
Clarify these assignments into specificity/nesting groups instead
of having some arbitrary "X must be before Y" comments.
Fixes a4381cae8b.
This commit is contained in:
@@ -5,20 +5,24 @@ SUBSYSTEM!="input", GOTO="persistent_input_end"
|
|||||||
SUBSYSTEMS=="bluetooth", ENV{ID_BUS}="bluetooth", GOTO="persistent_input_end"
|
SUBSYSTEMS=="bluetooth", ENV{ID_BUS}="bluetooth", GOTO="persistent_input_end"
|
||||||
# Bluetooth devices don't always have the bluetooth subsystem
|
# Bluetooth devices don't always have the bluetooth subsystem
|
||||||
ATTRS{id/bustype}=="0005", ENV{ID_BUS}="bluetooth", GOTO="persistent_input_end"
|
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
|
# we have to assign the most specific bus, so first check for leaf buses
|
||||||
SUBSYSTEMS=="platform", ENV{ID_BUS}="platform"
|
|
||||||
SUBSYSTEMS=="i2c", ENV{ID_BUS}="i2c"
|
SUBSYSTEMS=="i2c", ENV{ID_BUS}="i2c"
|
||||||
SUBSYSTEMS=="rmi4", ENV{ID_BUS}="rmi"
|
SUBSYSTEMS=="rmi4", ENV{ID_BUS}="rmi"
|
||||||
SUBSYSTEMS=="serio", ENV{ID_BUS}="i8042"
|
SUBSYSTEMS=="serio", ENV{ID_BUS}="i8042"
|
||||||
SUBSYSTEMS=="spi", ENV{ID_BUS}="spi"
|
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=="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.
|
# pci is usually below acpi/platform
|
||||||
# we could set this the first but will break the ENV{ID_BUS}=="" condition for usb.
|
|
||||||
SUBSYSTEMS=="pci", ENV{ID_BUS}=="", ENV{ID_BUS}="pci"
|
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
|
# determine class name for persistent symlinks
|
||||||
ENV{ID_INPUT_KEYBOARD}=="?*", ENV{.INPUT_CLASS}="kbd"
|
ENV{ID_INPUT_KEYBOARD}=="?*", ENV{.INPUT_CLASS}="kbd"
|
||||||
ENV{ID_INPUT_MOUSE}=="?*", ENV{.INPUT_CLASS}="mouse"
|
ENV{ID_INPUT_MOUSE}=="?*", ENV{.INPUT_CLASS}="mouse"
|
||||||
|
|||||||
Reference in New Issue
Block a user