Coder Social home page Coder Social logo

go-smbios's Introduction

go-smbios

Some notes on using this package:

All possible smbios info is document in the spec here.

The underlying DigitalOcean smbios library provides a struct for each smbios structure with the given format below.

type Structure struct {
  Header    Header
  Formatted []byte
  Strings   []string
}

The Formatted section contains the entire byte slice of the structure minus the header, while the Strings section contains a list of all strings that are provided in the structure. Note that strings are only present if the Value type in the specification is of type "STRING". But this means you can easily get string values by their index, so in the example table lower in the README one can assume that Manufacturer will be in Strings[0].

The way the Structure struct works for a given type can also be kind of confusing. For example, in the doc, the table for system info looks like the following:

But it's important to note that if I'm after a field like Wake-up Type, I need to keep in mind that the Formatted byte slice is missing the first 4 bytes of the structure that are stripped out as header info. So if Wake-up Type's offset is 18h (which is the decimal value 24), I need to subtract 4 to get the correct offset location (which is decimal value 20). Thus fetching s.Formatted[20] gives me the byte that points to the wake up value, and I can cross-check that with the info from the spec. This site was also helpful if you don't have your hex->decimal translations memorized.

go-smbios's People

Contributors

andrewrynhard avatar bnason avatar frezbo avatar lion7 avatar rsmitty avatar smira avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.