Thanks to all who responded. Apologies for my delay posting the Summary.
The question was: How do I capture text from a serial port and log to a
file?
There were two general responses
Option one: Use Kermit
Option two: Write a shell script using stty. Douglas Carr
dougcarr@bae.uky.edu had the cleanest approach I think. His email and
script is below. Please contact him for permission to use it.
============
John,
Several years ago my boss asked me to do something
similar. We have a in house digital phone system in our
department. This system has the capabilities of outputting
phone usage data via a serial port. Not wanting to do a
lot of C programming I decided to write a small shell
program to capture ASCII data arriving on the serial port
to a file. It was quite a simple program once I did
some research. Your free to use it if you want.
****** Cut Here ******
#!/bin/ksh
# phonelog.sh
#
# Phone * Watch
#
# 02/02/98
# Douglas E. Carr
#
# All rights assigned to,
#
# Agricultural Engineering Department
# University of Kentucky
#
# A program to monitor the data comming in on "/dev/ttyb" from
# the Executech II phone system.
#
# Features that need to be added in the future.
#
# 1. File (device locking).
# 2. Copy and move the data file to the administrators login.
#
# Create a new file each month, with the format "mmyy.log"
FILE="/var/log/phone.log"
#FILE=/var/log/`date +%m%y.log`
# Assign file descriptor 3 to "/dev/ttyb"
exec 3< /dev/ttyb
# Set IOCTL parameters for "/dev/ttyb"
/usr/5bin/stty 2400 -parenb -parodd cs7 cstopb -ixoff igncr < /dev/ttyb
# Capture date from "/dev/ttyb" forever(?).
while true
do
cat <&3 >> $FILE
done
******* Cut here *******
Doug
-----Original Message-----
From: owner-sun-managers@sunmanagers.ececs.uc.edu
[mailto:owner-sun-managers@sunmanagers.ececs.uc.edu]On Behalf Of John
Clinton
Sent: Wednesday, November 25, 1998 8:20 AM
To: Sun Managers
Subject: Capturing text from a serial port
Hi Sun Managers,
I need to capture the text sent to a Sun's serial port and send it to a
file.
Background information:
There is PC sending text out its serial port intended for a printer (just
plain text). My manager has asked that I connect this PC's serial port to a
Sun (Solaris 2.6) and send this text to a file.
How do I configure the port for this on the Sun? I plan on using a null
modem cable and make sure all the pin outs are correct, however I need
direction with the software configuration.
Can anyone point me in the right direction? I have searched on the web
and only found general serial port configuration guidelines.
Thanks,
John Clinton
jclinton@gte.net
Other responses included using PEEK
This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:12:53 CDT