Socat virtual serial port not recognized

The Spartan picture The Spartan · Jul 24, 2012 · Viewed 11.4k times · Source

I'm using socat to create a couple virtual serial ports. One I connect to with a simple C program (using termios), and the other I'd like to connect to using a program called Ardupilot Mega Planner (for RC stuff). However, the Planner does not recognize the virtual port (listed under /dev/pts), only the tty devices and /dev/serial devices. Do I need to do some sort of special mount for this to work? Or is there a workaround I could try? I tried "linking" an existing serial port (ttyS0, for example), but I'm getting an "inappropriate ioctl" error if I try anything of the kind (virtual port to real port, real port to real port). Any ideas?

edit: After viewing the source code for the program (Mission Planner), it seems that it only "recognizes" (or adds the ports of) all the /dev/ttyS* devices, the /dev/serial/by-id/* devices, /dev/USB0, and /dev/ACM0. So either I need to edit the source code or find a way to "validate" a ttyS* port. It still appears that the Mission Planner just won't connect to any ttyS* devices other than S1 or S0. Any ideas? I have a feeling it's because they're not configured correctly, somehow.

edit 2: I finally got a hold of the ArdupilotMega Planner source code and changed it so that it includes devices from /dev/pts/. However, I'm still getting the same problem. The Planner gets some sort of problem when it opens the port. Is there some setting that needs to be checked/changed right off the bat for a program to be able to connect to it? Going to research and try to understand serial port communication more thoroughly...

Answer

D. Rouse picture D. Rouse · Jul 25, 2012

Right, just found I couldn't comment on my answer since I didn't have an account. Anyway, try this command:

socat PTY,link=/dev/ttyS10 PTY,link=/dev/ttyS11

and link your programs to ttyS10 and ttyS11.