1
0
mirror of https://github.com/kidoman/embd synced 2024-12-22 21:00:05 +01:00

support detection of rpi 2

This commit is contained in:
Karan Misra 2015-02-17 17:04:09 +05:30
parent 69dfee5f75
commit 6af1796f35

View File

@ -86,7 +86,7 @@ func cpuInfo() (model, hardware string, revision int, err error) {
switch { switch {
case strings.HasPrefix(fields[0], "Revision"): case strings.HasPrefix(fields[0], "Revision"):
revs := strings.TrimSpace(fields[1]) revs := strings.TrimSpace(fields[1])
rev, err := strconv.ParseInt(revs, 16, 8) rev, err := strconv.ParseInt(revs, 16, 32)
if err != nil { if err != nil {
continue continue
} }
@ -119,9 +119,9 @@ func DetectHost() (host Host, rev int, err error) {
switch { switch {
case strings.Contains(model, "ARMv7") && (strings.Contains(hardware, "AM33XX") || strings.Contains(hardware, "AM335X")): case strings.Contains(model, "ARMv7") && (strings.Contains(hardware, "AM33XX") || strings.Contains(hardware, "AM335X")):
return HostBBB, rev, nil return HostBBB, rev, nil
case strings.Contains(hardware, "BCM2708"): case strings.Contains(hardware, "BCM2708") || strings.Contains(hardware, "BCM2709"):
return HostRPi, rev, nil return HostRPi, rev, nil
default: default:
return HostNull, 0, fmt.Errorf("embd: your host \"%v:%v\" is not supported at this moment. request support at https://github.com/kidoman/embd/issues", host, model) return HostNull, 0, fmt.Errorf(`embd: your host "%v:%v" is not supported at this moment. request support at https://github.com/kidoman/embd/issues`, host, model)
} }
} }