Printing to Locally Attached Printers


Contents

About This Document
Assumptions
Testing Communication
Troubleshooting Communication
Troubleshooting the Queue
Appendix A: Viewing Memory for 'lp'
Appendix B: Deactivating a Queue
Appendix C: File Permissions, Owners and Groups

About This Document

This document contains information on locally attached printers. This document is applicable to AIX versions 3 and 4.


Assumptions

In the examples that follow, the configured device driver designated by 'lp0' points to a printer attached to the parallel port, and the configured device driver designated by 'lp1' points to a printer attached to the second serial port.

To check your system for configured device drivers, use:

 
    lsdev -Cc printer 

Information in the following format will be returned for any locally attached printers:

 
    lp0  Available 00-00-0P-00 Hewlett-Packard LaserJet 4,4M 
    lp1  Available 00-00-S2-00 IBM 2380 Personal Printer II 

Testing Communication

Ensure that data can reach the printer and that the printer will print the data. With the exception of certain specialized printers, working printers are capable of printing ASCII text.

Test this by using:

 
    lptest 40 20 > /dev/lp0 

This will send an ASCII test pattern 40 characters wide and 20 lines long to the file /dev/lp0 and then to the device driver in the kernel and out the port for which 'lp0' was configured (in this case, the parallel port). The 'lptest' pattern will look like the following:

 
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGH 
"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHI 
#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJ 
$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJK 
%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKL 
&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLM 
'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMN 
()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNO 
)*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOP 
*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQ 
+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQR 
,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRS 
-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRST 
./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTU 
/0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUV 
0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVW 
123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWX 
23456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXY 
3456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ 
456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[ 

A printer that accepts data in the postscript format can be tested by writing a postscript file such as the postscript header page to the device file:

 
    cd /usr/lib/lpd/pio/burst 
    cat H.ps > /dev/lp0 

NOTE: Some printers that are capable of automatically detecting whether the incoming data stream is in postscript format and switching to postscript mode accordingly do so only if a PJL command is prefixed to the data stream. In the case of printers where the command is lacking, the postscript source code will be printed.


Troubleshooting Communication

Failures of the preceding test (lptest or cat) will be of three kinds:

  1. A prompt is returned, but there is no output at the printer.
  2. A prompt is returned, but one of the following error messages is returned:
     
        cannot open the specified file
    
    or
     
        cannot create the specified file 
    

    The system is unable to send data out the port due to wrong cabling or a wrong printer setting. The system is not getting the CTS signal. CTS indicates that the printer is present and switched on. This signal is normally sent along the printer RTS line. CTS is expected to be high at all times. In some cases the printer will have a setting for this (possibly listed as an RTS option which should be set to 'true' or 'high').

  3. The prompt does not return.

    Try the Ctrl-C key combination. If the prompt returns with a message, see 2) above. If the prompt returns without a message, check use of the lp by:

 
    fuser /dev/lp1 

(For a method which may be used at AIX 3.2.x in addition to fuser, see Appendix A)

In the example of 'lp1' above, the following should be returned:

 
    /dev/lp1: 

If there are any numbers after the colon, processes associated with the lp have been identified. To find more information about the process(s), in the following command substitute the process id (PID) returned from fuser:

 
    ps -ef|grep PID 

If this shows the process to be 'pioout' or 'piobe' and there is no printed output from the printer, there is probably a flow control problem. If Xon/Xoff flow control is used, then the system is waiting for an Xon character from the printer. If DTR (hardware) flow control is in use, then the system is waiting for the CD signal from the printer DTR line.

If proper flow control can be established, printed output will resume where it left off.

Try the following:

  1. Switch printer power off and back on.
  2. Switch printer offline and back online.
  3. Disconnect the cable from the printer, plug it into a terminal, and type Ctrl-Q on the terminal.

If method 3 works, then the printer is not sending an Xon character to the system. Investigate the use of Xon/Xoff flow control by the printer.

If the flow control condition cannot be rectified or flow control is not the issue, kill the processes by:

 
    fuser -k /dev/lp1 

Verify that the processes were killed by:

 
    fuser /dev/lp1 

If unsuccessful, detach the printer cable from the system. If still unsuccessful, try:

 
    kill -9 PID 

If this is unsuccessful, a system reboot is needed. If upon reboot the processes reappear, then deactivate the queue as indicated in Appendix B.


Troubleshooting The Queue

If a queue is used for printing and there is printed output from using the cat or lptest commands in the section above, attention should be turned to the queuing system.

In the examples, 'lp0q' and 'lp1q' are the queues that point to 'lp0' and 'lp1' respectively.

To view the status of queues you may use:

 
    lpstat 

which in the case of the examples might return:

 
    Queue   Dev   Status 
    ------- ----  --------- 
    lp0q    lp0   READY 
    lp1q    lp1   DOWN 

Other possible states are DEV_BUSY or DEV_WAIT.

To enable the 'lp1q' you can try:

 
    enable qlp1 

If 'lpstat' subsequently shows the queue to be DOWN and nothing was printed, compare your file permissions and file owners and groups against those in Appendix C.

If repeated lpstat's show the queue hanging for several minutes in a DEV_BUSY or DEV_WAIT state, check the file= field for that queue by entering:

 
    pg /etc/qconfig 

and using the ENTER key to page through the file. In the example queue and device, this would show:

 
    lp1: 
            file = /dev/lp1 

If the file= field does not have /dev/lp#, contact your AIX support center. Another method is:

 
    lsque -qlp1q 

to get the device name. In the example the following would be returned:

 
    lp1q: 
            device = lp1 

