[comp.lang.postscript] Help zapping a printer

toms@fcs260c2.ncifcrf.gov (Tom Schneider) (08/22/90)

I have an Apple LaserWriter IIntx PostScript printer.  On occasion I mess up
and send it a straight ASCII text.  It is then completely hung.  The only way I
know how to restore its sanity is to turn it off and back on again, which is a
pain.  We can't find a power CLEAR command in the PostScript books.  Does
someone know how to do this?  Howcome the language doesn't seem to have a power
clear command that resets the interpreter?  The commands initgraphics and
grestoreall don't do the job.  Please help!  Thanks.

  Tom Schneider
  National Cancer Institute
  Laboratory of Mathematical Biology
  Frederick, Maryland  21702-1201
  toms@ncifcrf.gov

ejb@think.com (Erik Bailey) (08/22/90)

In article <1851@fcs280s.ncifcrf.gov>
toms@fcs260c2.ncifcrf.gov (Tom Schneider) writes:
>I have an Apple LaserWriter IIntx PostScript printer.  On occasion I mess up
>and send it a straight ASCII text.  It is then completely hung.  [...]
>
>  Tom Schneider

Try sending a PostScript EOF (^D). --Erik

--
      Erik Bailey       | 7 Oak Knoll         | Thinking Machines Corp.
      ejb@think.com     | Arlington, MA 02174 | 245 First St.
      harvard!think!ejb | (617) 643-0732      | Cambridge, MA  02142
          /earth is 98% full. Please remove any excess inhabitants.

royster@unccvax.uncc.edu (David Royster) (08/22/90)

In article <1851@fcs280s.ncifcrf.gov> toms@fcs260c2.ncifcrf.gov (Tom Schneider) writes:
>I have an Apple LaserWriter IIntx PostScript printer.  On occasion I mess up
>and send it a straight ASCII text.  It is then completely hung.  The only way I
>know how to restore its sanity is to turn it off and back on again, which is a
>pain.  We can't find a power CLEAR command in the PostScript books.  Does
>someone know how to do this?  

I have had the same situation occur and found that the ASCII character 4 
(decimal) clears our PostScript Printer. We have a NEC 890. I am certain that
it will work on a LaserWriter, because the reference manual for the NEC 890 is
the same as that for the LaserWriter with the word LaserWriter replaced by 
NEC 890.

So try ASCII 4. Create a file containing that one character and send it to
the printer to reset it.

I hope that this helps.

dcroyster


-- 
David C. Royster               royster@unccvax.uncc.edu (128.109.143.1)
Mathematics Department         fma00dcr@unccvm.bitnet
UNC Charlotte, Charlotte NC
Augustus F. Mobius Jewelers---Rings to fit every finger.

glenn@heaven.woodside.ca.us (Glenn Reid) (08/22/90)

In article <1851@fcs280s.ncifcrf.gov> toms@fcs260c2.ncifcrf.gov (Tom Schneider) writes:
>I have an Apple LaserWriter IIntx PostScript printer.  On occasion I mess up
>and send it a straight ASCII text.  It is then completely hung.  The only way I
>know how to restore its sanity is to turn it off and back on again, which is a
>pain.  We can't find a power CLEAR command in the PostScript books.

You don't need a power clear command, in this case, I don't think.
When you send it straight ASCII text, you will get an execution error.
One of the side effects of an execution error is that the interpreter
wants to flush the rest of the print job that caused the error; no point
in trying to execute it.  You need to send an end-of-file marker to the
printer so the interpreter knows where the end of your erroneous print
job was.

You don't say from what computer system you are sending it PostScript, but
I will hazard a guess that it's a PC compatible system.  In any case, if
it's a serial connection, you need to send it a control-D to get it to
listen to you again.  For that matter, you should send control-D at the
end of every print job you send to the printer, so it will know the job
is done and it can clean up after each one.

I hope that's the ticket, anyway.

-- 
 Glenn Reid				PostScript/NeXT consultant
 glenn@heaven.woodside.ca.us		Independent Software Developer
 ..{adobe,next}!heaven!glenn		415-851-1785

cramer@optilink.UUCP (Clayton Cramer) (08/23/90)

In article <1851@fcs280s.ncifcrf.gov>, toms@fcs260c2.ncifcrf.gov (Tom Schneider) writes:
> I have an Apple LaserWriter IIntx PostScript printer.  On occasion I mess up
> and send it a straight ASCII text.  It is then completely hung.  The only way I
> know how to restore its sanity is to turn it off and back on again, which is a
> pain.  We can't find a power CLEAR command in the PostScript books.  Does
> someone know how to do this?  Howcome the language doesn't seem to have a power
> clear command that resets the interpreter?  The commands initgraphics and
> grestoreall don't do the job.  Please help!  Thanks.
> 
>   Tom Schneider

Have you tried sending ^D?  This should flush the current job, and
everything should be ready to accept another PostScript job at that
point.
-- 
Clayton E. Cramer {pyramid,pixar,tekbspa}!optilink!cramer
"The tree of liberty must be watered periodically with the blood of tyrants 
and patriots alike.  It is its natural manure." -- Thomas Jefferson
You must be kidding!  No company would hold opinions like mine!

