7

Edited: I have data acquisition hardware that sends out serial data via UART into FTDI (serial to USB) device. The FTDI is plugged into USB port and its port name is /dev/ttyUSB0. This device outputs data in the following format:

data line 1\r
data line 2\r
...
data line n\r

I tried using screen to view the data by entering the following command:

screen /dev/ttyUSB0 115200

The screen begins to show all data on one line, so I see a single line flashing. How can I add a newline character at the end of each line so that the screen begins to separate the lines?

Original: I am using a serial device that terminates lines with just carriage return. Is it possible to configure screen to add a nl (new-line) character for every cr character?

Thanks...

EDIT: Was not able to get this working with screen, picocom works great. I use the following command picocom -b 115200 --imap crcrlf /dev/ttyUSB0.

  • It isn't clear what problem you're trying to solve. Depending on what you want to do, you can use minicom(1) to talk to your device, set eol character for the line discipline with stty(1), configure getty(1), etc. – lcd047 May 5 '15 at 13:32
  • OK, so my device sends a line via /dev/ttyUSB0 with with format "this is the line\r", is it possible to have screen convert it to "this is the line\r\n" or "this is the line\n\r" I do not care about the order, I just need a newline for every carriage return. Thanks... – user1135541 May 5 '15 at 13:36
  • 1
    Yes, you already said that. Who / what application talks to your device and how? Is it a terminal? A modem? A data aquisition device? A camera? A printer? An unicorn with an USB interface? :) – lcd047 May 5 '15 at 13:41
  • It is a data acquisition device that sends out data via 3 wire UART into FTDI (UART to USB chip), the port name of the FTDI device is /dev/ttyUSB0. – user1135541 May 5 '15 at 14:03
  • 1
    @lcd047 actually, it's a little known feature of screen (that I also didn't know about). I've removed my answer while I chew on a good response. – roaima May 5 '15 at 14:35
6

I know this isn't answering the exact question you have, but I normally jump to miniterm.py when presented with this kind of device because I've never found a way to do what you want with screen.

miniterm.py is minimal like screen and does the 'right thing' by default with \n. On the downside, my fingers don't know how jump around, quit and log, etc, so I still live in hope there's a way to do the right thing in screen

On OS X:

miniterm.py /dev/tty.usbmodem1412

gives me nice output when screen would have scrawled all over the place.

pySerial comes with miniterm.py as far as I understand

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.