minicom questions, need expert

Todd Denniston Todd.Denniston at
Thu May 15 14:14:59 UTC 2008

Gene Heskett wrote, On 05/15/2008 01:21 AM:
> On Wednesday 14 May 2008, Kevin J. Cummings wrote:
>> Gene Heskett wrote:
>>> sorry about the late rely here Kevin.  The above example, except to -Plp3,
> [...]
>>> Many thanks, to Kevin J. Cummings, or anyone else who can shed some light
>>> on this.
>> I'm not sure I have a definitive answer for you.  I wish I did!
>> Good Luck!
> Its beginning to look as if I'm going to have to write a filter to break it up 
> into say 60 line pages & send them to lpr one 'file' at a time.  There 
> apparently is not a way to send a valid EOF from the other end unless someone 
> can decode a '^Z' into a value I can try just for grins.
> Thanks Kevin.

Have you considered writing a bit of perl(or bash|awk|ruby|java|c|C++) to read 
the /dev/ttyUSB1?
as a first cut I would probably do read lines[1] on the tty and when I hit 
~60, dump to the printer.
second, start looking for what the originating system sends as Form Feed and 
end file markers normally, and use those as kickers.
as a third, some read()s allow for a timeout, if no new data came across in 
say the last 60 seconds...kick what you got to the printer.

[1] a read function that returns when it hits an end of line marker (NL or 
CRNL). in perl "while ($IN=<STDIN>)" does the job.

my perl fu is a bit rusty (i.e., no warranties, it'll break and you get all 
the chunks) but I think the first cut looks like:
#! /usr/bin/perl
# -*- perl -*-


open($MyFD,>,$MyOFile) or die "cant open $MyOFile for output";

while ($IN=<STDIN>)
   print $MyFD "$IN"
   $counter=$counter + 1;
   if($counter >= 60)
       #kick to printer.
       system("lpr $MyOFile");
       open($MyFD,>,$MyOFile) or
         die "cant open $MyOFile and truncate for output";
cat /dev/ttyUSB1 | above_perl
Todd Denniston
Crane Division, Naval Surface Warfare Center (NSWC Crane)
Harnessing the Power of Technology for the Warfighter

More information about the users mailing list