Virtual Serial Port on Ubuntu
2013-09-26 22:11
561 查看
Contents Introduction Installing prerequisites Creating ports Checking file names External Links |
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 usingsudo apt-get install socat
Creating ports
After installing socat you have to execute following command:socat PTY: PTY:
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:
socat -d -d PTY: PTY:
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):socat -d -d PTY: PTY:
Your applicantion should connect to these files.
Using lsof
Another way is to list socat's open files:lsof -c socat
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.
相关文章推荐
- Using Virtual Serial Ports on Linux (Ubuntu)
- JAVA: Serial Port access with javax.comm or rxtx on Windows, Linux etc.
- virtualenv and virtualenvwrapper on Ubuntu 14.04
- How to Install Oracle VirtualBox 5.1 on Ubuntu 16.04 & 15.10 and Debian 8/7
- 虚拟串口程序Virtual.Serial.Port.Driver
- Communication on a serial port in NET 2.0
- run virtualbox on ubuntu server
- Set up a svn server on a virtual ubuntu
- 我的ARM Cortex4学习(一):(CCSV5+win7+LM4F232H5QD)stellaris virtual serial port安装驱动的时候系统找不到指定的文件
- WIZnet推出虚拟串口(Virtual Serial Port)
- Virtual Serial Port - RFC2217
- How To Set Up Nginx Server Blocks (Virtual Hosts) on Ubuntu
- 好软件推荐:虚拟串口,virtual serial port,virtual com,com0com,用不着serialnull(全是关
- Apache配置基于端口号的虚拟主机 Apache virtual host configuration is based on the port
- 解决[warn] _default_ VirtualHost overlap on port 80, the first has precedence问题
- How To Set Up Apache Virtual Hosts on Ubuntu 14.04 LTS
- connect android-x86 on virtualbox ubuntu
- 解决:配置虚拟主机,重启apache,[warn] _default_ VirtualHost overlap on port 80, the first has precedence
- VirtualBox Guest Additions install on Ubuntu and RHEL
- How to terminate console on serial port (UART)