Skip to content

Commit

Permalink
try fallback to use sysfs of DMI block to decode memory info
Browse files Browse the repository at this point in the history
  • Loading branch information
Haraguroicha authored and zcalusic committed Mar 13, 2019
1 parent 591bbf4 commit 9dc8824
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"bytes"
"encoding/binary"
"errors"
"io/ioutil"
"os"
"strconv"
"strings"
Expand Down Expand Up @@ -125,7 +126,11 @@ func getStructureTableAddress(f *os.File) (address int64, length int, err error)
func getStructureTable() ([]byte, error) {
f, err := os.Open("/dev/mem")
if err != nil {
return nil, err
dmi, err := ioutil.ReadFile("/sys/firmware/dmi/tables/DMI")
if err != nil {
return nil, err
}
return dmi, nil
}
defer f.Close()

Expand Down

0 comments on commit 9dc8824

Please sign in to comment.