Driver name is now responsibility of PciDevice class instead of a separate function.
This commit is contained in:
parent
8485c36218
commit
7e21cf58ea
|
|
@ -1,5 +1,4 @@
|
||||||
from os import listdir
|
from os import listdir
|
||||||
from os.path import realpath, basename
|
|
||||||
|
|
||||||
|
|
||||||
def all_pci_device_ids() -> list[str]:
|
def all_pci_device_ids() -> list[str]:
|
||||||
|
|
@ -8,9 +7,3 @@ def all_pci_device_ids() -> list[str]:
|
||||||
|
|
||||||
def all_pci_driver_ids() -> list[str]:
|
def all_pci_driver_ids() -> list[str]:
|
||||||
return listdir("/sys/bus/pci/drivers")
|
return listdir("/sys/bus/pci/drivers")
|
||||||
|
|
||||||
|
|
||||||
def driver_of_pci_device(pci_device_id: str) -> str:
|
|
||||||
driver_directory: str = realpath(
|
|
||||||
f"/sys/bus/pci/devices/{pci_device_id}/driver")
|
|
||||||
return basename(driver_directory)
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
from pci_passthrough_assist.pci import driver_of_pci_device
|
from os.path import exists, realpath, basename
|
||||||
from os.path import exists
|
|
||||||
from os import listdir
|
from os import listdir
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -10,7 +9,11 @@ class PciDevice:
|
||||||
self.device_id = device_id
|
self.device_id = device_id
|
||||||
|
|
||||||
def driver_name(self) -> str:
|
def driver_name(self) -> str:
|
||||||
return driver_of_pci_device(self.device_id)
|
pci_driver_path = f"/sys/bus/pci/devices/{self.device_id}/driver"
|
||||||
|
if not exists(pci_driver_path):
|
||||||
|
return "NO-DRIVER-BOUND"
|
||||||
|
driver_directory: str = realpath(pci_driver_path)
|
||||||
|
return basename(driver_directory)
|
||||||
|
|
||||||
def is_vga(self) -> bool:
|
def is_vga(self) -> bool:
|
||||||
return exists(f"/sys/bus/pci/devices/{self.device_id}/boot_vga")
|
return exists(f"/sys/bus/pci/devices/{self.device_id}/boot_vga")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue