个人工具
119.28.94.63
该IP地址的讨论
登录
查看“UbuntuHelp:VirtualSerialPort”的源代码 - Ubuntu中文
UbuntuHelp
讨论
查看源代码
历史
搜索
导航
首页
最近更改
随机页面
页面分类
帮助
编辑
编辑指南
沙盒
新闻动态
字词处理
工具
链入页面
相关更改
特殊页面
页面信息
查看“UbuntuHelp:VirtualSerialPort”的源代码
来自Ubuntu中文
←
UbuntuHelp:VirtualSerialPort
跳转至:
导航
,
搜索
因为以下原因,你没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
{{From|https://help.ubuntu.com/community/VirtualSerialPort}} {{Languages|UbuntuHelp:VirtualSerialPort}} == Introduction == Virtual serial ports are commonly used in development of programs using serial connection as well as debugging existing applications - to check what kind of data is transmitted over a serial connection. The idea of virtual serial port is to create two virtual serial ports linked with a null modem cable, attaching one end to tested application and the other end to (usually) serial terminal (e.g. Cutecom). == Installing prerequisites == To create a pair of ports you will need a utility called "socat". It is located in "universe" repository, so you should be able to find it in Synaptic. Alternatively install using <pre><nowiki> sudo apt-get install socat </nowiki></pre> == Creating ports == After installing socat you have to execute following command: <pre><nowiki> socat PTY: PTY: </nowiki></pre> That should create and link the virtual port pair for as long as socat is running. If you are like me and want a little more feedback on what is happening instead of a command line that is hanging, use verbose mode instead: <pre><nowiki> socat -d -d PTY: PTY: </nowiki></pre> You can put the -d argument up to four times, increasing the information fed back to you each time. === Checking file names === ==== Using socat ==== The easiest way to tell which file names are assigned to these virtual ports is to tell socat to print information about opened pseudo terminals during initialization using following options (verbose mode): <pre><nowiki> socat -d -d PTY: PTY: </nowiki></pre> Your applicantion should connect to these files. ==== Using lsof ==== Another way is to list socat's open files: <pre><nowiki> lsof -c socat </nowiki></pre> You should notice file /dev/ptmx, that is pseudo terminal multiplexer and directly below each entry should be listed /dev/pts/X file, which are the ends of created pair. == External Links == * [http://en.wikipedia.org/wiki/Pseudo_terminal Pseudo terminals] * [http://www.dest-unreach.org/socat/ socat homepage] * [http://en.wikipedia.org/wiki/COM_port_redirector Com port redirector (with list of software implementing this technique)] * [http://en.wikipedia.org/wiki/Serial_port Serial port] [[category:UbuntuHelp]]
该页面使用的模板:
模板:From
(
查看源代码
)
模板:Languages
(
查看源代码
)(受保护)
模板:Languages/Lang
(
查看源代码
)(受保护)
返回至
UbuntuHelp:VirtualSerialPort
。