虽然这可以按预期工作:
root@LIM:~# socat -d -d pty pty
2017/10/15 01:01:49 socat[91] N PTY is /dev/pts/0
2017/10/15 01:01:49 socat[91] N PTY is /dev/pts/1
2017/10/15 01:01:49 socat[91] N starting data transfer loop with FDs [5,5] and [7,7]
包括任何参数都会导致socat失败:
root@LIM:~# socat -d -d pty,echo=0 pty
2017/10/15 01:04:56 socat[92] N PTY is /dev/pts/0
2017/10/15 01:04:56 socat[92] E tcsetattr(5, TCSADRAIN, 0x7fffdafe8be0): Invalid argument
2017/10/15 01:04:56 socat[92] N exit(1)
我正在关注this SO advice,this tutorial和this blog,最终想要运行可能类似于socat -d -d pty,link=/dev/ttyS0,raw,echo=0 pty,link=/dev/ttyS1,raw,echo=0
的命令,为COM1建立一对虚拟串口和COM2。
我在Windows上使用Ubuntu上的Bash:
root@LIM:~# socat -V
socat by Gerhard Rieger - see www.dest-unreach.org
socat version 1.7.3.1 on Feb 2 2016 21:25:06
running on Linux version #1-Microsoft Wed Dec 31 14:42:53 PST 2014, release 4.4.0-43-Microsoft, machine x86_64
features:
#not shown for brevity
root@LIM:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.3 LTS
Release: 16.04
Codename: xenial
C:\Users\Aaron Borns>ver
Microsoft Windows [Version 10.0.15063]
导致Invalid argument
错误的命令有什么问题?谢谢你的帮助!