I'm currently using the following command. It reads from serial ttyUSB0 in local machine, and bidirectionally connects to ssh, through two tee commands for logging. On the remote end, socat connects stdio to the remote ttyUSB0:
stty -F /dev/ttyUSB0 raw 3000000
ssh admin@remote.local stty -F /dev/ttyUSB0 raw 3000000
socat /dev/ttyUSB0,raw,echo=0 SYSTEM:'"tee -a log_l2r | ssh admin@remote.local socat - /dev/ttyUSB0,raw,echo=0 | tee -a log_r2l"',pty,echo=0
-
I want to make sure buffering does not spoil the realtime communication between two robot controllers. Line buffering is ok, but nothing more.
There is many connections in the above command and I'm unsure about potential buffered pipes/sockets. Could you help me spot them? -
Also I need to remove any translation or echo (I believe
stty ... raw ...
already does this). -
Is there some other preferred approach to solving this communication problem? i.e. other command?
Running Debian GNU/Linux – Ubuntu
Best Answer
If you get stdio buffering apply the
stdbuf
command as a prefix to the actual command.stty
probably needs an explicit-echo
.For an alternative, if you don't need ssh encryption, look at the usbip module for making a usb device on one machine visible on another.
To avoid the
tee
logging, just usesocat -v
to get a copy of both data streams on stderr.