Improve presentation of PnP ROMs

This commit is contained in:
RichardG867
2022-01-26 21:58:24 -03:00
parent 456763cda3
commit 227d945211
2 changed files with 2 additions and 4 deletions

View File

@@ -435,10 +435,8 @@ def analyze_dir(formatter, scan_base, file_analyzers, scan_dir_path, scan_file_n
pnp_id += format(device_id & 0xffff, '04x').upper()
# Clean up vendor and device names.
vendor_device = (vendor + ' ' + device).replace('\r', '')
vendor_device = ((vendor or '') + '\n' + (device or '')).replace('\r', '')
vendor_device = '\n'.join(x.strip() for x in vendor_device.split('\n') if x.strip())
while '\n\n' in vendor_device:
vendor_device = vendor_device.replace('\n\n', '\n')
# Format string.
oroms[x] = '[{0}] {1}'.format(pnp_id, vendor_device.replace('\n', '\n' + (' ' * (len(pnp_id) + 3))))

View File

@@ -1118,7 +1118,7 @@ class BonusAnalyzer(Analyzer):
device = None
# Take valid data only.
if device_id != b'\x00\x00\x00\x00' or vendor or device:
if device_id != b'\x00\x00\x00\x00' and (vendor or device):
# Add PnP ID (endianness swapped to help the front-end in
# processing it), vendor name and device name to the list.
self.oroms.append((struct.unpack('>I', device_id)[0], vendor, device))