How to trace a raw (character) device stream on Unix ?

Posted by Fabien on Stack Overflow See other posts from Stack Overflow or by Fabien
Published on 2010-05-03T03:05:47Z Indexed on 2010/05/03 3:18 UTC
Read the original article Hit count: 312

Filed under:
|

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.

© Stack Overflow or respective owner

Related posts about unix

Related posts about daemon