1
0
mirror of https://github.com/vcrhonek/hwdata synced 2025-10-14 02:43:35 +08:00

Fix unescaped backslashes in pci.ids check

Signed-off-by: Vitezslav Crhonek <vcrhonek@redhat.com>
This commit is contained in:
Vitezslav Crhonek
2024-03-13 11:22:07 +01:00
parent ae1e4e68b1
commit 4c109fcdc8

View File

@@ -11,11 +11,11 @@ lineno = 1
file = open("pci.ids") file = open("pci.ids")
hexnum = '([0-9a-fA-F]{4})' hexnum = '([0-9a-fA-F]{4})'
desc = '(.*\S)' desc = '(.*\\S)'
for line in file: for line in file:
m = re.match(hexnum + '\s+' + desc, line) m = re.match(hexnum + '\\s+' + desc, line)
if m: if m:
new_id = int('0x' + m.group (1), 16) new_id = int('0x' + m.group (1), 16)
if vendor_id is not None and new_id <= vendor_id: if vendor_id is not None and new_id <= vendor_id:
@@ -26,7 +26,7 @@ for line in file:
vendor_id = new_id vendor_id = new_id
device_id = -1 device_id = -1
m = re.match('\t' + hexnum + '\s+' + desc, line) m = re.match('\t' + hexnum + '\\s+' + desc, line)
if m: if m:
new_id = int('0x' + m.group (1), 16) new_id = int('0x' + m.group (1), 16)
if new_id <= device_id: if new_id <= device_id: