pcidev

package
v1.20.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package pcidev reads the PCI devices of a Linux host from sysfs, and names them from the pci.ids database, both through a filesystem. The pci and gpu collectors share it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	// contains filtered or unexported fields
}

DB is the names of pci.ids.

func LoadDB

func LoadDB(
	fs avfs.VFS,
) *DB

LoadDB reads the first pci.ids of the host. With none, every name is "unknown".

func ParseIDs

func ParseIDs(
	b []byte,
) *DB

ParseIDs parses the pci.ids format: a vendor line "10de NVIDIA", a product under it "\t1c82 GP107", a subsystem under that "\t\t1458 3764 Name"; and a class line "C 03 Display controller" with its subclasses "\t00 VGA compatible controller". A line longer than the read buffer is skipped, and the parse goes on.

type Device

type Device struct {
	Address           string
	VendorID          string
	VendorName        string
	ProductID         string
	ProductName       string
	ClassID           string
	ClassName         string
	SubclassID        string
	SubclassName      string
	SubsystemVendorID string
	SubsystemID       string
	SubsystemName     string
	Revision          string
	Driver            string
	IOMMUGroup        string
	ParentAddress     string
}

Device is one PCI device. Each ID is lower-case hex; each name is from pci.ids, or "unknown".

func List

func List(
	fs avfs.VFS,
	db *DB,
) []Device

List is each device of /sys/bus/pci/devices, in address order. An entry that is not a PCI address or has no modalias is left out.

func Read

func Read(
	fs avfs.VFS,
	db *DB,
	address string,
) (Device, bool)

Read is the device at a PCI address. Its IDs come from the modalias, "pci:v000010DEd00001C82sv00001458sd00003764bc03sc00i00". A modalias that is not in that form is not read.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL