Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
chennqqi committed Oct 21, 2023
1 parent 78622fc commit a9abb2d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 2 additions & 3 deletions parser/system/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@ import (
)

// Parse 解析smbios struct数据
func Parse(s *smbios.Structure) (info *Information, err error) {
func Parse(entry *smbios.EntryPoint, s *smbios.Structure) (info *Information, err error) {
defer smbios.ParseRecovery(s, &err)

info = &Information{
Header: s.Header,
Manufacturer: s.GetString(0x0),
ProductName: s.GetString(0x1),
Version: s.GetString(0x2),
SerialNumber: s.GetString(0x3),
UUID: uuid(s.GetBytes(0x04, 0x14), s.GetString(2)),
UUID: uuid(s.GetBytes(0x04, 0x14), entry.HexVersion()),
WakeUpType: WakeUpType(s.GetByte(0x14)),
SKUNumber: s.GetString(0x15),
Family: s.GetString(0x16),
Expand Down
4 changes: 4 additions & 0 deletions smbios/structure.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ type EntryPoint struct {
Revision int `json:"revision,omitempty"`
}

func (e EntryPoint) HexVersion() uint32 {
return 0xFF & (uint32(e.Major)<<8 | (uint32(e.Minor) & 0xFF))
}

// A Header is a Structure's header.
type Header struct {
Type uint8
Expand Down

0 comments on commit a9abb2d

Please sign in to comment.