1

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 ?

4
  • 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"...
    – Fabby
    Sep 18, 2018 at 14:39
  • 3
    This 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.
    – JdeBP
    Sep 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?
    – user313992
    Sep 18, 2018 at 18:13
  • Is the serial port removable, for example is it a device that you're plugging into a USB port? Oct 4, 2018 at 2:19

1 Answer 1

2

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .