Documentation ¶
Overview ¶
Package usbid provides human-readable text output for the usb package.
On load, the usbid package parses an embedded mapping of vendors/products and class/subclass/protocols. They can also be loaded from a URL or from a reader.
The bread and butter of this package are the following two functions:
Describe - Pretty-print the vendor and product of a device descriptor Classify - Pretty-print the class/protocol info for a device/interface
Index ¶
Constants ¶
const (
// LinuxUsbDotOrg is one source of files in the format used by this package.
LinuxUsbDotOrg = "http://www.linux-usb.org/usb.ids"
)
Variables ¶
var ( // Vendors stores the vendor and product ID mappings. Vendors map[gousb.ID]*Vendor // Classes stores the class, subclass and protocol mappings. Classes map[gousb.Class]*Class )
var LastUpdate = time.Unix(0, 1489154954940548227)
LastUpdate stores the latest time that the library was updated.
The baked-in data was last generated:
2017-03-10 09:09:14.940548227 -0500 EST
Functions ¶
func Classify ¶
func Classify(val interface{}) string
Classify returns a human-readable string describing the class, subclass, and protocol associated with a device or interface.
The given val must be one of the following:
- *gousb.DeviceDesc "Class (SubClass) Protocol"
- gousb.InterfaceSetup "IfClass (IfSubClass) IfProtocol"
func Describe ¶
func Describe(val interface{}) string
Describe returns a human readable string describing the vendor and product of the given device.
The given val must be one of the following:
- *gousb.DeviceDesc "Product (Vendor)"
func LoadFromURL ¶
LoadFromURL replaces the built-in vendor and class mappings with ones loaded from the given URL.
This should usually only be necessary if the mappings in the library are stale. The contents of this file as of February 2012 are embedded in the library itself.
func ParseIDs ¶
ParseIDs parses and returns mappings from the given reader. In general, this should not be necessary, as a set of mappings is already embedded in the library. If a new or specialized file is obtained, this can be used to retrieve the mappings, which can be stored in the global Vendors and Classes map.
Types ¶
type Product ¶
A Product contains the name of the product (from a particular vendor) and the names of any interfaces that were specified.