Zero modem emulator (com0com) for Linux

I have a project that contains some unitary tests used to test serial communication using COM ports (in windows). I use com0com to create a virtual pair of restricted ports and run tests.

However, I do not know how to do this in Linux nor in MACOS. I read this topic: Is there some kind of program, for example COM0COM in linux? Where the answer suggests using socat. I tried this approach, but it does not work, my application does not detect the ports that I just defined in socat.

socat PTY,link=/dev/COM98 PTY,link=/dev/COM99

My theory is that socat cannot create virtual ports, it can only bind existing ports.

How can I solve this problem?

Thank!

EDIT:

This is what I get after running the previous socat command. If you look carefully, you will see that the COM98 and COM99 ports are in / dev /. However, if I write to / dev / COM 98 and use tail -f to follow COM99, I get no output from it.

enter image description here

EDIT2:

Well, if I use cat instead of a tail, I can see the result (why ?!)

enter image description here

EDIT3:

SOLUTION: Do not name the ports COMxx, but ttySxx instead!

Example:

socat PTY,link=/dev/ttyS98 PTY,link=/dev/ttyS99

Reason: Some serial number libraries may not support other nomenclature, such as RXTX 2.XX and previous versions.

+4
source share
1 answer
socat -d -d pty,raw,echo=0 pty,raw,echo=0

works fine and prints:

2014/05/26 13:29:15 socat[27177] N PTY is /dev/pts/32
2014/05/26 13:29:15 socat[27177] N PTY is /dev/pts/33
2014/05/26 13:29:15 socat[27177] N starting data transfer loop with FDs [3,3] and [5,5]

, /dev/pts/ 32 /dev/pts/ 33.

/dev/COM 9 {8,9} , ?

ls -l /dev/COM989 

, c, .

+4

Source: https://habr.com/ru/post/1542020/


All Articles