Added a function that gets name of PCI device's driver.
This commit is contained in:
parent
111caa2a5e
commit
548527c302
|
|
@ -1,4 +1,5 @@
|
||||||
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]:
|
||||||
|
|
@ -7,3 +8,9 @@ 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)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue