Skip to content

Commit

Permalink
Add board info
Browse files Browse the repository at this point in the history
  • Loading branch information
zcalusic committed Sep 24, 2016
1 parent 27fddc1 commit 199be4b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
22 changes: 22 additions & 0 deletions board.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright © 2016 Zlatko Čalušić
//
// Use of this source code is governed by an MIT-style license that can be found in the LICENSE file.

package sysinfo

// Board information.
type Board struct {
Name string `json:"name,omitempty"`
Vendor string `json:"vendor,omitempty"`
Version string `json:"version,omitempty"`
Serial string `json:"serial,omitempty"`
AssetTag string `json:"assettag,omitempty"`
}

func (si *SysInfo) getBoardInfo() {
si.Board.Name = slurpFile("/sys/class/dmi/id/board_name")
si.Board.Vendor = slurpFile("/sys/class/dmi/id/board_vendor")
si.Board.Version = slurpFile("/sys/class/dmi/id/board_version")
si.Board.Serial = slurpFile("/sys/class/dmi/id/board_serial")
si.Board.AssetTag = slurpFile("/sys/class/dmi/id/board_asset_tag")
}
2 changes: 2 additions & 0 deletions sysinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type SysInfo struct {
OS OS `json:"os"`
Kernel Kernel `json:"kernel"`
Product Product `json:"product"`
Board Board `json:"board"`
CPU CPU `json:"cpu"`
Memory Memory `json:"memory"`
Storage []StorageDevice `json:"storage"`
Expand All @@ -30,6 +31,7 @@ func (si *SysInfo) GetSysInfo() {

// Hardware info
si.getProductInfo()
si.getBoardInfo()
si.getCPUInfo()
si.getMemoryInfo()
si.getStorageInfo()
Expand Down

0 comments on commit 199be4b

Please sign in to comment.