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

查看:220
本文介绍了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

推荐答案

这个想法是为了补充软件,以在呼入和呼出电话之间共享一条线路.呼入设备(通常为/dev/tty *)用于传入流量.只要DCD没有被硬件断言(即只要调制解调器没有载波),任何试图打开它的进程都会在open()调用中阻塞.在此期间,可以自由使用标注设备(通常为/dev/cu *-cu代表呼叫单位").打开/dev/cu *不需要断言DCD,并且可以立即成功.一旦成功,在callin设备上被阻塞的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.

这样,您就可以在/dev/tty *上听getty,并且仍然可以不受限制地使用/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天全站免登陆