]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev/rules,hwdb: filter out mostly meaningless default strings
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 25 Aug 2022 19:13:26 +0000 (04:13 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 5 Sep 2022 18:38:09 +0000 (03:38 +0900)
The filter is generated based on the following results:
---
git clone git@github.com:linuxhw/DMI.git
cd DMI
git grep -h -A2 '^System Information$' | grep 'Manufacturer' | sort | uniq -c | sort -nr | less
git grep -h -A2 '^System Information$' | grep 'Product Name' | sort | uniq -c | sort -nr | less
---

Closes #24446.

hwdb.d/20-dmi-id.hwdb
rules.d/50-udev-default.rules.in

index c7bf6cfab10b4cfb0b3af95c9b217b17f1beca67..905d6923bb8f680d64713d0e7392902ebe7ec6ad 100644 (file)
@@ -1,5 +1,28 @@
 # This file is part of systemd
 
+# Filter out mostly meaningless names
+dmi:*:svnDefaultstring:*
+dmi:*:svnN/A:*
+dmi:*:svnO.E.M.:*
+dmi:*:svnOEM:*
+dmi:*:svnSystemmanufacturer:*
+dmi:*:svnSystemManufacturer:*
+dmi:*:svnTobefilledbyO.E.M.:*
+dmi:*:svnToBeFilledByO.E.M.:*
+    ID_SYS_VENDOR_IS_RUBBISH=1
+
+dmi:*:pnDefaultstring:*
+dmi:*:pnN/A:*
+dmi:*:pnO.E.M.:*
+dmi:*:pnOEM:*
+dmi:*:pnSystemproductname:*
+dmi:*:pnSystemProductName:*
+dmi:*:pnSystemname:*
+dmi:*:pnSystemName:*
+dmi:*:pnTobefilledbyO.E.M.:*
+dmi:*:pnToBeFilledByO.E.M.:*
+    ID_PRODUCT_NAME_IS_RUBBISH=1
+
 # Fix "Lenovo" capitalization in /sys/class/dmi/id/sys_vendor
 dmi:bvnLENOVO*
     ID_SYSFS_ATTRIBUTE_MODEL=product_version
index 0394530479d8b2db369d7718f459ac58264596d9..843bdaf9ce7edd777782d0beab8523e3020bb2f4 100644 (file)
@@ -110,8 +110,9 @@ 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_VENDOR}="$attr{sys_vendor}"
-ENV{ID_SYSFS_ATTRIBUTE_MODEL}=="|product_name", ENV{ID_MODEL}="$attr{product_name}"
+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}"