dmidecode

package module
v0.0.0-...-e10c76c Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: MIT Imports: 4 Imported by: 0

README

Go native support for dmidecode -s

Get the module

go get -u github.com/fenglyu/go-dmidecode

Simple Example


import (
	"fmt"
	"log"

	smbios "github.com/fenglyu/go-dmidecode"
)

func main() {

	dmit, err := smbios.NewDMITable()
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(dmit.Version())

	keyword := "system-uuid"
	fmt.Printf("[%s] %s\n", keyword, dmit.Query(keyword))
}

String keyword expected

  bios-vendor
  bios-version
  bios-release-date
  bios-revision
  firmware-revision
  system-manufacturer
  system-product-name
  system-version
  system-serial-number
  system-uuid
  system-family
  baseboard-manufacturer
  baseboard-product-name
  baseboard-version
  baseboard-serial-number
  baseboard-asset-tag
  chassis-manufacturer
  chassis-type
  chassis-version
  chassis-serial-number
  chassis-asset-tag
  processor-family
  processor-manufacturer
  processor-version
  processor-frequency

Implemention Details

The underlying DMI decode/parse is based on go-smbios, Some functions are simply a re-implemention of the C version dmidecode SMBIOS Documention reference DSP0134_3.1.1.pdf

Documentation

Index

Constants

View Source
const (
	KeywordBIOSVendor            = Keyword("bios-vendor")
	KeywordBIOSVersion           = Keyword("bios-version")
	KeywordBIOSReleaseDate       = Keyword("bios-release-date")
	KeywordBIOSRevision          = Keyword("bios-revision")
	KeywordFirmwareRevision      = Keyword("firmware-revision")
	KeywordSystemManufacturer    = Keyword("system-manufacturer")
	KeywordSystemProductName     = Keyword("system-product-name")
	KeywordSystemVersion         = Keyword("system-version")
	KeywordSystemSerialNumber    = Keyword("system-serial-number")
	KeywordSystemUUID            = Keyword("system-uuid")
	KeywordSystemFamily          = Keyword("system-family")
	KeywordBaseboardManufacturer = Keyword("baseboard-manufacturer")
	KeywordBaseboardProductName  = Keyword("baseboard-product-name")
	KeywordBaseboardVersion      = Keyword("baseboard-version")
	KeywordBaseboardSerialNumber = Keyword("baseboard-serial-number")
	KeywordBaseboardAssetTag     = Keyword("baseboard-asset-tag")
	KeywordChassisManufacturer   = Keyword("chassis-manufacturer")
	KeywordChassisType           = Keyword("chassis-type")
	KeywordChassisVersion        = Keyword("chassis-version")
	KeywordChassisSerialNumber   = Keyword("chassis-serial-number")
	KeywordChassisAssetTag       = Keyword("chassis-asset-tag")
	KeywordProcessorFamily       = Keyword("processor-family")
	KeywordProcessorManufacturer = Keyword("processor-manufacturer")
	KeywordProcessorVersion      = Keyword("processor-version")
	KeywordProcessorFrequency    = Keyword("processor-frequency")
)

Variables

View Source
var Table = map[Keyword]*StringKW{}

Table is a map of an entry keyword to entry metadata, according to specification https://www.dmtf.org/sites/default/files/standards/documents/DSP0134_3.4.0.pdf

It is a read-only value.

Functions

This section is empty.

Types

type DMITable

type DMITable struct {
	EntryPoint    smbios.EntryPoint
	SMBIOSStructs []*smbios.Structure
}

func NewDMITable

func NewDMITable() (*DMITable, error)

func (*DMITable) Query

func (dmit *DMITable) Query(keyword Keyword) string

func (*DMITable) Version

func (dmit *DMITable) Version() string

type DMIType

type DMIType uint8

type ErrDecode

type ErrDecode struct {
	Err error
}

func (ErrDecode) Error

func (err ErrDecode) Error() string

func (ErrDecode) Unwrap

func (err ErrDecode) Unwrap() error

type ErrOpenStream

type ErrOpenStream struct {
	Err error
}

func (ErrOpenStream) Error

func (err ErrOpenStream) Error() string

func (ErrOpenStream) Unwrap

func (err ErrOpenStream) Unwrap() error

type Keyword

type Keyword string

type StringKW

type StringKW struct {
	Keyword Keyword
	Type    uint8
	Offset  uint8
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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