stty allows to read a serial port configuration. I have noticed that when some program opens, configures and later closes a serial port the last serial port configuration is still present in the system. When it reset to the defaults ? Only during reboot ?
-
Welcome to Unix&Linux ;-) Could you please edit your question and provide a bit more info on what you want to do exactly? The answer to "When" is indeed "When no programs are using stty"...– FabbySep 18, 2018 at 14:39
-
3This question has been altered by Goro from what the original questioner actually asked, which was not when can it be reset but when is it reset. Goro also introduced the erroneous division of the second sentence in twain.– JdeBPSep 18, 2018 at 14:44
-
@JdeBP that's quite outrageous, and it's not the first [time] (unix.meta.stackexchange.com/questions/5000/…). Can something be done about it?– user313992Sep 18, 2018 at 18:13
-
Is the serial port removable, for example is it a device that you're plugging into a USB port?– Mark PlotnickOct 4, 2018 at 2:19
1 Answer
The serial port configuration will take the default values after a reboot as you mention, you can reset some of the default parameters values by using stty sane
, you need to indicate the device using -F
:
stty -F /dev/ttyS0 sane
Use stty --help
to see the list of affected parameters for sane
.