pci

package
v0.0.0-...-b34aa2c Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2017 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Lookup

func Lookup(ids map[string]Vendor, vendor string, device string) (string, string)

Lookup takes PCI hex (as strings) vendor and device ID values and returns human readable labels for both the vendor and device. Returns the input ID value if if label is not found in the ids map.

func NewBusReader

func NewBusReader() (busReader, error)

NewBusReader returns a BusReader. If it can't glob in /sys/bus/pci/devices then it gives up. We don't provide an option (yet) to do type I or PCIe MMIO config stuff.

func NewIDs

func NewIDs() (map[string]Vendor, error)

NewIDs contains the plain text contents of pci.ids. It returns a map to be used as lookup from hex ID to human readable lable.

Types

type Device

type Device string

Device is a PCI device human readable label

type Devices

type Devices []*PCI

Devices contains a slice of one or more PCI devices

func (Devices) String

func (d Devices) String() string

String is a Stringer for fmt and others' convenience.

func (Devices) ToString

func (d Devices) ToString(n bool, ids map[string]Vendor) string

ToString concatenates multiple Devices' PCI address, Vendor, and Device to make a useful display for the user. Boolean argument toggles displaying numeric IDs or human readable labels.

type PCI

type PCI struct {
	Addr       string
	Vendor     string `pci:"vendor"`
	Device     string `pci:"device"`
	VendorName string
	DeviceName string
}

PCI is a PCI device. We will fill this in as we add options. For now it just holds two uint16 per the PCI spec.

func (PCI) String

func (p PCI) String() string

String is a Stringer for fmt and others' convenience.

func (PCI) ToString

func (p PCI) ToString(n bool, ids map[string]Vendor) string

ToString concatenates PCI address, Vendor, and Device to make a useful display for the user. Boolean argument toggles displaying numeric IDs or human readable labels.

type Vendor

type Vendor struct {
	Name    string
	Devices map[string]Device
}

Vendor is a PCI vendor human readable label. It contains a map of one or more Devices keyed by hex ID.

Jump to

Keyboard shortcuts

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