Configure Virtual Serial Port Driver

Sep 26, 2017  What is a virtual COM port? A virtual COM port or a virtual serial port is an ideal solution when a legacy software application expects a connection to a serial device port (COM port or COMM port) but cannot connect, due to a physical lack of available serial ports.

What is a Virtual COM / Serial Port via USB and where to find more information on VCOM for Intermec printers? How can a COM port be used when only USB is available on the computer? How to configure a Virtual COM / Serial Port over USB for Intermec printers? Where to get a VCOM driver and how to use the driver with an Intermec printer? Virtual Serial Port Driver PRO is an effective, comprehensive application that allows for easy management of physical and virtual serial ports. Its ability to. Virtual Serial Port Driver is a serial port control by Eltima Software. The software provides emulation of virtual serial ports and pairs the available serial ports through a virtual null-modem cable. Two applications paired with this software are enabled to exchange data. The virtual COM port will be removed from the device manager when the USB cable is unplugged, even if an application has the virtual COM port open. The virtual COM port will not be accessible even after the virtual serial device is reconnected unless the virtual COM port is released by the application prior to the reconnection, which may. Virtual Serial Port Driver PRO is an effective, all-inclusive software solution built on the functionality of Virtual Serial Port Driver. Creating bundles of virtual RS232 ports and setting custom port parameters is facilitated by this application, making it a great choice for use in many scenarios.

Clicking on the Download Now (Visit Site) button above will open a connection to a third-party site. Download.com cannot completely ensure the security of the software hosted on third-party sites.
From Eltima Software:
Virtual Serial Port Driver PRO is an effective, comprehensive application that allows for easy management of physical and virtual serial ports. Its ability to customize port parameters and create complex port bundles makes it an ideal solution for many diverse situations. Virtual Serial Port Driver PRO features include the ability to split a single physical COM port into several virtual ports that appear identical to the hardware interface. Physical serial ports and connected devices can be shared by multiple applications. You can redirect data transmission by linking multiple virtual ports to one physical port, allowing your application to receive data simultaneously from all virtual ports through the physical interface. The app supports creation and management of complex port bundles. This allows two-way transmission of serial data by unlimited virtual and physical ports. You can manage hardware control lines by setting a Main Port for both the 'IN' and 'OUT' side of the bundle. Applications that can only take advantage of a limited number of serial ports can use the advanced Switcher feature. This allows several physical ports to be joined into one virtual port. By creating a switcher in your application, your program can use any free serial port when it needs to transmit or receive data. The switcher detects the open ports and offers one to your application. You can also have all ports use the same name and the switcher will provide the same functionality. Merging of serial ports is another advanced feature available in Virtual Serial Port Driver PRO. This option allows you to add unlimited physical and virtual serial ports to any single port bundle that has not been divided into 'IN' and 'OUT' sides. This feature enables all devices and applications to simultaneously communicate with multiple devices or applications. All traffic sent to one port is replicated to all other bundled ports, either physical or virtual.

What do you need to know about free software?

From Eltima Software:
Virtual Serial Port Driver PRO is an effective, comprehensive application that allows for easy management of physical and virtual serial ports. Its ability to customize port parameters and create complex port bundles makes it an ideal solution for many diverse situations. Virtual Serial Port Driver PRO features include the ability to split a single physical COM port into several virtual ports that appear identical to the hardware interface. Physical serial ports and connected devices can be shared by multiple applications. You can redirect data transmission by linking multiple virtual ports to one physical port, allowing your application to receive data simultaneously from all virtual ports through the physical interface. The app supports creation and management of complex port bundles. This allows two-way transmission of serial data by unlimited virtual and physical ports. You can manage hardware control lines by setting a Main Port for both the 'IN' and 'OUT' side of the bundle. Applications that can only take advantage of a limited number of serial ports can use the advanced Switcher feature. This allows several physical ports to be joined into one virtual port. By creating a switcher in your application, your program can use any free serial port when it needs to transmit or receive data. The switcher detects the open ports and offers one to your application. You can also have all ports use the same name and the switcher will provide the same functionality. Merging of serial ports is another advanced feature available in Virtual Serial Port Driver PRO. This option allows you to add unlimited physical and virtual serial ports to any single port bundle that has not been divided into 'IN' and 'OUT' sides. This feature enables all devices and applications to simultaneously communicate with multiple devices or applications. All traffic sent to one port is replicated to all other bundled ports, either physical or virtual.
Active2 years, 5 months ago

I need to test a serial port application on Linux, however, my test machine only has one serial port.

Is there a way to add a virtual serial port to Linux and test my application by emulating a device through a shell or script?

Note: I cannot remap the port, it hard coded on ttys2 and I need to test the application as it is written.

Kara
4,24510 gold badges46 silver badges53 bronze badges
JeffVJeffV
21.1k30 gold badges91 silver badges113 bronze badges

8 Answers

You can use a pty ('pseudo-teletype', where a serial port is a 'real teletype') for this. From one end, open /dev/ptyp5, and then attach your program to /dev/ttyp5; ttyp5 will act just like a serial port, but will send/receive everything it does via /dev/ptyp5.

If you really need it to talk to a file called /dev/ttys2, then simply move your old /dev/ttys2 out of the way and make a symlink from ptyp5 to ttys2.

Of course you can use some number other than ptyp5. Perhaps pick one with a high number to avoid duplicates, since all your login terminals will also be using ptys.

Wikipedia has more about ptys: http://en.wikipedia.org/wiki/Pseudo_terminal

Nikola K.
6,4437 gold badges26 silver badges39 bronze badges
apenwarrapenwarr
9,2294 gold badges41 silver badges55 bronze badges

Complementing the @slonik's answer.

