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  [email protected] stty -F /dev/ttyUSB0 raw 3000000

socat /dev/ttyUSB0,raw,echo=0 SYSTEM:'"tee -a log_l2r | ssh  [email protected] socat - /dev/ttyUSB0,raw,echo=0  | tee -a log_r2l"',pty,echo=0
  1. 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?

  2. Also I need to remove any translation or echo (I believe stty ... raw ... already does this).

  3. Is there some other preferred approach to solving this communication problem? i.e. other command?

Running Debian GNU/Linux - Ubuntu

1 Answer 1


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 use socat -v to get a copy of both data streams on stderr.

  • Those are great suggestions. Indeed I missed the explicit -echo. Fixed above. Thanks!
    – AndresR
    Commented Nov 9, 2016 at 9:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .