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

后端 未结 1 610
小鲜肉
小鲜肉 2020-12-04 12:02

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

What is the cu.* device? How does

1条回答
  •  有刺的猬
    2020-12-04 12:29

    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.

    0 讨论(0)
提交回复
热议问题