You can test socat to create Virtual Serial Port doing the following procedure (tested on Ubuntu 12.04):

Open a terminal (let's call it Terminal 0) and execute it:

The code above returns:

Open another terminal and write (Terminal 1):

this command's port name can be changed according to the pc. it's depends on the previous output.

you should use the number available on highlighted area.

Driver

Open another terminal and write (Terminal 2):

Now back to Terminal 1 and you'll see the string 'Test'.

cantonicantoni
1,9311 gold badge13 silver badges20 bronze badges
Ahsan
6,8829 gold badges33 silver badges75 bronze badges
slonikslonik

There is also tty0tty http://sourceforge.net/projects/tty0tty/ which is a real null modem emulator for linux.

It is a simple kernel module - a small source file. I don't know why it only got thumbs down on sourceforge, but it works well for me. The best thing about it is that is also emulates the hardware pins (RTC/CTS DSR/DTR). It even implements TIOCMGET/TIOCMSET and TIOCMIWAIT iotcl commands!

On a recent kernel you may get compilation errors. This is easy to fix. Just insert a few lines at the top of the module/tty0tty.c source (after the includes):

Configure Virtual Serial Port Driver Free Download

When the module is loaded, it creates 4 pairs of serial ports. The devices are /dev/tnt0 to /dev/tnt7 where tnt0 is connected to tnt1, tnt2 is connected to tnt3, etc.You may need to fix the file permissions to be able to use the devices.

edit:

I guess I was a little quick with my enthusiasm. While the driver looks promising, it seems unstable. I don't know for sure but I think it crashed a machine in the office I was working on from home. I can't check until I'm back in the office on monday.

The second thing is that TIOCMIWAIT does not work. The code seems to be copied from some 'tiny tty' example code. The handling of TIOCMIWAIT seems in place, but it never wakes up because the corresponding call to wake_up_interruptible() is missing.

edit:

The crash in the office really was the driver's fault. There was an initialization missing, and the completely untested TIOCMIWAIT code caused a crash of the machine.

I spent yesterday and today rewriting the driver. There were a lot of issues, but now it works well for me. There's still code missing for hardware flow control managed by the driver, but I don't need it because I'll be managing the pins myself using TIOCMGET/TIOCMSET/TIOCMIWAIT from user mode code.

If anyone is interested in my version of the the code, send me a message and I'll send it to you.

Peter RemmersPeter Remmers

You may want to look at Tibbo VSPDL for creating a linux virtual serial port using a Kernel driver -- it seems pretty new, and is available for download right now (beta version). Not sure about the license at this point, or whether they want to make it available commercially only in the future.

There are other commercial alternatives, such as http://www.ttyredirector.com/.

In Open Source, Remserial (GPL) may also do what you want, using Unix PTY's. It transmits the serial data in 'raw form' to a network socket; STTY-like setup of terminal parameters must be done when creating the port, changing them later like described in RFC 2217 does not seem to be supported. You should be able to run two remserial instances to create a virtual nullmodem like com0com, except that you'll need to set up port speed etc in advance.

Socat (also GPL) is like an extended variant of Remserial with many many more options, including a 'PTY' method for redirecting the PTY to something else, which can be another instance of Socat. For Unit tets, socat is likely nicer than remserial because you can directly cat files into the PTY. See the PTY example on the manpage. A patch exists under 'contrib' to provide RFC2217 support for negotiating serial line settings.

Configure Virtual Serial Port Driver دانلود

Using the links posted in the previous answers, I coded a little example in C++ using a Virtual Serial Port. I pushed the code into GitHub: https://github.com/cymait/virtual-serial-port-example .

The code is pretty self explanatory. First, you create the master process by running ./main master and it will print to stderr the device is using. After that, you invoke ./main slave device, where device is the device printed in the first command.

And that's it. You have a bidirectional link between the two process.

Using this example you can test you the application by sending all kind of data, and see if it works correctly.

Also, you can always symlink the device, so you don't need to re-compile the application you are testing.

Mauro CiancioMauro Ciancio

Would you be able to use a USB->RS232 adapter? I have a few, and they just use the FTDI driver. Then, you should be able to rename /dev/ttyUSB0 (or whatever gets created) as /dev/ttyS2 .

HowlerHowler
1,7226 gold badges19 silver badges26 bronze badges

I can think of three options:

Implement RFC 2217

RFC 2217 covers a com port to TCP/IP standard that allows a client on one system to emulate a serial port to the local programs, while transparently sending and receiving data and control signals to a server on another system which actually has the serial port. Here's a high-level overview.

What you would do is find or implement a client com port driver that would implement the client side of the system on your PC - appearing to be a real serial port but in reality shuttling everything to a server. You might be able to get this driver for free from Digi, Lantronix, etc in support of their real standalone serial port servers.

You would then implement the server side of the connection locally in another program - allowing the client to connect and issuing the data and control commands as needed.

It's probably non trivial, but the RFC is out there, and you might be able to find an open source project that implements one or both sides of the connection.

Modify the linux serial port driver

Alternately, the serial port driver source for Linux is readily available. Take that, gut the hardware control pieces, and have that one driver run two /dev/ttySx ports, as a simple loopback. Then connect your real program to the ttyS2 and your simulator to the other ttySx.

Use two USB<-->Serial cables in a loopback

But the easiest thing to do right now? Spend $40 on two serial port USB devices, wire them together (null modem) and actually have two real serial ports - one for the program you're testing, one for your simulator.

-Adam

Adam DavisAdam Davis
70.3k54 gold badges241 silver badges321 bronze badges

Not the answer you're looking for? Browse other questions tagged linuxserial-portvirtual-serial-port or ask your own question.