I'm trying to trace what is transiting in a raw (character) device on an Unix system (ex: /dev/tty.baseband
) for DEBUG purpose.
I am thinking of creating a deamon that would:
- upon start rename
/dev/tty.baseband
to/dev/tty.baseband.old
. - create a raw node
/dev/tty.baseband
spawn two threads:
Thread 1: reading
/dev/tty.baseband.old
writing into/dev/tty.baseband
- Thread 2: reading
/dev/tty.baseband
writing into/dev/tty.baseband.old
This would work a little bit like a MITM process. I wonder if there is not a 'standard' way to do this.