toms@fcs260c2.ncifcrf.gov (Tom Schneider) (08/23/90)

In article <2626@unccvax.uncc.edu> royster@unccvax.UUCP (David Royster) writes:

>So try ASCII 4. Create a file containing that one character and send it to
>the printer to reset it.

I tried:

    echo "\004" | lpr -Plaser
and
    echo "\\004" | lpr -Plaser

but they didn't work.  Thanks for the suggestion.  Erik (ejb@Think.COM), who
had experience with a similar printer, kindly suggested directly sending a
Control-D in a file, but this didn't work either.  :-(  Any other ideas?

  Tom Schneider
  National Cancer Institute
  Laboratory of Mathematical Biology
  Frederick, Maryland  21702-1201
  toms@ncifcrf.gov

nol2321@dsacg4.dsac.dla.mil (Jim Dunn) (08/23/90)

Another way of clearing the PS printer, or sending a CLEAR to the printer
is to do the following from the DOS prompt or from a batch file:

	ECHO ^D >PRN

Where "^D" is a CONTROL-D, if the batch file is created from the DOS
command line, you can just press a D while holding the CONTROL key down,
or press the 4 key while holding the ALT key down.

C:> copy con d2prn.bat
echo ^D >PRN
^Z

OK?

:)
Jim

bobs (Bob Stayton, Yoyodoc) (08/25/90)

In article <4241@optilink.UUCP> cramer@optilink.UUCP (Clayton Cramer) writes:
>In article <1851@fcs280s.ncifcrf.gov>, toms@fcs260c2.ncifcrf.gov (Tom Schneider) writes:
>> I have an Apple LaserWriter IIntx PostScript printer.  On occasion I mess up
>> and send it a straight ASCII text.  It is then completely hung.  The only way I
>> know how to restore its sanity is to turn it off and back on again, which is a
>> pain.  We can't find a power CLEAR command in the PostScript books.  Does
>> someone know how to do this?  Howcome the language doesn't seem to have a power
>> clear command that resets the interpreter?  The commands initgraphics and
>> grestoreall don't do the job.  Please help!  Thanks.
>> 
>>   Tom Schneider

This bit of Postscript code was posted some time ago.  It
reboots a LaserWriter, sending it thru its startup sequence,
including generating the test page.  Just send this to
the printer as a regular print job.
=========cut here===================
%!
%reboots LaserWriters
serverdict begin
0 % or whatever your password is
exitserver
systemdict begin
quit
=========cut here===================

bobs
Bob Stayton                                 425 Encinal Street
Technical Publications                      Santa Cruz, CA  95060
The Santa Cruz Operation, Inc.              (408) 425-7222
                                            ...!uunet!sco!bobs
/* I don't speak for my company and they don't speak for me. */

woody@chinacat.Unicom.COM (Woody Baker @ Eagle Signal) (08/26/90)

In article <9448@scorn.sco.COM>, bobs (Bob Stayton, Yoyodoc) writes:
> 
> 
> This bit of Postscript code was posted some time ago.  It
> reboots a LaserWriter, sending it thru its startup sequence,
> including generating the test page.  Just send this to
> the printer as a regular print job.
> =========cut here===================
> %!
> %reboots LaserWriters
> serverdict begin
> 0 % or whatever your password is
> exitserver
> systemdict begin
> quit


This can also be used to defeat the setpassword "Vaccine". Since
this "vaccine" thing has moved around rather widely already (a friend
brought me some information that he got off echomac on FIDO NET!)8=}
I might mention that to be fool proof, one would have to redefine
cexec and quit.  Perhaps to check for an additional password or such..
8=}

Cheers
Woody

toms@fcs260c2.ncifcrf.gov (Tom Schneider) (08/27/90)

In article <1505@chinacat.Unicom.COM> woody@chinacat.Unicom.COM
(Woody Baker @ Eagle Signal) writes:
>In article <9448@scorn.sco.COM>, bobs (Bob Stayton, Yoyodoc) writes:
>> 
>> This bit of Postscript code was posted some time ago.  It
>> reboots a LaserWriter, sending it thru its startup sequence,
>> including generating the test page.  Just send this to
>> the printer as a regular print job.
>> =========cut here===================
>> %!
>> %reboots LaserWriters
>> serverdict begin
>> 0 % or whatever your password is
>> exitserver
>> systemdict begin
>> quit

I tried this, and found that it did reboot my printer.  Then I sent a
junk file to the printer and tried to reboot again.  Nothing happened.
I sent a few control-D's and that didn't help either.  You see, the problem
is that on occasion I send a text file directly to the printer by accident.
It, of course, fills up the PostScript stack with junk that causes a
lot of errors (I suppose, I don't have a link back from the printer
to my Sun workstation.)  I'm running Unix by the way, not DOS on a PC.

On other occasions I'll send a huge file that the printer can't handle,
and it dies silently.  (The NeWS window system never dies like this, and
always shows me that the PostScript code is in fact good code!)

