Thats what I would try:
open(COM,"< /dev/ttyS0")
Then try the rewind. I have a few examples of reading serial ports that seem to work on linux, if you want I could mail them off to you. You might want to look at Device::SerialPort;

Here is a nice explanation-script I found once on the net.

#!/usr/bin/perl + + + + #the ubiquitous RS-232 Serial Port. built an interface + + #for my Aware Electronics Geiger Counter (RM-70) that + + #used a Basic Stamp IISX chip set. Every 20 seconds it + + #would spit out an ASCII string of radiation and + + #temperature data. I had hunted around for examples + + #using the Device::SerialPort module and found many. + + #Most were copies of code used to read PBX data. But + + #it wouldn't work. Ouch. Finally, after much research + + #I realized that - by golly - you had to terminate + + #the IO with a new line and not a carriage return. + + #Oddly doing a cat </dev/ttyS0 worked, which faked me + + #out. So I added the line in the tty setup below that + + #converts CR to NL and zap-ity-do-dah it started terminating + + #and sending each read. Long live RS-232. Please send + + #along any suggestions and improvements. This also probably + + #explains why I had failed to get good reads from a + + #cheap-o RS-232 capable DVM a few years ago. + + + + #This was done in Perl 5.8.0 under RH Linux 9.0. + + + + #file geiger.pl + + # + + # Author: David Drake + + # Date: July 18, 2003 + + # Requirements: Device::SerialPort 0.22 (from cpan July 2003) + + # + + # Version: 1.0 + + #This script is used to read a serial port to obtain data from a + + #combined Geiger counter and temperature sensor. + + #The Geiger Counter is an Aware Electronics RM-70 unit. Each count + + #maps to one microR per hour. The RM-70 pulse output is sent to a + + #Basic Stamp-IISX microcontroller. The BS2SX accumulates counts for 20 + + #seconds and then sends a serial data stream out of its serial port. + + #The data stream goes into the input serial port on the Linux system. + + #This program then tabulates the data to a log file. + + + + use Device::SerialPort; + + use Time::gmtime; + + + + $LOGDIR = "/home/zentara/perlplay/serial-comm"; # path to data fil +e + $LOGFILE = "geiger.log"; # file name to output to + + $PORT = "/dev/ttyS1"; # port to watch + + + + # + + # + + # Serial Settings + + # + + + + #make the serial port object + + #note the need to convert carriage returns to new lines to terminate e +ach + #read. + + + + $ob = Device::SerialPort->new($PORT) || die "Can't Open $PORT: $!"; + + + + $ob->baudrate(9600) || die "failed setting baudrate"; + + $ob->parity("none") || die "failed setting parity"; + + $ob->databits(8) || die "failed setting databits"; + + $ob->stty_icrnl(1) || die "failed setting convert cr to new line"; + + $ob->handshake("none") || die "failed setting handshake"; + + + + $ob->write_settings || die "no settings"; + + + + # + + # open the logfile, and Port + + # open( LOG, ">>${LOGDIR}/${LOGFILE}" ) + + || die "can't open smdr file $LOGDIR/$LOGFILE for append: $SUB $!\n" +; + + + select(LOG), $| = 1; # set nonbuffered mode, gets the chars out NOW + + + + open( DEV, "<$PORT" ) || die "Cannot open $PORT: $_"; + + + + # + + # Loop forver, logging data to the log file + + # + + + + while ( $_ = <DEV> ) { # print input device to file + + $gmc = gmctime(); + + print LOG $gmc, " ", $_; + + } + + + + undef $ob; + + + + #we are done dude

I'm not really a human, but I play one on earth. flash japh

In reply to Re^3: Wierd File pipe problem... by zentara
in thread Wierd File pipe problem... by bferlin

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.