steve_thorley has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,

Sorry if the is a stupid question but I need a bit of guidance. I have a Solaris SPARC machine with a serial port GPS but I have two software applications that need to read the serial port for GPS data. Is there a way to make a bridge or virtual port in PERL I had a look at the CPAN modules but they seem to cover connecting to serial not creating a serial port.

THX Steve

Replies are listed 'Best First'.
Re: serial port bridge (virtual)
by GrandFather (Saint) on Feb 20, 2011 at 23:40 UTC

    Faking a serial port like that would be tricky in any language, but particularly tricky for a scripting language that isn't designed to run in driver space. Depending on the degree of control you have over the applications you may be able to write a Perl daemon that connects to the GPS serial port and provides pre-digested GPS information to applications.

    True laziness is hard work

      I have found a solution all be it not very elegant.

      I'm not using perl at all.

      I used mkfifo to create two files

      then "cat /dev/ttya | tee /fifo.file1 | cat > /fifo.file2 &"
         cat /dev/ttya | tee /fifo.file1 | cat > /fifo.file2 &

        You can most likely get rid of the second cat, because '| cat >' is the same as '>', wrt functionality:

        $ echo foo | cat > myfile $ cat myfile foo $ echo foo > myfile $ cat myfile foo