It seems that I may not be getting the control-D's across; anybody know
how to do this in UNIX (sending a file with a control-D in it didn't work).
It also seems that the reboot program given above simply never gets
executed when the printer is fowled up.

Thanks for your suggestions so far, but now what?

  Tom Schneider
  National Cancer Institute
  Laboratory of Mathematical Biology
  Frederick, Maryland  21702-1201
  toms@ncifcrf.gov

tdd@convex.cl.msu.edu (Thomas D. Davis) (08/27/90)

In article <1854@fcs280s.ncifcrf.gov> toms@fcs260c2.ncifcrf.gov (Tom Schneider) writes:
>
>It seems that I may not be getting the control-D's across; anybody know
>how to do this in UNIX (sending a file with a control-D in it didn't work).
>It also seems that the reboot program given above simply never gets
>executed when the printer is fowled up.
>

Your post last week showed you trying to do something like: echo "\004" | lpr.
This doesn't do what you want.  To echo a CTRL-D, you need to precede the
CTRL-D with a CTRL-V (this tells csh that the next character is to be taken
literally).  Also, remember to use the -l parameter on the lpr call so your
print filter passes the control character through to the printer (actually,
you can just as easily do "echo ^D > /dev/ttya" and skip lpr/lpd altogether).
This should always "unzap" your printer.
--
Tom Davis                 | The above statement shall be construed,
Network Software Services | interpreted, and governed by me alone.
Michigan State University | EMail: tdd@convex.cl.msu.edu

bobs (Bob Stayton, Yoyodoc) (08/28/90)

In article <1854@fcs280s.ncifcrf.gov> toms@fcs260c2.ncifcrf.gov (Tom Schneider) writes:
>In article <1505@chinacat.Unicom.COM> woody@chinacat.Unicom.COM
>(Woody Baker @ Eagle Signal) writes:
>>In article <9448@scorn.sco.COM>, bobs (Bob Stayton, Yoyodoc) writes:
>>> 
>>> This bit of Postscript code was posted some time ago.  It
>>> reboots a LaserWriter, sending it thru its startup sequence,
>>> including generating the test page.  Just send this to
>>> the printer as a regular print job.
>>> =========cut here===================
>>> %!
>>> %reboots LaserWriters
>>> serverdict begin
>>> 0 % or whatever your password is
>>> exitserver
>>> systemdict begin
>>> quit
>
>I tried this, and found that it did reboot my printer.  Then I sent a
>junk file to the printer and tried to reboot again.  Nothing happened.
>...stuff deleted...
>Thanks for your suggestions so far, but now what?
>
I also work with LaserWriters from Unix machines, and have
on occasion sent a text file by accident.  It takes awhile,
but eventually the LaserWriter times out on bad jobs and 
clears itself.

I would try three things, in this order:

1.  Download erhandlr.ps to your printers.
This contains the Adobe error handler procedures.
Then a bad Postscript file just generates an
error page and the printer is ok.  If you don't have it I
can send it to you.

2.  You might try is changing the Unix lp spooler script to check the
first line of the file.  If it doesn't start with %!, then
convert the text file to Postscript or send out a Postscript
message like "You are trying to print a file that is not valid
Postscript".  Our lp script does the former and includes this:

while  [ "$copies" -gt 0 ]
do
  for file
  do
    if [ `head -1 $file | cut -c1-2` = '%!' ]; then
      /bin/cat $file
      echo "\004"
    else 
      /usr/bin/psprint $file 
      echo "\004"
    fi
  done
  copies=`expr $copies - 1`
done

Our lp script is in the /usr/spool/lp/interface directory
on SCO Unix.  Here "psprint" is a filter that converts text
files to simple Postscript in Courier font.

3.  I would check for communication problems between
the printer and the spooler. I imagine the spooler is
still trying to send the job, even though the printer may
be telling it that it's junk.  The line might be getting
hung at the spooler end instead of the printer.  Try disabling
and enabling the printer to see if that clears a jam.
Or even try physically disconnecting the printer momentarily
to see if the printer will reset.

Hope some of this helps.

bobs
Bob Stayton                                 425 Encinal Street
Technical Publications                      Santa Cruz, CA  95060
The Santa Cruz Operation, Inc.              (408) 425-7222
                                            ...!uunet!sco!bobs
/* I don't speak for my company and they don't speak for me. */

stephenf@softway.sw.oz.au (Stephen Frede) (08/29/90)

Lots of people have suggested control-d and various other reset type
things. Another possibility is that the interpreter is hung trying to
execute something in the random text you sent. You might try a
control-c, followed by a control-d.  The other thing to try, if you can
get access to the device or otherwise read what the printer is sending
back, is to send a control-t and see what (if any) status message it
sends to you.

			Regards,

				- Stephen Frede

Softway Pty Ltd, P.O. Box 305, Strawberry Hills, NSW 2012, AUSTRALIA
Phone: +61 2 698 2322; Fax: +61 2 699 9174; Telex: AA27987
domain: stephenf@softway.oz.au	UUCP: ...!uunet!softway.oz!stephenf