pciids

package module
v1.3.1-0...-b0583a5 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2021 License: GPL-3.0 Imports: 3 Imported by: 0

README

pciids

Lookup vendor and device names using PCI IDs!

Build Status Go Report Card Go Reference

CLI

To search for devices using the CLI, pass in either:

a) a pair of vendor and device PCI IDs b) two pairs, vendor and device PCI IDs as well as sub-vendor and sub-device PCI IDs:

Here are some examples:

$ pciids 1d0f efa1
1d0f:efa1           - Amazon.com, Inc. Elastic Fabric Adapter (EFA)
$ pciids 10de 2206 10de 1467
10de:2206 10de:1467 - NVIDIA Corporation GA102 [GeForce RTX 3080]

If there are multiple matches then all matches are returned.

JSON output

The command can take the --json flag to produce JSON output:

$ pciids 121a 0009 121a 0009 --json
[
    {
        "vendorID": "121a",
        "deviceID": "0009",
        "vendorName": "3Dfx Interactive, Inc.",
        "deviceName": "Voodoo 4 / Voodoo 5",
        "subVendorID": "121a",
        "subDeviceID": "0009",
        "subVendorName": "3Dfx Interactive, Inc.",
        "subDeviceName": "Voodoo5 AGP 5500/6000"
    }
]
Debug output

The --debug flag to produce additional output while running:

$ pciids --json 121a 0009 121a 0009
DEBU Looking up 121a:0009 121a:0009
DEBU Downloading https://raw.githubusercontent.com/pciutils/pciids/master/pci.ids
DEBU 200 OK
DEBU Parsing vendor IDs
DEBU Parsing PCI IDs
DEBU Found 1 results
121a:0009 121a:0009 - 3Dfx Interactive, Inc. Voodoo5 AGP 5500/6000

Install

Below outlines the various ways to obtain and install pciids.

From binary

Download the latest release of pciids for your platform and extract the tarball:

wget pciids<version>_<os>_<arch>.tar.gz
tar zxvf pciids<version>_<os>_<arch>.tar.gz

The tarball will extract the readme, license, and the pre-compiled binary.

From source

To build and install directly from source run:

git clone https://github.com/powersj/pciids
cd pciids
make

The default make command will run go build and produce a binary in the root directory.

From go

To download using the go get command run:

go get github.com/powersj/pciids

The executable object file location will exist at ${GOPATH}/bin/pciids

API usage

Users can take advantage of various functions in their own code:

  • All(): returns a list of all PCI ID devices
  • LatestFile(): string of the latest PCI ID database
  • Parse(string): parses a given PCI ID database string
  • QueryDevice(vendorID, deviceID): Searches for devices matching a PCI ID pair
  • QuerySubDevice(vendorID, deviceID, subVendorID, subDeviceID): Like QueryDevice, but matches two PCI ID pairs (e.g. device and sub-device)

Additionally, the PCIID struct is available for use to create one-off IDs.

Below is an example of querying for matching devices using a PCI ID pair:

package main

import (
  "fmt"

  "github.com/powersj/pciids"
)

func main() {
  ids, err := pciids.QueryDevice("10de", "1467")
  if err != nil {
    fmt.Println("Error getting device info: %v", err)
  }

  for _, id := range ids {
    fmt.Println(id.String())
  }
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var All = query.All

All returns all PCI IDs.

View Source
var LatestFile = file.Latest

LatestFile returns the latest PCI IDs database file.

View Source
var Parse = ids.Parse

Parse will parse a PCI IDs file.

View Source
var QueryDevice = query.Device

QueryDevice will query using a specific PCI ID device pair.

View Source
var QueryDeviceLocal = query.DeviceLocal
View Source
var QuerySubDevice = query.SubDevice

QuerySubDevice will query using a specific PCI ID device and subdevice pair.

Functions

This section is empty.

Types

type PCIID

type PCIID = ids.PCIID

PCIID type.

Directories

Path Synopsis
app
pkg
ids

Jump to

Keyboard shortcuts

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