Difference between cu.* and tty.*

For those that are interested.

 

Serial ports are commonly misunderstood.  Having been involved with them for a while Ithought I clear up some of the confusion (to that end I'm cross posting this todarwin dev from the usb list thread).

 

The two ports are actually named after theirtraditional usage.  A tty.* port wasintended to run getty on a directly connected terminal, a terminal that, ifwired correctly, asserts DTR (one of the RS232 signals).  A getty process using a tty.* serialconnection would block in open until the TTY asserted DTR (that is the terminalwas switched on).

 

The cu (call unix) port was used mostly bythe uucp family of unix communication tools, that is the unix email system usedbefore the advent of the internet.  Tocause a typical modem to dial, it was necessary to open the port withoutwaiting for DTR, which is typically only asserted one a connection has beenestablished after dialing.  WIth an openport uucp could then issue an AT command and wait for a connection with theother side.  With an establishedconnection the modem asserts DTR, from that point on the cu and tty ports areexactly the same.  Note with many modemsthe DTR signal often tracks DCD (carrier detect).

 

With either port type once a raised DTRsignal is dropped the port is disconnected and will start returning EIOerrors.  This is basically a hint to theclient process that things have come to an end and need to terminate allprocesses in the process group connected to the terminal port.

 

One problem with this basic design is thatsometimes tty or other serial devices are connected using only 3-wires, that isground, txdata, rxdata.  In this case thestandard tty port will not open.  Youhave two options in this circumstance. The more difficult option is to loopback the DSR to the DTR on thecomputer side of the rs232 plug, or alternatively you can open the port withO_NONBLOCK then use tcsetattr to set the CLOCAL flag indicating that DTR shouldbe ignore.

 

Finally although this is the canonicalinterface the only serial drivers that I know implement the full RS232 signalprotocol are Apple's 16x50 drivers.   I'mnot sure how much of this signalling is implemented by any other driver, soyour milage will vary. In retrospect it perhaps would have been a good idea todocument this somewhere ;-).

 

Cheers

 

Godfrey

 

On 2009-11-21, at 7:37 , Jonathon Kuo wrote:

 

> Hi all,

> I managed to procure an FTDI-baseddongle, and downloaded the 21-Oct-09 kext for it from FTDI's web site. Itworks! Compared to the Prolific (PL2303) devices, FTDI is really well supportedon 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 functionaldifference between it and the .tty*?

> Many thanks to everyone who offeredsuggestions, both on and off list!

> Jon

 

 _______________________________________________

Do not post admin requests to the list. Theywill be ignored.

Usb mailing list      (email@hidden)

Help/Unsubscribe/Update your Subscription:

 

This email sent to email@hidden

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值