Re: Reading data from a tty



I have a serial line going to tty1, where tty1 would be receiving
data in burst.
I need to know how to read that burst of data, and then save it to a
file in the system.

This can be trivial or it can be complicated. There are two things:

1) Do you want to append each burst to a single file or have one file for
each burst?
2) If the answer to #1 is a separate file for each burst, how do you know
you've reached the end of the "burst" of data? A special character or EOF
indicator or some amount of idle time?

The easiest case is:
cat < /dev/tty# > file

This of course only works if data carrier detect (DCD) signal is present on
the serial port at all times or you are using a serial port option such as
force carrier or clocal.

There is a sample piece of C code from IBM that can be modified to open a
tty and read/write that may be useful:
http://publib.boulder.ibm.com/infocenter/pseries/v5r3/index.jsp?topic=/com.ibm.aix.doc/aixbman/commadmn/asyn_modems_setup.htm

Best regards,
Paul Laymon
http://www.laixsoft.com


.



Relevant Pages

  • Re: Terminal emulators
    ... I hate to burst your bubble---there are whole series of MCUs with no ... low-end chips with no serial interfaces also. ... at least bit-bang a PC-acceptable serial port. ...
    (comp.arch.embedded)
  • Re: Terminal emulators
    ... I hate to burst your bubble---there are whole series of MCUs with no ... low-end chips with no serial interfaces also. ... at least bit-bang a PC-acceptable serial port. ...
    (comp.arch.embedded)