'tee'ing /dev/pty to stdio AND somewhere else (file/ or other device)

310 Views Asked by At

Thanks in advance for either answering my specific question OR letting me know if there is a better way to accomplish what I am trying to do altogether.

I'll start out with the specific question:

I have a serial program writing to and reading from /dev/ttyp0, and if I run

cat -v /dev/ptyp0

I can see the ASCII characters the program is outputting as it runs. Great, just what I wanted.

But now I want to display those characters AND tee it to another device (a serial port - via a USB to serial adapter).

I was thinking it would work to run

cat -v /dev/ptyp0 | tee /dev/tty.USA19H62P1.1 

But the result of that is no output whatsoever - on my screen nor the device. I thought maybe I'd try teeing it off into a file to make sure I was using tee correctly:

cat -v /dev/ptyp0 | tee file.txt

but still nothing at all. Empty file.txt, empty terminal on sreen. What am I doing wrong? I am running OSX 10.8.4 by the way.

Now here's the boarder picture of what I am doing: I have an emulator program (Basilisk II) emulating a Macintosh machine running Mac OS 7.5.3. I am trying to get a specialty program to talk to a hardware device, an old audio multi-effect unit, via RS-232. It works, but unreliably, and I have a feeling it is because of timing problems, i.e. the older Mac software has an extremely low timeout length when it pings the device, and the latency between the program though the emulator software, through the USB-serial device, causes the program to time-out, either repeatedly, or as low as 10% of the time, depending on a variety of other factors. I am trying to snoop on the serial communication to get some insight on the communication between the software and the hardware unit, and using a psuedoterminal to send the communication through and teeing it off so I can view it on my screen seems most logical. All the communication is ASCII characters, and I have a nice thick manual describing which character sequences correspond to which commands, and what the units response should be.

Is there a better way to go about this?

0

There are 0 best solutions below