Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MacOS: what's the difference between /dev/tty.* and /dev/cu.*?

Each serial device shows up twice in /dev, once as a tty.* and once as a cu.*.

What is the cu.* device? How does it differ from the tty.* device?

mh@maru ~ --> ls -l /dev/*.usbmodem621 crw-rw-rw-  1 root  wheel   11,   5 Dec 25 18:00 /dev/cu.usbmodem621 crw-rw-rw-  1 root  wheel   11,   4 Dec 25 18:00 /dev/tty.usbmodem621 
like image 606
Mark Harrison Avatar asked Dec 26 '11 02:12

Mark Harrison


People also ask

What is a tty device on Mac?

So, what's the difference? Well, TTY devices are for calling into UNIX systems, whereas CU (Call-Up) devices are for calling out from them (eg, modems). We want to call-out from our Mac, so /dev/cu. * is the correct device to use. The technical difference is that /dev/tty.

What does Dev tty mean?

/dev/tty stands for the controlling terminal (if any) for the current process. To find out which tty's are attached to which processes use the "ps -a" command at the shell prompt (command line). Look at the "tty" column. For the shell process you're in, /dev/tty is the terminal you are now using.

How do you use tty on a Mac?

Only one TTY (TTY1) is available in OSX. To enable tty use fn + ctrl + alt + F1 .

What is a tty port?

TTY is a common trademark-free abbreviation for teletype, a device commonly attached to early computers' serial ports, and * represents a string identifying the specific port; the syntax of that string depends on the operating system and the device.


1 Answers

http://lists.berlios.de/pipermail/gpsd-dev/2005-April/001288.html :

The idea is to supplement software in sharing a line between incoming and outgoing calls. The callin device (typically /dev/tty*) is used for incoming traffic. Any process trying to open it blocks within the open() call as long as DCD is not asserted by hardware (i.e. as long as the modem doesn't have a carrier). During this, the callout device (typically /dev/cu* -- cu stands for "calling unit") can be freely used. Opening /dev/cu* doesn't require DCD to be asserted and succeeds immediately. Once succeeded, the blocked open() on the callin device will be suspended, and cannot even complete when DCD is raised, until the cu device is closed again.

That way, you can have a getty listening on /dev/tty*, and can still use /dev/cu* without restrictions.

like image 158
Tom van der Woerdt Avatar answered Sep 21 '22 08:09

Tom van der Woerdt