1

I need to get an application and a monitor to read from the same serial port, the application will be the only program that will be able to read/write to the serial port and the monitor will only be able to read.

I hope to achieve this:

                                      /----->(Application)
---(/dev/ttyUSB0 Serial connection)---
                                      \----->(Monitor)

I hear socat, might be able to do this. But I am unsure on how to do this.

How exactly can I do this? Its a serial connection running at 192K baudrate and I am running it on a Debian Linux system.

user3346931
  • 139
  • 1
  • 7

1 Answers1

2

There is small utility called tee that split stdin into stdout and arbitrary file(s), possibly pipes, that can be red by two or more different applications.

cat /dev/ttyUSB0 | tee somefile1.txt somefile2.txt | application &
tail -F somefile1.txt | monitor &
tail -F somefile2.txt | parser &
Kondybas
  • 6,964
  • 2
  • 20
  • 24