使用Qt打开由SOCAT创建的虚拟串行端口 [英] Opening a virtual serial port created by SOCAT with Qt

查看:463
本文介绍了使用Qt打开由SOCAT创建的虚拟串行端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在MacOS上开发Qt5应用程序.

I'm developping a Qt5 application on MacOS.

我想测试我的应用程序的串口通信.

I would like to test my application serial port communication.

我想使用 socat ,但无法打开创建的端口使用socat: QSerialPortInfo :: availablePorts()仅列出/dev/cu-XXXXXX 端口...

I'd like to use socat but I'm unable to open the port created with socat: QSerialPortInfo::availablePorts() lists only the /dev/cu-XXXXXX ports...

推荐答案

Socat端口创建示例:

Socat port creation example:

socat  pty,link=/dev/mytty,raw  tcp:192.168.254.254:2001&

此后,您将获得伪端口/dev/mytty

After this you get your pseudo port /dev/mytty

现在,您可以通过 QSerialPort引用此端口

serial = new QSerialPort("/dev/mytty");

这篇关于使用Qt打开由SOCAT创建的虚拟串行端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