9

I have a micro-controller device that is sending newline-terminated strings through the USB-attached serial port and (so far) I'm using minicom version 2.6 to read from /dev/ttyACM0. I've setup the terminal application for line wrapping but I'd like it to go to the beginning of the next line when receiving a line feed character from my serial device. Can [and how does] minicom do that?

EDIT: I've also tried ways known by me such as stty /dev/ttyACM0 ...,inlcr and screen /dev/ttyACM0 ...,inlcr, which I know have options to translate incoming new-line into carriage-return+line-feed (CR+LF) and none of these work either. I've tried other options as well (such as ocrnl, in case my logic was wrong, nl and -nl), none work and I don't know why.

Ah, and I'm running Manjaro 16.06-rc1.

6

Took me long enough but here I am at last! I've had to download minicom source code to get an idea what to do to avoid the hassle of constantly pressing Ctrl+Z, U... Here it is.

minicom stores its parameters in a configuration file, which defaults to $HOME/.minirc.dfl. Put the following line, to the letter:

pu addcarreturn    Yes

and now minicom adds a carriage return to all incoming lines. I have no idea why it didn't save that option along with its configuration file in the first place but, heck, I don't care now!

Beware that every option after pu must take exactly 16 characters, padded with spaces to the right.

3

ANSWER:
In minicom press Ctrl+A Z. This will show the menu. Then press U ("Add Carriage Ret"), and minicom will add the CR symbol to each LF symbol automatically.

You may want to do that again in order to turn this function OFF.

WORKAROUND:
Try sending the lines terminating with "\r\n" from the microcontroller.
\r means the Carriage return (ASCII code 13 or 0xd)
\n means the Line feed or New line (ASCII code 10 or 0xa)

  • So I get the answer is «No, it doesn't», right? – user86969 Nov 14 '16 at 21:21
  • @Nasha I have never tried to do that. I just hit the very similar problem and solved it the way I described. So it was not be the answer to your actual question, but rather a work-around suggestion. Please see my edited answer for Minicom v.2.7. – v_2e Nov 15 '16 at 8:18
  • Ok, it seems to work now. Is there a command line argument to avoid doing it all the time interactively? – user86969 Nov 15 '16 at 12:08
  • You can execute minicom -s as root, choose Screen and keyboard, then press T - Add carriage return, and Save setup as dfl to turn this option ON systemwide. Or you can save this configuration in a separate onfig-file, and then use as minicom -D /dev/ttyUSB0 /etc/minicom/minirc.myconfig. Unfortunately, Minicom 2.7 release seems to include an old man page, so these new options are not described there. – v_2e Nov 15 '16 at 17:20
  • Saving the add carriage return option in the configuration file doesn't seem to work. I must go through the setup screens and manually tell minicom to add the carriage return (i.e. Ctrl+Z then U)... Oddly enough when I go to the menu (Ctrl+Z), select configure minicom (O) and then configure the display & keyboard, the option Add carriage return is set to No! Go figure! – user86969 Nov 17 '16 at 10:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy