git.sr.ht/~pingoo/stdx@v0.0.0-20240218134121-094174641f6e/sysinfo/product.go (about)

     1  // Copyright © 2016 Zlatko Čalušić
     2  //
     3  // Use of this source code is governed by an MIT-style license that can be found in the LICENSE file.
     4  
     5  package sysinfo
     6  
     7  // Product information.
     8  type Product struct {
     9  	Name    string `json:"name,omitempty"`
    10  	Vendor  string `json:"vendor,omitempty"`
    11  	Version string `json:"version,omitempty"`
    12  	Serial  string `json:"serial,omitempty"`
    13  }
    14  
    15  func (si *SysInfo) getProductInfo() {
    16  	si.Product.Name = slurpFile("/sys/class/dmi/id/product_name")
    17  	si.Product.Vendor = slurpFile("/sys/class/dmi/id/sys_vendor")
    18  	si.Product.Version = slurpFile("/sys/class/dmi/id/product_version")
    19  	si.Product.Serial = slurpFile("/sys/class/dmi/id/product_serial")
    20  }