MacOS:/dev/tty.* 和/dev/cu.* 有什么区别? [英] MacOS: what's the difference between /dev/tty.* and /dev/cu.*?

查看:30
本文介绍了MacOS:/dev/tty.* 和/dev/cu.* 有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每个串行设备在 /dev 中出现两次,一次是 tty.*,一次是 cu.*.

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

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

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

推荐答案

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

这个想法是补充软件在呼入和呼出之间共享一条线路.调用设备(通常是/dev/tty*)用于传入流量.只要硬件未声明 DCD(即,只要调制解调器没有载波),任何试图打开它的进程都会在 open() 调用中阻塞.在此期间,可以自由使用标注设备(通常是/dev/cu*——cu 代表调用单元").打开/dev/cu* 不需要断言 DCD 并立即成功.一旦成功,调用设备上被阻塞的 open() 将被挂起,甚至在 DCD 被提升时无法完成,直到 cu 设备再次关闭.

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.

这样,您可以让 getty 监听/dev/tty*,并且仍然可以不受限制地使用/dev/cu*.

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

这篇关于MacOS:/dev/tty.* 和/dev/cu.* 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