gpt4 book ai didi

macos - macOS 上的/dev/tty.* 和/dev/cu.* 有什么区别?

转载 作者:行者123 更新时间:2023-12-02 15:20:52 36 4
gpt4 key购买 nike

每个串行设备在 /dev 中显示两次,一次作为 tty.*,一次作为 cu.*

什么是 cu.* 设备?它与 tty.* 设备有何不同?

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

最佳答案

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.

关于macos - macOS 上的/dev/tty.* 和/dev/cu.* 有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8632586/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com