Skip to content

Commit

Permalink
Remove unnecessary code, originally for checking disconnects
Browse files Browse the repository at this point in the history
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:

bugst#60 (comment)
arduino/arduino-ide#375
  • Loading branch information
palazzol authored and cmaglie committed Nov 24, 2022
1 parent a77d801 commit 1b32e59
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions serial_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}

Expand Down

0 comments on commit 1b32e59

Please sign in to comment.