Thank you very much for comments.

After reading the article, I changed read(STDIN,$Buff,$BuffLen) to sysread(STDIN,$Buff,$BuffLen), it logged data without problem.

But I'm still a little bit of puzzling.

According the article, there should be three buffers. I do the buffering myself with $Buff, the log program has its own buffer, /dev/ttyS0 is also buffered. There is no buffer for output, because I used syswrite operator.

GPS outputs 382 Bytes to serial port every 30 seconds. If the system's default buffer is 8K, it will take 10.7 minutes to have a full buffer. But the real situation is that read(STDIN,$Buff,$BuffLen) returned zero byte after a few minutes. I tested it for several hours. It only logged 1.2K data at the beginning for a few minutes. At the rest time, read(STDIN,$Buff,$BuffLen) can't get any data through /dev/ttyS0. Where's the buffering?

Thanks


In reply to I'm still a little bit of puzzling by jerryleo
in thread Problem with logging raw data through serial port by jerryleo

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.