Use disk drive name instead of storage controller name

This commit is contained in:
Hoang Hong Quan
2025-02-18 03:42:39 +07:00
parent 57690476ce
commit 8ea456e2a2

View File

@@ -83,6 +83,7 @@ class WindowsHardwareInfo:
"Mouse": [],
"HDC": [],
"SCSIAdapter": [],
"DiskDrive": [],
"Biometric": [],
"Bluetooth": [],
"SDHost": [],
@@ -532,6 +533,12 @@ class WindowsHardwareInfo:
def storage_controllers(self):
storage_controller_info = {}
disk_drive_name_by_id = {}
for device in self.devices_by_class.get("DiskDrive"):
device_name = device.Name or None
parent_id = device.GetDeviceProperties(["DEVPKEY_Device_Parent"])[0][0].Data.upper()
disk_drive_name_by_id[parent_id] = device_name
for device in self.devices_by_class.get("HDC") + self.devices_by_class.get("SCSIAdapter"):
device_name = device.Name or "Unknown"
pnp_device_id = device.PNPDeviceID
@@ -549,7 +556,7 @@ class WindowsHardwareInfo:
pass
device_info.update(self.get_device_location_paths(device))
storage_controller_info[self.utils.get_unique_key(device_name, storage_controller_info)] = device_info
storage_controller_info[self.utils.get_unique_key(disk_drive_name_by_id.get(pnp_device_id, device_name), storage_controller_info)] = device_info
return storage_controller_info