Documentation
¶
Index ¶
Constants ¶
const ( DefaultChroot = "/" DefaultCacheOnly = false DefaultEnableNetworkFetch = false )
const ( EnvVarChroot = "PCIDB_CHROOT" EnvVarPath = "PCIDB_PATH" EnvVarCacheOnly = "PCIDB_CACHE_ONLY" EnvVarCachePath = "PCIDB_CACHE_PATH" EnvVarEnableNetworkFetch = "PCIDB_ENABLE_NETWORK_FETCH" )
Variables ¶
var ( ErrNoDB = errors.New( "pcidb: No pci-ids DB files found (and network fetch disabled)", ) ErrNoPaths = errors.New( "pcidb: no search paths and cache path is empty.", ) // Backwards-compat, deprecated, please reference ErrNoDB ERR_NO_DB = ErrNoDB )
var (
DefaultCachePath = getCachePath()
)
var WithDirectPath = WithPath
Backwards-compat
Functions ¶
This section is empty.
Types ¶
type Class ¶
type Class struct {
// ID is the hex-encoded PCI_ID for the device class
ID string `json:"id"`
// Name is the common string name for the class
Name string `json:"name"`
// Subclasses are any subclasses belonging to this class
Subclasses []*Subclass `json:"subclasses"`
}
Class is the PCI class
type DB ¶
type DB struct {
// Classes is a map, keyed by class ID, of PCI Class information
Classes map[string]*Class `json:"classes"`
// Vendors is a map, keyed by vendor ID, of PCI Vendor information
Vendors map[string]*Vendor `json:"vendors"`
// Products is a map, keyed by vendor ID + product ID, of PCI product
// information
Products map[string]*Product `json:"products"`
}
type Product ¶
type Product struct {
// VendorID is the vendor ID for the product
VendorID string `json:"vendor_id"`
// ID is the hex-encoded PCI_ID for the product/model
ID string `json:"id"`
// Name is the common string name of the vendor
Name string `json:"name"`
// Subsystems contains "subdevices" or "subsystems" for the product
Subsystems []*Product `json:"subsystems"`
}
Product provides information about a PCI device model.
In the hardware world, the PCI "device_id" is the identifier for the product/model
type ProgrammingInterface ¶
type ProgrammingInterface struct {
// IS is the hex-encoded PCI_ID of the programming interface
ID string `json:"id"`
// Name is the common string name for the programming interface
Name string `json:"name"`
}
ProgrammingInterface is the PCI programming interface for a class of PCI devices
type Subclass ¶
type Subclass struct {
// ID is the hex-encoded PCI_ID for the device subclass
ID string `json:"id"`
// Name is the common string name for the subclass
Name string `json:"name"`
// ProgrammingInterfaces contains any programming interfaces this subclass
// might have
ProgrammingInterfaces []*ProgrammingInterface `json:"programming_interfaces"`
}
Subclass is a subdivision of a PCI class
type Vendor ¶
type Vendor struct {
// IS is the hex-encoded PCI_ID for the vendor
ID string `json:"id"`
// Name is the common string name of the vendor
Name string `json:"name"`
// Products contains all top-level devices for the vendor
Products []*Product `json:"products"`
}
Vendor provides information about a device vendor
type WithOption ¶
type WithOption struct {
// Chroot is the directory that pcidb uses when attempting to discover
// pciids DB files
Chroot *string
// CacheOnly is mostly just useful for testing. It essentially disables
// looking for any non ~/.cache/pci.ids filepaths (which is useful when we
// want to test the fetch-from-network code paths
CacheOnly *bool
// CachePath overrides the pcidb cache path, which defaults to
// $HOME/.cache/pci.ids
CachePath *string
// Enables fetching a pci-ids from a known location on the network if no
// local pci-ids DB files can be found.
EnableNetworkFetch *bool
// Path points to the absolute path of a pci.ids file in a non-standard
// location.
Path *string
}
WithOption is used to represent optionally-configured settings
func WithCacheOnly ¶
func WithCacheOnly() *WithOption
WithCacheOnly disables lookup of pci.ids database files over the network and forces pcidb to only use any pre-cached pci.ids database files in its cache directory.
func WithCachePath ¶
func WithCachePath(path string) *WithOption
WithCachePath overrides the directory that pcidb uses to look up pre-found/pre-fetching pci.ids database files.
func WithChroot ¶
func WithChroot(dir string) *WithOption
WithChroot overrides the root directory used for discovery of pci-ids database files.
func WithEnableNetworkFetch ¶
func WithEnableNetworkFetch() *WithOption
WithEnableNetworkFetch enables the fetching of pci.ids database files over the Internet if a pci.ids database file cannot be found on the host filesystem or the pcidb cache directory.
func WithPath ¶
func WithPath(path string) *WithOption
WithPath overrides the pci.ids database file discovery and points pcidb at a known location of a pci.ids or pci.ids.gz database file.