From c3f4b1f6f84ff99af12433ab905a7abc393fdd8b Mon Sep 17 00:00:00 2001 From: Chris Morgan Date: Thu, 24 Jan 2019 10:23:37 -0500 Subject: [PATCH] pwm_pin - Fix DutyCycle() parse error, need to trim off trailing '\n' before calling strconv.Atoi(), as other functions in this package do --- sysfs/pwm_pin.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sysfs/pwm_pin.go b/sysfs/pwm_pin.go index 5747aded..f003e0a3 100644 --- a/sysfs/pwm_pin.go +++ b/sysfs/pwm_pin.go @@ -148,7 +148,8 @@ func (p *PWMPin) DutyCycle() (duty uint32, err error) { return } - val, e := strconv.Atoi(string(buf)) + v := bytes.TrimRight(buf, "\n") + val, e := strconv.Atoi(string(v)) return uint32(val), e }