Added devices_in_iommu_group method.
This commit is contained in:
parent
a29e8ba0ee
commit
71b9ee9c58
|
|
@ -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()}"
|
||||
return f"{self.device_id} driver: {self.driver_name()} VGA: {self.is_vga()}"
|
||||
|
|
|
|||
Loading…
Reference in a new issue