Remove unnecessary code, originally for checking disconnects
The old code is no more needed when using overlapped I/O, getOverlappedEvent() returns all required error codes. Calling getCommState()/setCommState() every second in some applications contributes to other downstream issues. For examples: https://github.com/bugst/go-serial/issues/60#issuecomment-625749122 https://github.com/arduino/arduino-ide/issues/375
This commit is contained in:
committed by
Cristian Maglie
parent
a77d80189a
commit
1b32e59871
@@ -114,17 +114,6 @@ func (port *windowsPort) Read(p []byte) (int, error) {
|
||||
return 0, nil
|
||||
}
|
||||
}
|
||||
|
||||
// At the moment it seems that the only reliable way to check if
|
||||
// a serial port is alive in Windows is to check if the SetCommState
|
||||
// function fails.
|
||||
|
||||
params := &dcb{}
|
||||
getCommState(port.handle, params)
|
||||
if err := setCommState(port.handle, params); err != nil {
|
||||
port.Close()
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user