timeout doesn't happen. Function serial.Read() returned 0 bytes and error==nil and io.ReadFull() continue to work.
Maybe serial.Read() must return io.EOF if timeout happen?
For this, function getOverlappedResult() maybe like this:
func getOverlappedResult(h syscall.Handle, overlapped *syscall.Overlapped) (int, error) {
var n int
_, _, err := syscall.Syscall6(nGetOverlappedResult, 4, // r, _, err := syscall.Syscall6(nGetOverlappedResult, 4,
uintptr(h),
uintptr(unsafe.Pointer(overlapped)),
uintptr(unsafe.Pointer(&n)), 1, 0, 0)
// if r == 0 { // old if
// return n, err
// }
if err == 1460 { // new if, 1460 - ERROR_TIMEOUT
return n, io.EOF
}
if err != 0 {
return n, err
}
return n, nil
}
if I use:
timeout doesn't happen. Function serial.Read() returned 0 bytes and error==nil and io.ReadFull() continue to work. Maybe serial.Read() must return io.EOF if timeout happen? For this, function getOverlappedResult() maybe like this:
Please, fix timeout, thanks