Printer fault detection

Just as converting a file and handling special printing modes is a printer-specific role, so is detecting printer faults.

The print service attempts to detect faults in general, and for most printers it can do so correctly. The range of faults that the print service can detect by itself, however, is limited. It can check for hang-ups (loss of carrier, the signal that indicates the printer is online) and excessive delays in printing (receipt of an XOFF flow-control character to shut off the data flow, with no matching XON to turn the flow back on). However, the print service cannot determine the cause of a fault, so it cannot inform you what to look for.

A well-designed filter can provide better fault coverage. Some printers are able to send a message to the host describing the reason for a fault. Others indicate a fault by using signals other than the dropping of a carrier or the shutting off of data flow. A filter can serve you by detecting more faults and providing more information about them than you would otherwise receive.

A filter can wait for a printer fault to clear and then resume printing. This service allows for more efficient printing when a fault occurs because the print request that was interrupted does not have to be reprinted in its entirety. Only a real filter, which has knowledge of the control sequences used by a printer, can know where a file breaks into pages. Thus only such a filter can find the place in the file where printing should resume.

The print service has an interface that allows a filter to send you fault information and to restart printing if it can. The alerting mechanism (see Printer fault alerts) is handled by the print service; the interface program that manages the filter takes all error messages from the filter and places them in an alert message that can be sent to you. If you have set the printer configuration so that printing should automatically resume after a fault is cleared, the interface program keeps the filter active, so that printing can pick up where it left off.

What Programs Make Good Filters

It is tempting to use a program such as troff, nroff, or a similar word-processing program as a filter. However, the troff and nroff programs have a feature that allows references to be made in a source file to other files, known as include files. The print service does not recognize include files; it will not enqueue any that are referenced by a source file when that file is in a queue to be printed. As a result, the troff or nroff program, being unable to access the include files, may fail. Other programs may have similar features that limit their use as filters.

Here are a few guidelines for evaluating a program for use as a filter:

  • Only programs capable of reading data from standard input and writing data to standard output may be used as filters.
  • Examine the kinds of files users will submit for printing that will require processing by the program. A good program is one that stands alone (that is, it does not need to refer to other files).

    Determine if the program expects any files other than those submitted by a user for printing. If it does, those files must be in the directory of the person using the filter, or they must be readable by all users authorized to use the filter. The latter prerequisite is necessary because filters are run with the user ID and group ID of the user who submitted the print request.

  • If referenced files are permitted in the files submitted for printing, or if the program will need files other than those submitted by a user, then the program, unable to access the additional files, is likely to fail. Rather than using the program under consideration as a filter; instead, have users run the program before submitting files for printing.

Referenced files that are always specified by full pathnames may be acceptable, but only if the filter is used for local print requests. When used on requests submitted from a remote machine for printing on your machine, the filter may still fail if the referenced files exist only on the remote machine.