Sending data to a process along an already open stream.
How does one go about sending data to a process along an already open stream. For instance,
in one terminal:
cat /dev/ttyS0
and then in another terminal:
foobar .... "RING"
(where foobar is some command such that cat will output RING)
At first glance, you would say to use echo "RING" > /dev/ttyS0 , however this sends data
to /dev/ttyS0. I need to send data to the PROCESS reading /dev/ttyS0.
The reason I want to do this is so that i can get mgetty to answer a call without a real ring from the modem (since the call is coming in localy over a telephone line simulator).
Other options I have concidered and am open to suggestion on:
* special configuration of mgetty
* modifying the mgetty source (gulp)
* creating some kind of special device (like a two-way fifo buffer) that can act as a middle man between mgetty and the modem (call it /dev/fakemodem), and then using echo to send charicters as if they were coming from the modem.
Here is a lsof output while cat /dev/ttyS0 is running....
cat 8907 navaburo cwd DIR 8,5 4096 310117 /home/navaburo
cat 8907 navaburo rtd DIR 8,5 4096 2 /
cat 8907 navaburo txt REG 8,5 16504 652802 /bin/cat
cat 8907 navaburo mem REG 8,5 90248 750739 /lib/ld-2.3.2.so
cat 8907 navaburo mem REG 8,5 1254468 1175052 /lib/tls/libc-2.3.2.so
cat 8907 navaburo mem REG 8,5 290576 1550478 /usr/lib/locale/locale-archive
cat 8907 navaburo 0u CHR 136,8 10 /dev/pts/8
cat 8907 navaburo 1u CHR 136,8 10 /dev/pts/8
cat 8907 navaburo 2u CHR 136,8 10 /dev/pts/8
cat 8907 navaburo 3r CHR 4,64 2633 /dev/ttyS0
the last line should give enough information to do this, I just donot know how!
Thanks so much in advance.
|