AIX Printer Tips: Custom Backend to Wake Up an HPLJ5L


Contents

About This Document
Overview
Procedure

About This Document

The HP LaserJet 5L printer has a power saving feature that puts the printer to sleep after being idle for a period of time. After this happens, if a print job is sent to the printer from an AIX queue, the printer seems to simply hang. This document describes a method using a custom AIX printer backend shell script to awaken the printer and delay prior to printing.

This document applies to all levels of AIX.


Overview

The first test that was performed was to send a PCL reset command by itself to the printer and see if the printer would wake up. After a short delay, the print job was sent to the printer. This job seemed to print without the hang that had occured earlier.

There are probably several ways to accomplish a delay, but one of the easiest is to simply replace the backend program specified in the queue device definition in /etc/qconfig with a short shell script. The script that I have included in this document is meant to work only with local printers. One of the reasons that this is easy to implement is that the stdout (Standard Out) for the printer backend goes directly to the printer. This means that we can use a simple echo command to send data out to the printer.


Procedure

Use the following steps to solve the problem.

  1. Create the shell script backend /usr/local/bin/delaybk containing the following text:

    #!/usr/bin/ksh
    # Set up some traps.  This probably isn't necessary
    trap "trap 15;kill -15 0;exit 0" 15
    
    # This all works for a local printer because stdout is set
    # to the special file /dev/lp## in the "file = /dev/lp##"
    # line in /etc/qconfig where the queue is defined
    
    # Let's output the Escape sequence to wakeup the printer
    echo "\033E"
    if [ "$?" -ne 0 ]
    then
    	exit 2
    fi
    
    # Now we can sleep - this can be adjusted but start off large.
    sleep 10
    
    # Now let the virtual printer do its job
    /usr/lib/lpd/piobe "$@" 
    if [ "$?" -ne 0 ]
    then
    	exit 64
    fi
    

  2. Change the permissions on the file to allow execution.
     chmod +x /usr/local/bin/delaybk
    
  3. Change the ownership of the file to root with the printq group.
     chown root:printq /usr/local/bin/delaybk
    
  4. Back up the /etc/qconfig file just in case.
     cp /etc/qconfig /etc/qconfig.bak1
    
  5. Copy the backend line in /etc/qconfig for this queue so there are two duplicate lines. Comment out the first line so you have a copy for recovery by placing an asterisk in front of that line. Change the second line to point to the shell script backend /usr/local/bin/delaybk. The resulting two lines should look like this:
    *        backend = /usr/lib/lpd/piobe
            backend = /usr/local/bin/delaybk
    
  6. Save the changed file.

  7. Use lpstat to digest the queues which will build a new /etc/qconfig.bin.

  8. Test print to the queue.


Custom Backend to Wake Up an HPLJ5L: AIX Printer Tips: hp5ldly.html ITEM: FAX
Dated: 99/01/29~00:00 Category: zap
This HTML file was generated 99/06/24~12:42:10
Comments or suggestions?
Contact us