]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
hwdb: make three more hwdb files parsed by parse_hwdb.py
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 16 Jan 2026 14:50:35 +0000 (23:50 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 16 Jan 2026 17:53:14 +0000 (02:53 +0900)
This also makes 70-lights.hwdb installed. The file was introduced by
106f64cbd66b8aa76333c3f11177f53e79e2cd82, but never installed.

Moreover, this makes the parser also check bluetooth modalias patterns.

hwdb.d/20-dmi-id.hwdb
hwdb.d/70-lights.hwdb
hwdb.d/meson.build
hwdb.d/parse_hwdb.py

index 469ad3ce3acb394dd2dbd7c8b83261d8ec1b6425..494997e6fa3cb995ca0b836d3927846d21c486ac 100644 (file)
@@ -9,7 +9,7 @@ dmi:*:svnSystemmanufacturer:*
 dmi:*:svnSystemManufacturer:*
 dmi:*:svnTobefilledbyO.E.M.:*
 dmi:*:svnToBeFilledByO.E.M.:*
   ID_SYS_VENDOR_IS_RUBBISH=1
+ ID_SYS_VENDOR_IS_RUBBISH=1
 
 dmi:*:pnDefaultstring:*
 dmi:*:pnN/A:*
@@ -21,7 +21,7 @@ dmi:*:pnSystemname:*
 dmi:*:pnSystemName:*
 dmi:*:pnTobefilledbyO.E.M.:*
 dmi:*:pnToBeFilledByO.E.M.:*
   ID_PRODUCT_NAME_IS_RUBBISH=1
+ ID_PRODUCT_NAME_IS_RUBBISH=1
 
 dmi:*:pvrDefaultstring:*
 dmi:*:pvrDefault string:*
@@ -31,7 +31,7 @@ dmi:*:pvrOEM:*
 dmi:*:pvrTobefilledbyO.E.M.:*
 dmi:*:pvrToBeFilledByO.E.M.:*
 dmi:*:pvrTo Be Filled By O.E.M.:*
   ID_PRODUCT_VERSION_IS_RUBBISH=1
+ ID_PRODUCT_VERSION_IS_RUBBISH=1
 
 dmi:*:rvrDefaultstring:*
 dmi:*:rvrDefault string:*
@@ -41,7 +41,7 @@ dmi:*:rvrOEM:*
 dmi:*:rvrTobefilledbyO.E.M.:*
 dmi:*:rvrToBeFilledByO.E.M.:*
 dmi:*:rvrTo Be Filled By O.E.M.:*
   ID_BOARD_VERSION_IS_RUBBISH=1
+ ID_BOARD_VERSION_IS_RUBBISH=1
 
 dmi:*:skuDefaultstring:*
 dmi:*:skuDefault string:*
@@ -51,7 +51,7 @@ dmi:*:skuOEM:*
 dmi:*:skuTobefilledbyO.E.M.:*
 dmi:*:skuToBeFilledByO.E.M.:*
 dmi:*:skuTo Be Filled By O.E.M.:*
   ID_PRODUCT_SKU_IS_RUBBISH=1
+ ID_PRODUCT_SKU_IS_RUBBISH=1
 
 dmi:*:catDefaultstring:*
 dmi:*:catDefault string:*
@@ -61,17 +61,17 @@ dmi:*:catOEM:*
 dmi:*:catTobefilledbyO.E.M.:*
 dmi:*:catToBeFilledByO.E.M.:*
 dmi:*:catTo Be Filled By O.E.M.:*
   ID_CHASSIS_ASSET_TAG_IS_RUBBISH=1
+ ID_CHASSIS_ASSET_TAG_IS_RUBBISH=1
 
 # Fix "Lenovo" capitalization in /sys/class/dmi/id/sys_vendor
 dmi:bvnLENOVO*
   ID_SYSFS_ATTRIBUTE_MODEL=product_version
   ID_VENDOR_FROM_DATABASE=Lenovo
+ ID_SYSFS_ATTRIBUTE_MODEL=product_version
+ ID_VENDOR_FROM_DATABASE=Lenovo
 
 # Microsoft Surface 1's chassis type
 dmi:bvnMicrosoft Corporation*:pvrSurface with Windows 8 Pro*
   ID_CHASSIS=tablet
+ ID_CHASSIS=tablet
 
 # GPD Pocket 4 chassis type
 dmi:bvnAmericanMegatrendsInternational*:rvnGPD:rnG1628-04*
   ID_CHASSIS=convertible
+ ID_CHASSIS=convertible
index a7753710ed7b7acd763f9138a544d39f8c3f30f6..af56968abd66cb5acfcbf29706c8f66cb7232c67 100644 (file)
 # Logitech
 ################
 # Litra Beam
-bluetooth:v046dpc901*
-usb:v046dpc901*
+bluetooth:v046DpC901*
+usb:v046DpC901*
  ID_AV_LIGHTS=1
 
 # Litra Glow
-bluetooth:v046dpc900*
-usb:v046dpc900*
+bluetooth:v046DpC900*
+usb:v046DpC900*
  ID_AV_LIGHTS=1
index 5992e21f815d05cd3795c1431563ddffcf8126b4..36a9937a60a3f11a52d273db79f67f19f386f5b3 100644 (file)
@@ -5,7 +5,6 @@
 # So we don't "test" them.
 hwdb_files_notest = files(
         'README',
-        '20-dmi-id.hwdb',
         '20-pci-vendor-model.hwdb',
         '20-pci-classes.hwdb',
         '20-usb-vendor-model.hwdb',
@@ -15,10 +14,11 @@ hwdb_files_notest = files(
         '20-bluetooth-vendor-product.hwdb',
         '20-acpi-vendor.hwdb',
         '20-OUI.hwdb',
-        '20-net-ifname.hwdb',
         '20-vmbus-class.hwdb')
 
 hwdb_files_test = files(
+        '20-dmi-id.hwdb',
+        '20-net-ifname.hwdb',
         '60-autosuspend.hwdb',
         '60-autosuspend-fingerprint-reader.hwdb',
         '60-evdev.hwdb',
@@ -31,6 +31,7 @@ hwdb_files_test = files(
         '70-cameras.hwdb',
         '70-hardware-wallets.hwdb',
         '70-joystick.hwdb',
+        '70-lights.hwdb',
         '70-maker-tools.hwdb',
         '70-mouse.hwdb',
         '70-pda.hwdb',
index 165c8d608fc1367b5431f67c98609dcad097ba26..f5b63b7d34b20d00a47e80bd14f2262f67b6da9c 100755 (executable)
@@ -106,6 +106,7 @@ GENERAL_MATCHES = {'acpi',
                    'vmbus',
                    'OUI',
                    'ieee1394',
+                   'dmi',
                    }
 
 def upperhex_word(length):
@@ -201,6 +202,16 @@ def property_grammar():
              ('ID_INFRARED_CAMERA', Or((Literal('0'), Literal('1')))),
              ('ID_CAMERA_DIRECTION', Or(('front', 'rear'))),
              ('SOUND_FORM_FACTOR', Or(('internal', 'webcam', 'speaker', 'headphone', 'headset', 'handset', 'microphone'))),
+             ('ID_SYS_VENDOR_IS_RUBBISH', Or((Literal('0'), Literal('1')))),
+             ('ID_PRODUCT_NAME_IS_RUBBISH', Or((Literal('0'), Literal('1')))),
+             ('ID_PRODUCT_VERSION_IS_RUBBISH', Or((Literal('0'), Literal('1')))),
+             ('ID_BOARD_VERSION_IS_RUBBISH', Or((Literal('0'), Literal('1')))),
+             ('ID_PRODUCT_SKU_IS_RUBBISH', Or((Literal('0'), Literal('1')))),
+             ('ID_CHASSIS_ASSET_TAG_IS_RUBBISH', Or((Literal('0'), Literal('1')))),
+             ('ID_CHASSIS', name_literal),
+             ('ID_SYSFS_ATTRIBUTE_MODEL', name_literal),
+             ('ID_NET_NAME_FROM_DATABASE', name_literal),
+             ('ID_NET_NAME_INCLUDE_DOMAIN', Or((Literal('0'), Literal('1')))),
             )
     fixed_props = [Literal(name)('NAME') - Suppress('=') - val('VALUE')
                    for name, val in props]
@@ -243,8 +254,10 @@ def check_matches(groups):
 
     # This is a partial check. The other cases could be also done, but those
     # two are most commonly wrong.
-    grammars = { 'usb' : 'v' + upperhex_word(4) + Optional('p' + upperhex_word(4) + Optional(':')) + '*',
-                 'pci' : 'v' + upperhex_word(8) + Optional('d' + upperhex_word(8) + Optional(':')) + '*',
+    grammars = {
+        'bluetooth' : 'v' + upperhex_word(4) + Optional('p' + upperhex_word(4) + Optional(':')) + '*',
+        'usb' : 'v' + upperhex_word(4) + Optional('p' + upperhex_word(4) + Optional(':')) + '*',
+        'pci' : 'v' + upperhex_word(8) + Optional('d' + upperhex_word(8) + Optional(':')) + '*',
     }
 
     for match in matches:
@@ -253,12 +266,12 @@ def check_matches(groups):
         if gr:
             # we check this first to provide an easy error message
             if rest[-1] not in '*:':
-                error('pattern {} does not end with "*" or ":"', match)
+                error('Pattern {} does not end with "*" or ":"', match)
 
             try:
                 gr.parseString(rest)
             except ParseBaseException as e:
-                error('Pattern {!r} is invalid: {}', rest, e)
+                error('Pattern {} is invalid: {}', match, e)
                 continue
 
     matches.sort()
@@ -340,7 +353,12 @@ def print_summary(fname, groups):
         error(f'{fname}: no matches or props')
 
 if __name__ == '__main__':
-    args = sys.argv[1:] or sorted(glob.glob(os.path.dirname(sys.argv[0]) + '/[678][0-9]-*.hwdb'))
+    args = sys.argv[1:] or sorted(
+        [
+            os.path.dirname(sys.argv[0]) + '/20-dmi-id.hwdb',
+            os.path.dirname(sys.argv[0]) + '/20-net-ifname.hwdb',
+        ] + glob.glob(os.path.dirname(sys.argv[0]) + '/[678][0-9]-*.hwdb')
+    )
 
     for fname in args:
         groups = parse(fname)