]>
git.ipfire.org Git - thirdparty/systemd.git/blob - hwdb.d/acpi-update.py
3 from html
.parser
import HTMLParser
14 class PNPTableParser(HTMLParser
):
17 HTMLParser
.__init
__(self
)
18 self
.state
= State
.NOWHERE
24 def handle_starttag(self
, tag
, attrs
):
27 if self
.state
== State
.NOWHERE
:
28 self
.state
= State
.COMPANY
29 elif self
.state
== State
.AFTER_COMPANY
:
30 self
.state
= State
.PNPID
31 elif self
.state
== State
.AFTER_PNPID
:
32 self
.state
= State
.DATE
38 def handle_endtag(self
, tag
):
41 if self
.state
== State
.COMPANY
:
42 self
.company
= ' '.join(self
.data
.strip().split())
43 self
.state
= State
.AFTER_COMPANY
44 elif self
.state
== State
.PNPID
:
45 self
.pnpid
= self
.data
.strip()
46 self
.state
= State
.AFTER_PNPID
47 self
.table
.append((self
.pnpid
, self
.company
))
48 elif self
.state
== State
.DATE
:
49 self
.state
= State
.NOWHERE
53 def handle_data(self
, data
):
58 parser
= PNPTableParser()
66 for pnpid
, company
in parser
.table
:
67 print("\nacpi:{0}*:\n ID_VENDOR_FROM_DATABASE={1}".format(pnpid
, company
))
69 a
= open("acpi_id_registry.html")
70 b
= open("pnp_id_registry.html")
72 print('# This file is part of systemd.\n'
74 '# Data imported from:\n'
75 '# https://uefi.org/uefi-pnp-export\n'
76 '# https://uefi.org/uefi-acpi-export')