From: Adrian Flynn (adrian.flynn at domain worldtravel.ie)
Date: Wed 19 Sep 2001 - 12:21:08 IST
Niall
Thanks for your reply, however the printer concerned is not on a linux
machine, and uses non standard print routines, therefore it cannot be
captured at source. This is why I was planning on taking the serial cable
which is currently plugged in to the printer and attaching this (with
suitable plug modifications) to ttyS0 and linking ttyS1 to the printer with
another cable. The data would then be routed through the Linux machine, be
logged, and then continue on its merry way ;-)
One possible option might be:
cat /dev/ttyS0 |tee -a /var/log/printerlog >/dev/ttyS1
However, this is a production printer and I cannot mess with it until I am
sure!
Any thoughts?
Thanks
Adrian
-----Original Message-----
From: ilug-admin at domain linux.ie [mailto:ilug-admin at domain linux.ie]On Behalf Of Niall
O Broin
Sent: 18 September 2001 16:50
To: ilug at domain linux.ie
Subject: Re: [ILUG] Serial Port Logging
On Tue, Sep 18, 2001 at 03:56:37PM +0100, Adrian Flynn wrote:
> Can anyone suggest a suitable package to log traffic on a serial line. I
> wish to intercept data being sent to a serial printer and log it to a
file.
> The data would then be retransmitted to the printer on a second serial
port.
>
> I suspect that this might be as simple as a bash script copying from ttyS0
> to stdout, piping the output through tee and subsequently redirecting the
> output to ttyS1, but I am not sure how to set this up.
This is conceptually quite simple as long as the printer is using the
standard printcap system and not e.g. under the control of some printer
which is dumping data straight to a serial port. In the simplest case, you'd
just need to add a stanza like
:if=/usr/local/bin/lpcopier:
to the printcap entry for the printer where /usr/local/bin/lpcopier is
simply
#!/bin/sh
/usr/bin/tee -a /var/log/printer_copy
However, with any current Linux distribution there'll already be an if line
using apsfilter or somesuch. On this SuSE 7.1 box, I have
:if=/var/lib/apsfilter/bin/y2prn_lp.upp--auto-lp:
and a first thought for that was simply to have /usr/local/bin/lpcopier as
#!/bin/sh
/usr/bin/tee -a /tmp/lpcopy | /var/lib/apsfilter/bin/y2prn_lp.upp--auto-lp
but that didn't work for me - the data was copied OK but not printed, so
some investigation of /var/lib/apsfilter/bin/y2prn_lp.upp--auto-lp would be
necessary - left as an exercise for the reader :-)
So, that's the general direction in which you've to go - shouldn't be too
hard.
Niall
-- Irish Linux Users' Group: ilug at domain linux.ie http://www.linux.ie/mailman/listinfo/ilug for (un)subscription information. List maintainer: listmaster at domain linux.ie --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.280 / Virus Database: 147 - Release Date: 11/09/2001 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.281 / Virus Database: 149 - Release Date: 18/09/2001
This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:12:12 GMT