My boss at work needs to be making a monitoring app for a program they are using. Because of their business needs, I can NOT use any sort of virtual serial port. The data goes in and out of /dev/ttyUSB0, and the application MUST be connected to /dev/ttyUSB0.

I have already discussed a design that utilizes virtual serial ports created by socat so I can get what goes in and out the serial port, without interrupting the transfer of data. But that design was rejected. And he suggested that I make it through something called Port Mirroring or Reading the information without using up the resource like apparently Putty can do in Windows.

I am a huge lost at what to do, or how to approach this.

1 Answer 1


The easiest is probably to monitor in hardware. However, in software, I think you can rename the tty to be a pty instead! /dev filenames are not magic-they are friendly ways of referring to drivers by number. Make a Pty (or Unix-domain socket), rename the real tty (/dev/ttyUSB0) to /dev/magicserial, and rename your new endpoint to the name of the real tty. Then you are totally in control! Write a daemon that runs aselect loop to copy all data between magicserial and your endpoint, and you can monitor whatever you want. Not trivial, but it should work fine.

Here's an example Pty tutorial.

You must log in to answer this question.

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