Open tylerstillwater opened 7 years ago
I think there is a bug in Flush
function defined in serial_linux.go
line 144-153. According to manual (https://golang.org/pkg/syscall/#Syscall), Syscall will return Errno
(https://golang.org/pkg/syscall/#Errno) and need to be converted properly to error (i.e. errno 0
is not error
). The implementation of Flush
function need to be changed to:
func (p *Port) Flush() error {
const TCFLSH = 0x540B
_, _, errno := syscall.Syscall(
syscall.SYS_IOCTL,
uintptr(p.f.Fd()),
uintptr(TCFLSH),
uintptr(syscall.TCIOFLUSH),
)
if errno == 0 {
return nil
}
return errno
}
I'm using
serial
on an rPi3 and it seems to work fine, except for theFlush
call. It returns an error with "errno 0". This call works great on Darwin when using the same USB<->Serial adapter.I'm not sure how to diagnose this further.