github.com/jaypipes/ghw@v0.21.1/pkg/chassis/chassis_linux.go (about)

     1  // Use and distribution licensed under the Apache license version 2.
     2  //
     3  // See the COPYING file in the root project directory for full text.
     4  //
     5  
     6  package chassis
     7  
     8  import (
     9  	"github.com/jaypipes/ghw/pkg/linuxdmi"
    10  	"github.com/jaypipes/ghw/pkg/util"
    11  )
    12  
    13  func (i *Info) load() error {
    14  	i.AssetTag = linuxdmi.Item(i.ctx, "chassis_asset_tag")
    15  	i.SerialNumber = linuxdmi.Item(i.ctx, "chassis_serial")
    16  	i.Type = linuxdmi.Item(i.ctx, "chassis_type")
    17  	typeDesc, found := chassisTypeDescriptions[i.Type]
    18  	if !found {
    19  		typeDesc = util.UNKNOWN
    20  	}
    21  	i.TypeDescription = typeDesc
    22  	i.Vendor = linuxdmi.Item(i.ctx, "chassis_vendor")
    23  	i.Version = linuxdmi.Item(i.ctx, "chassis_version")
    24  
    25  	return nil
    26  }