udevadm-test: show result in json format (#36284)
[systemd.io.git] / hwdb.d / acpi-update.py
blob41670b32bbc7c2062724c7775c0eea8433526aeb
1 #!/usr/bin/env python3
2 # SPDX-License-Identifier: LGPL-2.1-or-later
4 from csv import reader
6 # pylint: disable=consider-using-with
8 def read_table(filename):
9 table = list(reader(open(filename, newline='')))
10 table = table[1:] # Skip header
11 table.sort(key=lambda x: x[1])
13 for row in table:
14 # Some IDs end with whitespace, while they didn't in the old HTML table, so it's probably
15 # a mistake, strip it.
16 print(f'\nacpi:{row[1].strip()}*:\n ID_VENDOR_FROM_DATABASE={row[0].strip()}')
18 print('''\
19 # This file is part of systemd.
21 # Data imported from:
22 # https://uefi.org/uefi-pnp-export
23 # https://uefi.org/uefi-acpi-export''')
25 read_table('acpi_id_registry.csv')
26 read_table('pnp_id_registry.csv')