in reply to Re: Problem with logging raw data through serial port
in thread Problem with logging raw data through serial port

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