With the device name, you could run:

 
    lsquedev -qlp1q -dlp1 

which would return information including the file= field.

If the queue is stuck in a READY state with jobs QUEUED, the qdaemon must be cycled. This is the case where queues were added/removed/changed while the queuing system was in use. To cycle the qdaemon, use:

 
    stopsrc -cs qdaemon 
    startsrc -s qdaemon 

Stopping the qdaemon may cause currently printing jobs to be abandoned in which case those jobs will not resume where they left off upon restarting the qdaemon.


APPENDIX A: Viewing Memory for 'lp'

Another method useful for tracking down a process that is holding a port is to use the crash command. In addition to process determination, this method allows one to determine whether an exiting process has hung the port. In those cases where fuser has not returned a PID, suspect a hung port. To confirm this use the following command (this applies only to AIX 3.2.x):

 
    echo tty lp1|crash|pg 

This should return information similar to the following:

 
    lp1: tp=0x05b2f400, dev:(12,774) chan:(0x0) 
    sid:0x00000000 group:0x00000000 tsm:0x00000000 id:60 
    port status: iclose ccnt=0 
    ... 
    etc. 

If 'port status' is anything except 'iclose ccnt=0', check the Session ID (SID). SID identifies the process. In the example above there is none, as the field after the 0x is all zeroes. Where the port status is other than 'iclose ccnt=0', there are flags against the port. If in addition the SID is all zeroes after the 0x, there is no process registering as holding the port; the remedy to clear the port is to reboot the system. Should the problem recur after reboot, consider deactivating the queue (if one is used in printing),(See Appendix B.).

The SID is given in hexadecimal notation. To convert this to decimal do the following (replacing SID below with what follows 0x and using capitals for any letters):

 
    bc 
    ibase=16 
    SID 
    quit 

After the SID has been converted to the decimal PID, use:

 
    ps -ef|grep PID 

replacing PID with the number returned from the SID conversion.


APPENDIX B: Deactivating a Queue

The following command will disable the example queue 'lp1q':

 
    disable lp1q 

'lpstat' will show this queue as DOWN.

To deactivate the example queue 'lp1q' thus ensuring that it would be disabled on reboot, do the following:

 
    stopsrc -cs qdaemon 
    chque -qlp1q -dlp1 -a"up = FALSE" 
    startsrc -s qdaemon 

To reactivate the queue, use 'smit' or run the above commands substituting TRUE for FALSE.


APPENDIX C: File Permissions, Owners and Groups

At minimum the following should be checked. This is especially true if only root user (superuser) can print:

 
-r-sr-s---   1 root    printq     58989 Oct 26 1994  /usr/sbin/qdaemon 
-r-sr-s---   1 root    printq     50099 Oct 26 1994  /usr/sbin/lpd 
-r-sr-sr-x   1 root    printq     59262 Oct 26 1994  /bin/enq 
-r-xr-xr-x   1 bin     bin        31493 Oct 26 1994  /bin/qprt 
-r-xr-xr-x   1 bin     bin        30397 Oct 26 1994  /bin/lp 
-r-xr-xr-x   1 bin     bin        31421 Oct 26 1994  /bin/lpr 
-r-xr-xr-x   1 bin     bin        30909 Oct 26 1994  /bin/lpstat 
-r-xr-sr-x   1 bin     printq     54633 Oct 13 1994  /usr/lib/lpd/piobe 
-r-sr-x---   1 root    printq     38205 Oct 26 1994  /usr/lib/lpd/digest 
-r-sr-x---   1 root    printq     52088 Oct 26 1994  /usr/lib/lpd/qstatus 
-r-sr-xr-x   1 root    printq     49626 Aug 14 1995  /usr/lib/lpd/pio 
                                                              /etc/pioout 
crw-rw-rw-   1 root    system     2,  2 Jul 09 08:56 /dev/null 
-rw-rw-r--   1 root    printq      6198 Sep 27 10:55 /etc/qconfig 
-rw-rw----   1 root    printq     26876 Sep 27 10:55 /etc/qconfig.bin 
drwxr-xr-x  33 bin     bin         2048 Sep 17 00:39 / 
drwxr-xr-x  12 bin     bin          512 Jul 10 14:45 /var 
drwxrwxr-x  12 bin     bin          512 Sep 13 18:53 /var/spool 
drwxrwxr-x   5 bin     printq     14336 Sep 14 11:51 /var/spool/lpd 
drwxrwxr-x   2 root    printq     42496 Sep 15 17:19 /var/spool/lpd/qdir 
drwxrwxr-x   2 root    printq      2048 Sep 15 17:18 /var/spool/lpd/stat 
drwxrwxr-x   2 bin     printq      6656 Sep 15 15:23 /var/spool/qdaemon 
drwxr-xr-x  21 bin     bin          512 Jan 17 1995  /usr 
drwxr-xr-x   3 bin     bin        11776 Sep 16 23:31 /usr/bin 
drwxr-xr-x   4 bin     bin         9216 Sep 16 23:32 /usr/sbin 
drwxrwxr-x  15 root    system      8192 Sep 27 10:55 /etc 
drwxrwsrwt  16 bin     bin         4608 Nov 27 14:32 /tmp 

To check directories use:

 
    ls -ld <path/directory> 

For example, ls -ld / would return information for root directory, and ls -ld /etc would return information for the etc directory.


Printing to Locally Attached Printers: local.prt.diag.all.zap ITEM: FAX
Dated: 99/03/10~00:00 Category: zap
This HTML file was generated 99/06/24~12:41:59
Comments or suggestions? Contact us