diff options
author | Lennart Poettering <lennart@poettering.net> | 2023-06-19 18:44:54 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2023-06-20 14:44:36 +0200 |
commit | dafd65b150d31a0d3027f9d8798cb6b401394829 (patch) | |
tree | 2d7ce0897871e26e0edd08b03dd41786d6d90e33 /rules.d | |
parent | update TODO (diff) | |
download | systemd-dafd65b150d31a0d3027f9d8798cb6b401394829.tar.xz systemd-dafd65b150d31a0d3027f9d8798cb6b401394829.zip |
rules: split out DMI related rules from udev-default.rules
The DMI rules where so far guarded by an ACTION=="add" rule, but that
doesn't really make sense for setting properties (only for setting
access modes/ownership of nodes).
Hence let's move this into its own file, that guards properly on
ACTION!="remove".
Before this change the hardware vendor/model info would be dropped
whenever the device was retriggered.
Diffstat (limited to 'rules.d')
-rw-r--r-- | rules.d/50-udev-default.rules.in | 10 | ||||
-rw-r--r-- | rules.d/60-dmi-id.rules | 14 | ||||
-rw-r--r-- | rules.d/meson.build | 1 |
3 files changed, 15 insertions, 10 deletions
diff --git a/rules.d/50-udev-default.rules.in b/rules.d/50-udev-default.rules.in index 50ac005016..35dfc76e61 100644 --- a/rules.d/50-udev-default.rules.in +++ b/rules.d/50-udev-default.rules.in @@ -110,14 +110,4 @@ SUBSYSTEM=="ptp", ATTR{clock_name}=="KVM virtual PTP", SYMLINK += "ptp_kvm" SUBSYSTEM=="ptp", ATTR{clock_name}=="hyperv", SYMLINK += "ptp_hyperv" -SUBSYSTEM!="dmi", GOTO="dmi_end" -ENV{ID_SYS_VENDOR_IS_RUBBISH}!="1", ENV{ID_VENDOR}="$attr{sys_vendor}" -ENV{ID_SYSFS_ATTRIBUTE_MODEL}=="", ENV{ID_PRODUCT_NAME_IS_RUBBISH}!="1", ENV{ID_MODEL}="$attr{product_name}" -ENV{ID_SYSFS_ATTRIBUTE_MODEL}=="product_name", ENV{ID_MODEL}="$attr{product_name}" -ENV{ID_SYSFS_ATTRIBUTE_MODEL}=="product_version", ENV{ID_MODEL}="$attr{product_version}" -# fallback to board information -ENV{ID_VENDOR}=="", ENV{ID_VENDOR}="$attr{board_vendor}" -ENV{ID_MODEL}=="", ENV{ID_MODEL}="$attr{board_name}" -LABEL="dmi_end" - LABEL="default_end" diff --git a/rules.d/60-dmi-id.rules b/rules.d/60-dmi-id.rules new file mode 100644 index 0000000000..6c61ea24ab --- /dev/null +++ b/rules.d/60-dmi-id.rules @@ -0,0 +1,14 @@ +# do not edit this file, it will be overwritten on update + +ACTION=="remove", GOTO="dmi_end" +SUBSYSTEM!="dmi", GOTO="dmi_end" + +ENV{ID_SYS_VENDOR_IS_RUBBISH}!="1", ENV{ID_VENDOR}="$attr{sys_vendor}" +ENV{ID_SYSFS_ATTRIBUTE_MODEL}=="", ENV{ID_PRODUCT_NAME_IS_RUBBISH}!="1", ENV{ID_MODEL}="$attr{product_name}" +ENV{ID_SYSFS_ATTRIBUTE_MODEL}=="product_name", ENV{ID_MODEL}="$attr{product_name}" +ENV{ID_SYSFS_ATTRIBUTE_MODEL}=="product_version", ENV{ID_MODEL}="$attr{product_version}" +# fallback to board information +ENV{ID_VENDOR}=="", ENV{ID_VENDOR}="$attr{board_vendor}" +ENV{ID_MODEL}=="", ENV{ID_MODEL}="$attr{board_name}" + +LABEL="dmi_end" diff --git a/rules.d/meson.build b/rules.d/meson.build index 7280f5b995..20fca222da 100644 --- a/rules.d/meson.build +++ b/rules.d/meson.build @@ -8,6 +8,7 @@ rules = [ [files('60-autosuspend.rules', '60-block.rules', '60-cdrom_id.rules', + '60-dmi-id.rules', '60-drm.rules', '60-evdev.rules', '60-fido-id.rules', |