diff --git a/src/pci_passthrough_assist/pci_device.py b/src/pci_passthrough_assist/pci_device.py index 4c24123..ee97910 100644 --- a/src/pci_passthrough_assist/pci_device.py +++ b/src/pci_passthrough_assist/pci_device.py @@ -1,5 +1,6 @@ from pci_passthrough_assist.pci import driver_of_pci_device from os.path import exists +from os import listdir class PciDevice: @@ -13,5 +14,10 @@ class PciDevice: def is_vga(self) -> bool: return exists(f"/sys/bus/pci/devices/{self.device_id}/boot_vga") + def devices_in_iommu_group(self) -> list['PciDevice']: + device_ids: list[str] = listdir( + f"/sys/bus/pci/devices/{self.device_id}/iommu_group/devices") + return [PciDevice(device_id) for device_id in device_ids] + def __str__(self) -> str: - return f"{self.device_id} driver: {self.driver_name()} VGA: {self.is_vga()}" \ No newline at end of file + return f"{self.device_id} driver: {self.driver_name()} VGA: {self.is_vga()}"