From f54c1104453f132010de01a0c067be6b21efaccb Mon Sep 17 00:00:00 2001 From: Karan Misra Date: Thu, 15 Jan 2015 06:36:01 +0530 Subject: [PATCH] support detection on rpi b+ --- detect.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/detect.go b/detect.go index c0ae7c4..6658d5d 100644 --- a/detect.go +++ b/detect.go @@ -83,15 +83,17 @@ func cpuInfo() (model, hardware string, revision int, err error) { if len(fields) < 1 { continue } - if strings.HasPrefix(fields[0], "Revision") { - rev, err := strconv.ParseInt(fields[1], 16, 8) + switch { + case strings.HasPrefix(fields[0], "Revision"): + revs := strings.TrimSpace(fields[1]) + rev, err := strconv.ParseInt(revs, 16, 8) if err != nil { continue } revision = int(rev) - } else if strings.HasPrefix(fields[0], "Hardware") { + case strings.HasPrefix(fields[0], "Hardware"): hardware = fields[1] - } else if strings.HasPrefix(fields[0], "model name") { + case strings.HasPrefix(fields[0], "model name"): model = fields[1] } }