[olug] capturing data from serial port

Nick Walter waltern at iivip.com
Thu Oct 9 15:50:33 UTC 2003


A lot depends on whether there is another process (a modem getty for
example) already holding open the serial port.  If there isn't, your
life is easy.  I'd recommend writing something simple to open the serial
port and read the data, parse/delimit it, and write it out to file.  I
personally would do it in C, but that's what I'm good with.  I'm sure
other people could tell you how to do it in perl or python or java. 
Heck, if the parsing is simple you can just "cat /dev/ttyS?"  and take
care of the parsing in a shell script.  

If another process is already holding the port open or might open the
port without warning your life gets trickier.  You need to worry about
using locks that both your and the other process will respect in order
to prevent operations from interfering with each other.

Nick Walter

P.S.  Is this an SMDI stream of data?  This sounds exactly like a
project I did a few years back.

  


On Thu, 2003-10-09 at 10:16, Ryan O'Rourke wrote:
> I'm trying to capture some phone data from a serial port and write it in
> a delimited format to a file to later be inserted into a MySQL database.
> How would I go about capturing that data?
> 
> -- Ryan
> 
> 
> 
> _______________________________________________
> OLUG mailing list
> OLUG at olug.org
> http://lists.olug.org/mailman/listinfo/olug
> 



More information about the OLUG mailing list