Create a clean Terminal for a serial line connection

Jan 27, '10 07:30:00AM

Contributed by: kyanha

I looked everywhere on the net to find something that I could afford with which to connect my USB serial port to a Sun machine. I couldn't install Fink or MacPorts, and screen was garbling all of the text for the Solaris install. Finally, I started looking in general UNIX support, which led me to the cu utility.

Use the cu command to get a (more-or-less) clear line. It's part of OSX's BSD heritage, and was originally used to allow UUCP batches to dial modems and link with each other. Here's how to use set up a connection:

sudo cu -s [bitrate] --nostop -l /dev/cu.[serialdevice]
This could also be used with /dev/tty.[serialdevice], I believe, though I have not tried it.

Caveat: If you use the ~ key, make sure you type it twice. Also, the --nostop parameter disables cu interpreting XON/XOFF software flow control. If you don't use it, and the system gets a Control-S character for whatever reason, you will need to type Control-Q to get the output moving again. If you're using the Terminal, you know how to use man(1), so read the man page for cu(1).

Comments (5)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20100122181700528