-
Notifications
You must be signed in to change notification settings - Fork 3
/
type_13_bioslang.go
57 lines (48 loc) · 1.37 KB
/
type_13_bioslang.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package dmi
import (
"fmt"
)
type BIOSLanguageInformationFlag byte
const (
BIOSLanguageInformationFlagLongFormat BIOSLanguageInformationFlag = iota
BIOSLanguageInformationFlagAbbreviatedFormat
)
func NewBIOSLanguageInformationFlag(f byte) BIOSLanguageInformationFlag {
return BIOSLanguageInformationFlag(f & 0xFE)
}
type BIOSLanguageInformation struct {
infoCommon
InstallableLanguage []string
Flags BIOSLanguageInformationFlag
CurrentLanguage string
}
func (b BIOSLanguageInformation) String() string {
return fmt.Sprintf("BIOS Language Information:\n"+
"\tInstallable Languages %s\n"+
"\tFlags: %s\n"+
"\tCurrent Language: %s",
b.InstallableLanguage,
b.Flags,
b.CurrentLanguage)
}
func newBIOSLanguageInformation(h dmiHeader) dmiTyper {
var bl BIOSLanguageInformation
data := h.data
cnt := data[0x04]
for i := byte(1); i <= cnt; i++ {
bl.InstallableLanguage = append(bl.InstallableLanguage, h.FieldString(int(data[i])))
}
bl.Flags = NewBIOSLanguageInformationFlag(data[0x05])
//TODO Fix this
bl.CurrentLanguage = "Fucker" /*bl.InstallableLanguage[data[0x15]]*/
return &bl
}
func GetBIOSLanguageInformation() *BIOSLanguageInformation {
if d, ok := gdmi[SMBIOSStructureTypeBIOSLanguage]; ok {
return d.(*BIOSLanguageInformation)
}
return nil
}
func init() {
addTypeFunc(SMBIOSStructureTypeBIOSLanguage, newBIOSLanguageInformation)
}