summaryrefslogtreecommitdiffstats
path: root/rules.d/60-serial.rules
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-06-14 18:34:27 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-06-18 18:25:15 +0200
commit876c75fe870846b09b54423a6b719d80bc879b27 (patch)
tree5e8719f4f1cfac65498c72a9ec807a9422063ca2 /rules.d/60-serial.rules
parenthwdb: generate a hwdb file instead of rules for autosuspend (diff)
downloadsystemd-876c75fe870846b09b54423a6b719d80bc879b27.tar.xz
systemd-876c75fe870846b09b54423a6b719d80bc879b27.zip
udev: do not execute hwdb builtin import twice or thrice
Running the import more than once shouldn't matter, but it's a bit confusing and causes a slowdown too. This patch reworks the rules to avoid duplicted runs, but tries to keep the same imports. (E.g. import for pci devices without MODALIAS is only done for tty devices.) Note that this is only about hwdb import with argument, which uses MODALIAS as the lookup key. There are other imports done with different lookup keys.
Diffstat (limited to '')
-rw-r--r--rules.d/60-serial.rules5
1 files changed, 3 insertions, 2 deletions
diff --git a/rules.d/60-serial.rules b/rules.d/60-serial.rules
index f303e27fd5..b1626650b7 100644
--- a/rules.d/60-serial.rules
+++ b/rules.d/60-serial.rules
@@ -4,8 +4,9 @@ ACTION=="remove", GOTO="serial_end"
SUBSYSTEM!="tty", GOTO="serial_end"
SUBSYSTEMS=="pci", ENV{ID_BUS}="pci", ENV{ID_VENDOR_ID}="$attr{vendor}", ENV{ID_MODEL_ID}="$attr{device}"
-SUBSYSTEMS=="pci", IMPORT{builtin}="hwdb --subsystem=pci"
-SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id", IMPORT{builtin}="hwdb --subsystem=usb"
+# We already ran the hwdb builtin for devices with MODALIAS in 50-default.rules.
+# Let's cover the remaining case here, where we walk up the tree to find a node with $MODALIAS.
+ENV{MODALIAS}=="", SUBSYSTEMS=="pci", IMPORT{builtin}="hwdb --subsystem=pci"
# /dev/serial/by-path/, /dev/serial/by-id/ for USB devices
KERNEL!="ttyUSB[0-9]*|ttyACM[0-9]*", GOTO="serial_end"