[CentOS] resetting a serial port

Thu Dec 14 13:48:06 UTC 2023
Robert Moskowitz <rgm at htt-consult.com>

How do I kill the shell session on ttyS0?

ls did nothing.
nor stty sane

but I think I saw all those characters echoed back.

On 12/14/23 00:04, Jon LaBadie wrote:
> On Wed, Dec 13, 2023 at 08:45:31PM -0500, Robert Moskowitz wrote:
>> I have Centos 7 arm32 running on a Cubieboard and I am logged in as root
>> on its serial uart from another system.
>>
>> On that system I use
>>
>> screen /dev/ttyUSB0 115200
>>
>> Well it was working well for a couple days, but now only garbage comes
>> across.  Something messed up the serial link.
>>
>> pulling the usb cable to the usb/serial adapter does not reset things.
>>
>> I can ssh into the server and see root logged into ttyS0
>>
>> How do I reset that serial port so that I can work on the system?
>>
>> thanks
>>
>
> Channeling old memories of serial communications :((
>
> Sounds like you are still connected.  One way to tell is
> to pretend things are working even if you only see garbage.
>
> For example, if you press <Enter> several times, do you
> get the same garbage each time (likely the shell prompt
> coming back to you).
>
> If after an Enter and return garbage you type ls<Enter>
> is the garbage different, probably larger, and likely
> ending with the same garbage as a solo <Enter> (the prompt)
>
> Then try to reset your stty communication settings by
> carefully typing
>
>   stty sane<Enter>
>
> Don't try to correct typo's, just hit enter and start again.
>
> Should that not work, ssh back in and kill the shell session
> on ttyS0.  Typically the communication settings are returned
> to a default set by a program called getty which then exec's
> into the login program.
>
> Good luck.
>