Device Abstraction¶
A PCIe device wrapper for Linux PCIe devices.
- class bakeneko.support.sys_dev.PCIDevice(slot: str, vendor: int | str, device: int | str)¶
A simple abstraction around PCI(e) devices on Linux.
- Attributes:
slot (str) – The device slot.
node (Path) – The full sys path to the device node
vendor (int) – Device Vendor ID
device (int) – Device ID
- Parameters:
- static from_path(path: Path) PCIDevice ¶
Construct a PCIDevice from a device node path
- Parameters:
path (Path) – The device node path in the /sys/bus/pci/devices tree.
- Returns:
A new PCI(e) device wrapper
- Return type:
- static enumerate_remote(conn: Connection) list[PCIDevice] ¶
Get a list of PCI(e) devices attached to the remote system
- static get_remote(slot: str, conn: Connection) PCIDevice | None ¶
Get a PCIDevice from the give device/slot ID on the remote system.
- static from_remote_path(path: Path, conn: Connection) PCIDevice ¶
Construct a PCIDevice from a device node path
- Parameters:
path (Path) – The device node path in the /sys/bus/pci/devices tree.
conn (fabric.Connection) – The connection to use.
- Returns:
A new PCI(e) device wrapper
- Return type:
- set_speed(speed: LinkSpeed) bool ¶
Set the device link speed.
Note
This only works on PCIe gen2 or newer devices, as the LC2 register is not specified in PCIe v1 which makes sense, as in PCIe v1 there was only one speed.
- get_capability(cap: str, port: bool = False) str | None ¶
Use setpci to read a PCI device register and return the value.