10

I've one serial device on 192.168.x.x:yyyy (where "x" and "y" are real number) and it works correctly. But I want to communicate with this as /dev/ttyX device.

I've tested socat command but not working correctly

$ while true; do
    socat pty,link=/dev/ttyX,raw,echo=0,waitslave tcp:192.168.x.x:yyyy; 
done

How can I resolve?

update

  • I think that I must be creating a virtual serial device. VIRTUAL SERIAL DEVICE <-> SERIAL-MACHINE-IP:PORT
slm
  • 363,520
  • 117
  • 767
  • 871
Domenico M.
  • 241
  • 1
  • 2
  • 8

1 Answers1

4

This solved the problem:

$ socat -d -d pty,link=/dev/CUSTOMNAME,raw,echo=0,waitslave tcp:192.168.x.x:yyyy;
slm
  • 363,520
  • 117
  • 767
  • 871
Domenico M.
  • 241
  • 1
  • 2
  • 8
  • 1
    What is the proper way to create `/dev/CUSTOMNAME`? I get `socat[12316] E symlink("/dev/pts/5", "/dev/MYDEVICE"): Permission denied` when trying to do `sudo socat TCP4-LISTEN:9000,reuseaddr,fork,su=nobody PTY,link=/dev/MYDEVICE,raw,echo=0,waitslave` – jacobq Aug 14 '17 at 13:19
  • Nevermind; I think the `su=nobody` was the problem. When I removed that it worked. – jacobq Aug 14 '17 at 13:20