Check the VID is present in the chipset dictionary

On some platforms (e.g. VirtualBox) where there is no PCI device at `00:00.0`, VID/DID reads for platform detection return `0xFFFF`.
This commit is contained in:
Quentin Minster
2021-03-29 22:54:12 +02:00
committed by Sae86
parent 1a70c07036
commit d7f7d6ce88
+2 -2
View File
@@ -234,7 +234,7 @@ class Chipset:
if platform_code is None:
#platform code was not passed in try to determine based upon cpu id
if did in self.chipset_dictionary[vid] and len(self.chipset_dictionary[vid][did]) > 1 and cpuid in self.detection_dictionary.keys():
if vid in self.chipset_dictionary and did in self.chipset_dictionary[vid] and len(self.chipset_dictionary[vid][did]) > 1 and cpuid in self.detection_dictionary.keys():
for item in self.chipset_dictionary[vid][did]:
if self.detection_dictionary[cpuid] == item['code']:
#matched processor with detection value
@@ -246,7 +246,7 @@ class Chipset:
self.did = did
self.rid = rid
break
elif did in self.chipset_dictionary[vid]:
elif vid in self.chipset_dictionary and did in self.chipset_dictionary[vid]:
_unknown_platform = False
data_dict = self.chipset_dictionary[vid][ did ][0]
self.code = data_dict['code'].upper()