无法识别Socat虚拟串行端口 [英] Socat virtual serial port not recognized
问题描述
我正在使用socat创建几个虚拟串行端口.我使用一个简单的C程序(使用termios)连接到另一个,而我想要使用一个称为Ardupilot Mega Planner的程序(用于RC东西)连接到另一个.但是,Planner无法识别虚拟端口(在/dev/pts下列出),只能识别tty设备和/dev/serial设备.我需要做某种特殊的安装才能工作吗?还是有我可以尝试的解决方法?我尝试链接"现有的串行端口(例如,ttyS0),但是如果尝试任何类型的操作(从虚拟端口到实际端口,从真实端口到真实端口),都会收到不正确的ioctl"错误.有什么想法吗?
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:查看程序(Mission Planner)的源代码后,似乎它只能识别"(或添加以下端口)所有/dev/ttyS *设备,/dev/serial/by- id/*设备,/dev/USB0和/dev/ACM0.因此,我需要编辑源代码或找到一种方法来验证" ttyS *端口.看来,任务计划程序只是不会连接到S1或S0以外的任何ttyS *设备.有任何想法吗?我觉得这是因为它们以某种方式未正确配置.
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:我终于掌握了ArdupilotMega Planner源代码并将其更改为包含/dev/pts/中的设备.但是,我仍然遇到同样的问题.规划器在打开端口时遇到某种问题.是否需要立即进行某些设置检查/更改才能使程序连接到该设置?要进行研究并尝试更全面地了解串行端口通信...
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...
推荐答案
我遇到了同样的问题,并通过tcp发送串行内容解决了该问题:
I have had the same problem and solved it with sending the serial stuff over tcp:
socat tcp-l:5760 /dev/YOURPORT,raw,echo=0,bHEREBAUDRATE
然后在Misson Planner中选择"TCP",服务器:127.0.0.1,端口:5760
Then in Misson planner choose "TCP", Server: 127.0.0.1, Port: 5760
我可以通过这种方式成功连接到模拟串行端口.
I can successfully connect in this way to an emulated serial port.
这篇关于无法识别Socat虚拟串行端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!