Added buffer flush methods
+ serial.Port.ResetInputBuffer() + serial.Port.ResetOutputBuffer()
This commit is contained in:
@@ -49,6 +49,7 @@ var (
|
||||
procCreateEventW = modkernel32.NewProc("CreateEventW")
|
||||
procResetEvent = modkernel32.NewProc("ResetEvent")
|
||||
procGetOverlappedResult = modkernel32.NewProc("GetOverlappedResult")
|
||||
procPurgeComm = modkernel32.NewProc("PurgeComm")
|
||||
)
|
||||
|
||||
func regEnumValue(key syscall.Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, class *uint16, value *uint16, valueLen *uint32) (regerrno error) {
|
||||
@@ -161,3 +162,15 @@ func getOverlappedResult(handle syscall.Handle, overlapEvent *syscall.Overlapped
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func purgeComm(handle syscall.Handle, flags uint32) (err error) {
|
||||
r1, _, e1 := syscall.Syscall(procPurgeComm.Addr(), 2, uintptr(handle), uintptr(flags), 0)
|
||||
if r1 == 0 {
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
} else {
|
||||
err = syscall.EINVAL
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user