in pci_vpd_lib/pci_vpd_lib.py [0:0]
def _process_vpd_list(self, data):
# Each item header is 3 bytes long. 2 bytes for the key and 1
# byte for the length of the data
while len(data) >= 3:
key = data[0:2].decode('ascii')
length = bytearray(data[2:3])[0]
# Check if we have enough data
if len(data) < 3 + length:
return
# RV is a checksum and reserved bytes. It doesn't provide any
# useful information and is used just for checksum, skip it.
if key != 'RV':
value = self._value_to_str(data[3:3 + length]).strip()
self.fields[key] = value
data = data[3 + length:]