Skip to content

Commit 11f9fcf

Browse files
authored
Update serial_windows.go
Remove unnecessary code, originally for checking for disconnects when using non-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
1 parent a77d801 commit 11f9fcf

File tree

1 file changed

+0
-11
lines changed

1 file changed

+0
-11
lines changed

serial_windows.go

-11
Original file line numberDiff line numberDiff line change
@@ -114,17 +114,6 @@ func (port *windowsPort) Read(p []byte) (int, error) {
114114
return 0, nil
115115
}
116116
}
117-
118-
// At the moment it seems that the only reliable way to check if
119-
// a serial port is alive in Windows is to check if the SetCommState
120-
// function fails.
121-
122-
params := &dcb{}
123-
getCommState(port.handle, params)
124-
if err := setCommState(port.handle, params); err != nil {
125-
port.Close()
126-
return 0, err
127-
}
128117
}
129118
}
130119

0 commit comments

Comments
 (0)