Re: minicom questions, need expert

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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:
#######begin
#! /usr/bin/perl
# -*- perl -*-

$counter=0;
$MyOFile=/tmp/junkme
$MyFD=0

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.
      close($MyFD)
      system("lpr $MyOFile");
      open($MyFD,>,$MyOFile) or
        die "cant open $MyOFile and truncate for output";
      $counter=0;
    }
}
#######end
cat /dev/ttyUSB1 | above_perl
--
Todd Denniston
Crane Division, Naval Surface Warfare Center (NSWC Crane)
Harnessing the Power of Technology for the Warfighter

--
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux