bugst / go-serial

A cross-platform serial library for go-lang.
BSD 3-Clause "New" or "Revised" License
620 stars 189 forks source link

Allow to set initial RTS and DTR state after connect #47

Closed niondir closed 1 year ago

niondir commented 6 years ago

Closes #46

tehsphinx commented 2 years ago

We would really like to delete our clone (https://github.com/raceresult/go-serial) and go back to using this repository, but we need this merged.

We use the DTR line on our serial hardware to reset it. If we connect to the hardware it sometimes resets before we are able to set the DTR to false via port.SetDTR(false). That must not happen for our use case. Note that this only is an issue on Windows.

niondir commented 2 years ago

@tehsphinx Same for me ;) We use this in production since years in our fork ...

cmaglie commented 1 year ago

Hey! ok.. let's get this merged...

My only concern is that this is a breaking change: if InitialRTS or InitialDTR is not specified it now defaults to false for example:

port, err := serial.Open("COM1", &serial.Mode{Baudrate:115200})  // This now defaults to DTR & RTS off...

I'm going to push another PR, based on this one, that will default both pins to true.

cmaglie commented 1 year ago

Superseded by #140