diff --git a/hwdb.d/20-dmi-id.hwdb b/hwdb.d/20-dmi-id.hwdb index 469ad3ce3a..494997e6fa 100644 --- a/hwdb.d/20-dmi-id.hwdb +++ b/hwdb.d/20-dmi-id.hwdb @@ -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 diff --git a/hwdb.d/70-lights.hwdb b/hwdb.d/70-lights.hwdb index a7753710ed..af56968abd 100644 --- a/hwdb.d/70-lights.hwdb +++ b/hwdb.d/70-lights.hwdb @@ -26,11 +26,11 @@ # 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 diff --git a/hwdb.d/meson.build b/hwdb.d/meson.build index 5992e21f81..36a9937a60 100644 --- a/hwdb.d/meson.build +++ b/hwdb.d/meson.build @@ -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', diff --git a/hwdb.d/parse_hwdb.py b/hwdb.d/parse_hwdb.py index 165c8d608f..f5b63b7d34 100755 --- a/hwdb.d/parse_hwdb.py +++ b/hwdb.d/parse_hwdb.py @@ -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)