Difference between cu.* and tty.*
Difference between cu.* and tty.*
- Subject: Difference between cu.* and tty.*
- From: Godfrey van der Linden <email@hidden>
- Date: Sat, 21 Nov 2009 13:37:23 +1100
For those that are interested.
Serial ports are commonly misunderstood. Having been involved with them for a while I thought I clear up some of the confusion (to that end I'm cross posting this to darwin dev from the usb list thread).
The two ports are actually named after their traditional usage. A tty.* port was intended to run getty on a directly connected terminal, a terminal that, if wired correctly, asserts DTR (one of the RS232 signals). A getty process using a tty.* serial connection would block in open until the TTY asserted DTR (that is the terminal was switched on).
The cu (call unix) port was used mostly by the uucp family of unix communication tools, that is the unix email system used before the advent of the internet. To cause a typical modem to dial, it was necessary to open the port without waiting for DTR, which is typically only asserted one a connection has been established after dialing. WIth an open port uucp could then issue an AT command and wait for a connection with the other side. With an established connection the modem asserts DTR, from that point on the cu and tty ports are exactly the same. Note with many modems the DTR signal often tracks DCD (carrier detect).
With either port type once a raised DTR signal is dropped the port is disconnected and will start returning EIO errors. This is basically a hint to the client process that things have come to an end and need to terminate all processes in the process group connected to the terminal port.
One problem with this basic design is that sometimes tty or other serial devices are connected using only 3-wires, that is ground, txdata, rxdata. In this case the standard tty port will not open. You have two options in this circumstance. The more difficult option is to loopback the DSR to the DTR on the computer side of the rs232 plug, or alternatively you can open the port with O_NONBLOCK then use tcsetattr to set the CLOCAL flag indicating that DTR should be ignore.
Finally although this is the canonical interface the only serial drivers that I know implement the full RS232 signal protocol are Apple's 16x50 drivers. I'm not sure how much of this signalling is implemented by any other driver, so your milage will vary. In retrospect it perhaps would have been a good idea to document this somewhere ;-).
Cheers
Godfrey
On 2009-11-21, at 7:37 , Jonathon Kuo wrote:
> Hi all,
>
> I managed to procure an FTDI-based dongle, and downloaded the 21-Oct-09 kext for it from FTDI's web site. It works! Compared to the Prolific (PL2303) devices, FTDI is really well supported on OS X. BTW, I get the same results using either the /dev/tty.* or /dev/cu.* ports. I know the .cu is intended as a modem port, but is there a functional difference between it and the .tty*?
>
> Many thanks to everyone who offered suggestions, both on and off list!
> Jon
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden