Closed tve closed 8 years ago
Error: write /sys/class/gpio/gpio34/direction: invalid argument Cause: Function calls seekWrite instead of reading: https://github.com/maruel/dlibox/blob/master/go/pio/host/sysfs/gpio.go#L70 Fix:
write /sys/class/gpio/gpio34/direction: invalid argument
diff --git a/go/pio/host/sysfs/gpio.go b/go/pio/host/sysfs/gpio.go index 35e4b1d..e265853 100644 --- a/go/pio/host/sysfs/gpio.go +++ b/go/pio/host/sysfs/gpio.go @@ -66,8 +66,11 @@ func (p *Pin) Function() string { if err := p.open(); err != nil { return err.Error() } + if _, err := p.fDirection.Seek(0, 0); err != nil { + return err.Error() + } var buf [4]byte - if err := seekWrite(p.fDirection, buf[:]); err != nil { + if _, err := p.fDirection.Read(buf[:]); err != nil { return err.Error() } if buf[0] == 'i' && buf[1] == 'n' {
Error:
write /sys/class/gpio/gpio34/direction: invalid argument
Cause: Function calls seekWrite instead of reading: https://github.com/maruel/dlibox/blob/master/go/pio/host/sysfs/gpio.go#L70 Fix: