Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

linux - How to toggle CR/LF in gnu screen?

I'm using screen to read the text from a serial console. The problem is the output seems to only have newline but not carriage return , so the display looks like this...

Line1
     Line2
          Line3

I wonder if there is any patch to fix this issue?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

onlcr is for translating outgoing newlines to carriage returns.

stty -F /dev/ttyS0 inlcr will translate incoming newlines to carriage returns. You can run that from another terminal after starting screen to avoid any resetting that screen may do on startup. Unfortunately however, this will only change the problem. You'll then get only returns and no newlines.

What is needed is an option to append a return to an incoming newline so that the terminal receives , which is what the serial device should have output in the first place. There seems to be an onlret option to do this for outgoing data, but no inlret option as we would seem to need in this case.

I have the exact same problem (using picocom though) and I've been googling off and on for days trying to find the standard fix, but no one seems to have one. There are a number of serial devices out there which only output and simply can't be made to output and I refuse to believe that all of them belong to only two linux users. What gives!?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...