[comp.lang.postscript] Problems with serial drivers

admin@cs.exeter.ac.uk (System Administrator) (01/24/91)

[ I am sorry if you have seen a similar article - the previous posting
had the wrong address so I have sent a cancel message and reposted
this ]

We are experiencing some problems with the apollo (domain OS 10.2 bsd)
serial port whilst attempting to drive a postscript laser printer.

As far as we can determine the problem occurs when the postscript file
has finished its job and the printer sends a Ctrl-d back to the
computer.  At this point the computer echos two backspace's which the
printer sees as errorneous postscript, ignores further input,
timeouts, sends end of job (ctrl-d) to which the computer sends 2
backspace's and the cycle continues.

We have played about with the port settings and have echo off and even
have ctlecho off but cannot convince the serial port not to echo the
two backspace's.

We believe at this point that there is a bug in serial driver in that
there seems to be no way to turn this echoing off.  

According to our understanding if the "stty ctlecho" is set then when
we do a Ctrl-d the terminal driver quite correctly first displays ^D
and then immediatly sends 2 backspace's and spaces before terminating
the shell (or subshell).  If on the other hand the "stty -ctlecho" is
set then on sending a ^D the shell correclty does not put it on screen
so there is no need to send the two backspace's but the terminal
driver still does.

Has anyone met with similar problem or better still can anyone suggest
a soluton or see where we are going wrong.

--
Khalid Sattar                   JANET  : admin@uk.ac.exeter.cs 
Computer Science Dept.          UUCP   : admin@expya.uucp
University of Exeter            BITNET : admin%uk.ac.exeter.cs@ukacrl
Exeter, UK.                     Tel    : +44 392 264062
--
Khalid Sattar                   JANET  : admin@uk.ac.exeter.cs 
Computer Science Dept.          UUCP   : admin@expya.uucp
University of Exeter            BITNET : admin%uk.ac.exeter.cs@ukacrl
Exeter, UK.                     Tel    : +44 392 264062

glenn@heaven.woodside.ca.us (Glenn Reid) (01/24/91)

In article <ADMIN.91Jan23165838@exsg.cs.exeter.ac.uk> admin@cs.exeter.ac.uk (System Administrator) writes:

>We are experiencing some problems with the apollo (domain OS 10.2 bsd)
>serial port whilst attempting to drive a postscript laser printer.
>
>As far as we can determine the problem occurs when the postscript file
>has finished its job and the printer sends a Ctrl-d back to the
>computer.  At this point the computer echos two backspace's which the
>printer sees as errorneous postscript, ignores further input,
>timeouts, sends end of job (ctrl-d) to which the computer sends 2
>backspace's and the cycle continues.

Here's a possible workaround.  You can actually define a PostScript
"procedure" that has two backspaces as its name, and make the procedure
a no-op.  That should prevent triggering the PostScript error, in
any case.  I'm not sure whether you would want to define the name to
be a single backspace or to be two consecutive backspaces; I think
that two consecutive would be correct.

Try this:

%!
% (the "exitserver" line makes the patch stay until you power-cycle
% the printer, but it may not work exactly like this in your Apollo)

serverdict begin 0 exitserver

% define a string with two backspaces (octal \008) and use it as
% the name of a procedure:

(\008\008) {
    % do something to indicate that the procedure was actually
    % called.  If it works, delete this code:
    10 10 moveto
    /Times-Roman findfont 24 scalefont setfont
    (double-backspace handled) show
    showpage
} def


% I hope this helps,
% Glenn
-- 
 Glenn Reid				RightBrain Software
 glenn@heaven.woodside.ca.us		NeXT/PostScript developers
 ..{adobe,next}!heaven!glenn		415-851-1785 (fax 851-1470)

glenn@heaven.woodside.ca.us (Glenn Reid) (01/25/91)

In article <405@heaven.woodside.ca.us> I wrote: 

>% define a string with two backspaces (octal \008) and use it as
>% the name of a procedure:
>
>(\008\008) {
>    % do something to indicate that the procedure was actually
>    % called.  If it works, delete this code:
>    10 10 moveto
>    /Times-Roman findfont 24 scalefont setfont
>    (double-backspace handled) show
>    showpage
>} def

Henry McGilton from Sun was kind enough to point out to me through
Email (rather than embarrassing me publicly) that there is no such
thing as octal \008.  That's what I get for counting up to "H" on my
fingers :-)

If you use the same program with (\010\010) instead of (\008\008) it
might even work!  I tested it this time, and defining a procedure with
this name indeed gets invoked when you type (or send) two backspaces.
HOWEVER (and this may be a big however), this relies on the two
backspaces being followed by an EOF or a newline or a space or some
token delimiter, or the scanner will probably hang waiting to finish
scanning the token.  I'm not sure exactly what your host is sending to
the printer, and whether it sends a newline after the backspaces, but
it's still worth a try, I guess.

Sorry about that.  And thanks, Henry :-)

Glenn
-- 
 Glenn Reid				RightBrain Software
 glenn@heaven.woodside.ca.us		NeXT/PostScript developers
 ..{adobe,next}!heaven!glenn		415-851-1785 (fax 851-1470)