1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-02-02 09:47:03 +03:00
systemd-stable/hwdb.d/acpi-update.py
Zbigniew Jędrzejewski-Szmek d5f36ae498 hwdb: update to main@{2023-11-29}
git restore -s origin/main hwdb.d/ test/hwdb.d test/hwdb-test.sh

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2252022.

(cherry picked from commit be8b196ed026164f29943d8a1d04dc2d2ae3942a)
2023-12-06 11:15:01 +01:00

27 lines
743 B
Python
Executable File

#!/usr/bin/env python3
# SPDX-License-Identifier: LGPL-2.1-or-later
from csv import reader
# pylint: disable=consider-using-with
def read_table(filename):
table = list(reader(open(filename, newline='')))
table = table[1:] # Skip header
table.sort(key=lambda x: x[1])
for row in table:
# Some IDs end with whitespace, while they didn't in the old HTML table, so it's probably
# a mistake, strip it.
print(f'\nacpi:{row[1].strip()}*:\n ID_VENDOR_FROM_DATABASE={row[0].strip()}')
print('''\
# This file is part of systemd.
#
# Data imported from:
# https://uefi.org/uefi-pnp-export
# https://uefi.org/uefi-acpi-export''')
read_table('acpi_id_registry.csv')
read_table('pnp_id_registry.csv')