diff --git a/serial_windows.go b/serial_windows.go index e2c40f5..ec328f9 100644 --- a/serial_windows.go +++ b/serial_windows.go @@ -75,7 +75,6 @@ func (port *windowsPort) Close() error { func (port *windowsPort) Read(p []byte) (int, error) { var readed uint32 - params := &dcb{} ev, err := createOverlappedEvent() if err != nil { return 0, err @@ -107,6 +106,7 @@ func (port *windowsPort) Read(p []byte) (int, error) { // 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()