USB Serial on Mac (Using GNU Screen)

As a mac user, you can type

screen /dev/tty.usb[press tab]

to see the output from your mbed's printf("Your text here") commands.

If you're finding that line returns look like this:

Some output

           the next line is here

                                its not returning the line!

Then I've found sending \r\n at the end of lines instead of just \n will fix that. I'm sure this is because of some setting in GNU screen, but I can't yet figure out how to change it!


30 Apr 2010

As you can see, the output is continuing on the next line caused by the line feed (\n). In Windows this also means the return of the cariage, however in Linux/Unix this isn't normal.

The best way, also for Windows, is to use the carriage return (\r) if you want the windows new line.

This can be changed in GNU screen, but only by recompiling it, or the configuration of it is hidden.

1 comment on USB Serial on Mac (Using GNU Screen):

18 Dec 2016

I ran into the same issue with GNU screen on MacOS when trying to display the standard output of my NUCLEO boards. Using "...\r\n" is a possible fix, but I absolutely don't like it, because classical Unix programs are all programmed to enter both LF & CR if you printf("some stuff\n");

I saw in the GNU screen man pages that with -inlcr the GNU screen terminal can be setup properly, but I was unable to get it running. To display the output of a NUCLEO board I tried out:

$ screen /dev/tty.usbmodemFD1333 inlcr $ screen /dev/tty.usbmodemFD1333 -inlcr

also the following lines did not work

$ screen /dev/tty.usbmodemFD1333 onlcr $ screen /dev/tty.usbmodemFD1333 -onlcr

I found the following conversation in stack overflow:

http://stackoverflow.com/questions/7812142/how-to-toggle-cr-lf-in-gnu-screen

It did not work on my MacOS Yosemite! Anybody there who knows what's wrong?

Please log in to post comments.