Skip to content

Instantly share code, notes, and snippets.

@PyroAVR
Last active March 31, 2025 17:48
Show Gist options
  • Save PyroAVR/2ba2b3ad51c7f902cbfe6b7a8ba3912a to your computer and use it in GitHub Desktop.
Save PyroAVR/2ba2b3ad51c7f902cbfe6b7a8ba3912a to your computer and use it in GitHub Desktop.
Mirror a serial port with socat
socat /dev/ttyUSB2,rawer system:'tee in.log | socat stdio "pty,rawer,link=/tmp/relay" | tee out.log'
# this doesn't seem to work with all applications, but it's a start. Redirect your application to talk to /tmp/relay instead of /dev/ttyUSB2, in this example.
# IOCTLs are not transferred, so you may need to set the port speed manually with stty -F <port> <speed> <settings>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment