Mailinglist Archive: opensuse (2459 mails)

< Previous Next >
Re: [opensuse] howto - Read Data from Serial Port?
  • From: "Ciro Iriarte" <cyruspy@xxxxxxxxx>
  • Date: Sun, 2 Mar 2008 02:51:55 -0300
  • Message-id: <a998a0140803012151j585c80casb9d8401977624d5f@xxxxxxxxxxxxxx>
2008/2/28, David C. Rankin <drankinatty@xxxxxxxxxxxxxxxxxx>:
Listmates,

A linux question. I have a phone system that will output call logs
through an rs-232 cable. I would like to write a script that will read
the data from the serial port and input it into a mysql table. I can
handle the mysql interface, but how do I read data from a serial port? I
have never tried to interface directly with one and I don't know what
tools are involved other than it will take some type of tty configured
to read from the port. That's where I'm stuck. Which one?, getty,
mgetty, what? What kind of script do I write that will read from the
serial port each time a call is made or received? Do I use a loop?
(seems kind of process intensive for data that will only appear every
once in a while) Can I create some type of buffer or file for the data
and then use cron to periodically sweep the data from the buffer and
stick it in mysql? Interesting problem.

The data that comes into the serial port is simple text and will look
something like this:

c 02/28/08 11:34 14095551212 00:05:13 02 11 2671 00:05:16

The fields represent:

calltype
date
time
phonenumber
duration
outsideline
extension
account
talktime

We may have 4 calls come in at once or none during the entire night.
Anybody have experience with the tools are available in openSuSE that
will let me read this stuff from the port each time a call is made or
received? If you can point me in the right direction, I can go from
there. I just need to know which building block I should start from. Thanks.

--
David C. Rankin, J.D., P.E.
Rankin Law Firm, PLLC
510 Ochiltree Street
Nacogdoches, Texas 75961
Telephone: (936) 715-9333
Facsimile: (936) 715-9339
www.rankinlawfirm.com

--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx


There's already a project on sourceforge that extracts data using
serial connection and inserts it on a database.... I'ts currently
stale (no features added), so you can contribute :D

Regards,
Ciro
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups