LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] Serial Port Logging

[ILUG] Serial Port Logging

Adrian Flynn adrian.flynn at worldtravel.ie
Wed Sep 19 12:21:08 IST 2001


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 linux.ie [mailto:ilug-admin at linux.ie]On Behalf Of Niall
O Broin
Sent: 18 September 2001 16:50
To: ilug at 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 linux.ie
http://www.linux.ie/mailman/listinfo/ilug for (un)subscription information.
List maintainer: listmaster at 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





More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell