device_probe.py: Fix string assumption for IOName

This commit is contained in:
Mykola Grymalyuk
2023-03-13 11:42:36 -06:00
parent ea80d41ff6
commit d5ffa9a8cf
+6 -2
View File
@@ -47,8 +47,12 @@ class PCIDevice:
vendor_id_unspoofed = None vendor_id_unspoofed = None
device_id_unspoofed = None device_id_unspoofed = None
if "IOName" in properties and properties["IOName"].startswith("pci"): if "IOName" in properties:
vendor_id_unspoofed, device_id_unspoofed = (int(i, 16) for i in properties["IOName"][3:].split(",")) ioname = properties["IOName"]
if type(ioname) is bytes:
ioname = ioname.strip(b"\0").decode()
vendor_id_unspoofed, device_id_unspoofed = (int(i, 16) for i in ioname[3:].split(","))
if anti_spoof: if anti_spoof:
vendor_id = vendor_id_unspoofed vendor_id = vendor_id_unspoofed
device_id = device_id_unspoofed device_id = device_id_unspoofed