I am connecting to a serial port using screen:
screen /dev/cu.usbserial-A703XAOG. The device on the other end sends only a carriage return to separate lines. Screen only starts at the beginning of the line when receiving a carriage return, and does not go down a line, and thus overwrites the last line of output with the next line of output.
I can change the
icrnl setting of the serial port, and it will convert the carriage return to a line feed. Although screen now goes down a line before writing the next line of output, it doesn't start at the beginning when receiving only a line feed.
I dumped the .termcap file using the Ctrl-A, Ctrl+.. I read up on termcap and I learned that:
If the terminal has a command that moves to the first column of the next line, that command can be given as nw (newline).
So this is my current
termcap SC nw=^M
SC matches the name in the dumped .termcap file.
This does not give the effect that I hoped for. Maybe the
termcap command is not the way to go?
How can I make screen go down a line AND start at the beginning when receiving only CR from a serial device?
Here is the output of
sudo stty -f /dev/cu.usbserial-A703XAOG -a when screen is connected to the serial port:
speed 9600 baud; 0 rows; 0 columns; lflags: -icanon -isig iexten -echo echoe echok echoke -echonl echoctl -echoprt -altwerase -noflsh -tostop -flusho -pendin -nokerninfo -extproc iflags: -istrip -icrnl -inlcr -igncr -ixon -ixoff -ixany -imaxbel -iutf8 -ignbrk brkint -inpck ignpar -parmrk oflags: -opost -onlcr -oxtabs -onocr -onlret cflags: cread cs8 -parenb -parodd -hupcl clocal -cstopb -crtscts -dsrflow -dtrflow -mdmbuf cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = ^@; eol2 = ^@; erase = ^?; intr = ^C; kill = ^H; lnext = ^V; min = 100; quit = ^\; reprint = ^R; start = ^Q; status = ^T; stop = ^S; susp = ^Z; time = 2; werase = ^W;
I understand some software may solve this, for example, in PuTTY I would need to enable the "implicit LF in every CR" setting, and in Serial I would need to enable "Interpret Standalone CR as CRLF". But my question is specifically about
screen, because that is the software I am using currently to connect to the serial port.
Screen emulates the VT100 terminal, and it should recognize control sequences (source). I need to set "Automatic Linefeed Mode" (also known as new line mode). This should be done using the set mode control sequence with the parameter value 20:
ESC [ 20 h.
How can I pass this control sequence to screen?