pciutils is both an executable binary that can be run, and a library that can be used in Rust programs.
Installing the lspci executable
Assuming you have Rust/Cargo installed , run this command in a terminal:
cargo install pciutils
It will make the lspci command available in your PATH if you've allowed the PATH to be modified when installing Rust . cargo uninstall pciutils uninstalls.
Adding pciutils library as a dependency
Run this command in a terminal, in your project's directory:
cargo add pciutils
To add it manually, edit your project's Cargo.toml file and add to the [dependencies] section:
pciutils = "0.1.1"
The pciutils library will be automatically available globally.
Read the pciutils library documentation .
Back to the crate overview .
Readme
pciutils.rs
This is a very much work in progress clone of pciutils . The goal is to eventually match full functionality of pciutils library and the associated lspci and setpci command line utilities.
Status
Currently only minimal functionality is supported. lspci command line utility exists and is able to discover traditional capabilities.
$ sudo - E bash - c ' cargo run --bin lspci -- -vs04:00.0'
Finished dev [ unoptimized + debuginfo] target(s ) in 0.01s
Running ` ./lspci ' -vs04:00.0' `
04:00.0 USB controller: Intel Corporation JHL7540 Thunderbolt 3 USB Controller [ Titan Ridge DD 2018] (rev 06 )
Subsystem: Vendor 8086 Device 0000
Memory at 82000000 (32-bit, non-prefetchable )
Capabilities: [ 80] Power Management version 3
Capabilities: [ 88] Capability 0x5 at 0x88
Capabilities: [ c0] Capability 0x10 at 0xc0
Kernel driver in use: xhci_hcd
Kernel modules: xhci_pci