JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
System Administration Guide: Printing     Oracle Solaris 11 Express 11/10
search filter icon
search icon

Document Information

Preface

1.  Introduction to Printing in the Oracle Solaris Operating System

2.  Planning for Printing (Tasks)

3.  Setting Up and Administering Printers by Using CUPS (Tasks)

4.  Setting Up and Administering Printers by Using Print Manager for LP (Tasks)

5.  Setting Up and Administering Printers by Using Oracle Solaris Print Manager (Tasks)

6.  Setting Up Printers by Using LP Print Commands (Tasks)

7.  Administering Printers by Using LP Print Commands (Tasks)

8.  Customizing LP Printing Services and Printers (Tasks)

Customizing Printing Services (Task Map)

Customizing the LP Print Service

Adjusting Printer Port Characteristics

How to Adjust the Printer Port Characteristics

Adding a terminfo Entry for an Unsupported Printer

How to Add a terminfo Entry for an Unsupported Printer

Customizing the Printer Interface Program

Standard Printer Interface Program

Customizing stty Modes

Exit Codes

Fault Messages

Using a Customized Printer Interface Program

How to Set Up a Custom Printer Interface Program

9.  Administering the LP Print Scheduler and Managing Print Requests (Tasks)

10.  Administering Printers on a Network (Tasks)

11.  Administering Character Sets, Filters, Forms, and Fonts (Tasks)

12.  Administering Printers by Using the PPD File Management Utility (Tasks)

13.  Printing in the Oracle Solaris Operating System (Reference)

14.  Troubleshooting Printing Problems in the Oracle Solaris OS (Tasks)

Glossary

Index

Customizing Printing Services (Task Map)

Task
Description
For Instructions
Add a terminfo entry of an unsupported printer.
Add an entry to the terminfo database to initialize an unsupported printer and establish required settings.
Set up a custom printer interface program.
You can furnish a custom printer interface program if you have a printer that is not supported by the standard printer interface program.
Adjust the printer port characteristics.
Make printer port characteristics the are set by the LP print service compatible with the printer communication settings.

Customizing the LP Print Service

Although the LP print service is designed to be flexible enough to handle most printers and printing needs, the LP print service does not handle every possible situation. You might have a print request that is not accommodated by the standard features of the LP print service. Or, you might have a printer that does not quite fit into the way the LP print service handles printers.

You can customize the LP print service in the following ways:

Adjusting Printer Port Characteristics

The printer port characteristics set by the LP print service must be compatible with the printer communication settings. If the default printer port settings provided by the LP print service do not work with a printer, refer to the printer manual from the manufacturer to determine what settings the printer requires from the LP print service. Use the stty command to set and display printer communication settings.

The following table shows the default stty settings that are used by the LP print service.

Table 8-1 Default stty Settings Used by the LP Print Service

Option
Description
-9600
Sets baud to 9600
-cs8
Sets 8-bit bytes
-cstopb
Sends one stop bit per byte
-parity
Does not generate parity
-ixon
Enables XON/XOFF (also known as START/STOP or DC1/DC3)
-opost
Does “output post-processing” using all the settings that follow in this table
-olcuc
Do not map lowercase to uppercase
-onlcr
Changes linefeed to carriage return/linefeed
-ocrnl
Does not change carriage returns into linefeeds
-onocr
Outputs carriage returns even at column 0
-n10
Provides no delay after linefeeds
-cr0
Provides no delay after carriage returns
-tab0
Provides no delay after tabs
-bs0
Provides no delay after backspace characters
-vt0
Provides no delay after vertical tabs
-ff0
Provides no delay after form feeds

How to Adjust the Printer Port Characteristics

  1. Become superuser.
  2. Adjust the printer port characteristics.
    # lpadmin -p printer-name -o "stty=options"
    -p

    Specifies the name of the printer for which you are adjusting the port characteristics.

    -o “stty=options”

    Sets the port characteristic (stty option) specified by options. You can change more than one stty option setting with this command. Enclose each option in single quotation marks, and use a space to separate the options. For a complete list of options, see thestty(1) man page. Table 8-1 shows the default stty settings used by the LP print service.

  3. Verify that the printer port characteristics have been changed.
    # lpstat -p printer-name -l

Example 8-1 Adjusting the Printer Port Characteristics

This example shows how to set the port characteristics for the printer luna. The parenb option enables parity checking/generation. The parodd option sets odd parity generation. The cs7 option sets the character size to 7 bits.

# lpadmin -p luna -o "stty='parenb parodd cs7'"

Example 8-2 Setting the Terminal Baud Rate

This example shows how to set the terminal baud rate to 19200 for the printer venus.

# lpadmin -p venus -o "stty=19200"

Adding a terminfo Entry for an Unsupported Printer

The LP print service uses an interface program and the terminfo database to initialize each printer and establish the following:

Each printer is identified in the terminfo database with a short name. The short name required by the terminfo database is identical to the name used to set the TERM shell variable. This name is also the printer type that you specify when setting up a printer. For example, the entries for different types of PostScript printers are in the /usr/share/lib/terminfo/P directory. The default entries provided with the SunOS software release are PS (for PostScript) and PSR (for PostScript Reverse).

If you cannot find a terminfo entry for your printer, you still might be able to use the printer with the LP print service without the automatic selection of page size, pitch, and character sets. However, you might have trouble keeping the printer set in the correct modes for each print request.

If no terminfo entry exists for your type of printer and you want to keep the printer set in the correct modes, you can do one of the following:

A terminal or printer entry in the terminfo database contains and defines hundreds of items. The LP print service, however, uses fewer than 50 of these items. For more information about the terminfo items that are required for a printer, see Required terminfo Items For a Printer.

How to Add a terminfo Entry for an Unsupported Printer


Note - Before you create a terminfo entry for a printer, make sure that none of the existing terminfo entries will support the printer. To do so, try to set up the printer with an entry for a similar printer, if a similar printer exists.


  1. Become superuser.

    For more information, see How to Obtain Administrative Rights in System Administration Guide: Security Services.

  2. Determine a terminfo entry name for the printer.

    The directories in the /usr/share/lib/terminfo directory contain all the valid terminfo entries. Use these entries as a guide for choosing a name for the printer.

  3. Create a terminfo entry file for the printer.

    Table 13-6 shows the items you must define in the terminfo entry to add a new printer to the LP print service. For more details about the structure of the terminfo database, see the terminfo(4) man page.

    To help you start writing a new terminfo entry, use the infocmp command to save an existing terminfo entry to a file. This command is helpful if there is a terminfo entry that is similar to entry you want to create. For example, the following command saves the ps entry to the ps_cust file, which will become the new terminfo entry.

    infocmp ps > ps_cust

  4. Compile the terminfo entry file into the terminfo database.
    # tic terminfo_entry

    where terminfo-entry variable is the terminfo entry file you created.

  5. Check for the new terminfo entry file in the /usr/share/lib/terminfo directory.

Customizing the Printer Interface Program

If you have a printer that is not supported by the standard printer interface program, you can furnish your own printer interface program. You can copy the standard program and then tell the LP print service to use it for a specified printer. First, you need to understand what is in the standard program. The following section describes the standard program.

A printer interface program should perform the following tasks:


Caution

Caution - If you have a printer interface program from a release of UNIX System V prior to release 3.2, it will probably work with the SunOS 5.10 or compatible LP print service. However, several -o options have been standardized in the SunOS 5.10 or compatible LP print service. These options are passed to every printer interface program. These options might interfere with similarly named options used by the old interface.


The LP print service, not a printer interface program, is responsible for opening the printer port. The printer port is given to the printer interface program as standard output. In addition, the printer is identified as the “controlling terminal” for the printer interface program so that a “hang-up” of the port causes a SIGHUP signal to be sent to the printer interface program.

Standard Printer Interface Program

The standard (model) printer interface program is /usr/lib/lp/model/standard. This program is used by the LP print service to set the printing defaults shown in the following table.

Table 8-2 Default Printer Port Characteristics

Characteristic
Default Setting
Default filter
None
Character pitch
None
Line pitch
None
Page width
None
Page length
None
Character set
None
stty options
9600 cs8 -cstopb -parenb -parodd ixon -ixany opost -olcuc onlcr -ocrnl -onocr -onlret -ofill nl0 cr0 tab0 bs0 vt0 ff0
Exit code
0
Customizing stty Modes

If you need to change the terminal characteristics, such as baud rate or output options, find the section of the standard printer interface program that begins with the following comment:

## Initialize the printer port

For more information, see the Adjusting Printer Port Characteristics.

Exit Codes

When printing is complete, your interface program should exit with a code that shows the status of the print job. The exit code is the last entry in the printer interface program.

The following table shows the exit codes and how they are interpreted by the LP print service.

Table 8-3 Printer Interface Program Exit Codes

Exit Code
Meaning to the LP Print Service
0
The print request has been successfully completed. If a printer fault occurred, it has been cleared.
1 to 127
A problem was encountered when printing a request. For example, there were too many nonprintable characters or the request exceeds the printer's capabilities. The LP print service notifies the person who submitted the request that an error occurred when printing it. This error does not affect future print requests. If a printer fault has occurred, it has been cleared.
128
This code is reserved for use by the LP print service. Interface programs must not exit with this code.
129
A printer fault was encountered when printing the request. This fault does affect future print requests. If the fault recovery for the printer directs the LP print service to wait for the administrator to correct the problem, the LP print service disables the printer. If the fault recovery is to continue printing, the LP print service does not disable the printer. However, the print service will try printing again in a few minutes.
>129
These codes are reserved for use by the LP print service. Interface programs must not exit with codes in this range.

If the program exits with a code of 129, root is alerted of a printer fault. The LP print service must also reprint the request from the beginning, after the fault has been cleared. If you do not want the entire request to be reprinted, you can have the interface program send a fault message to the LP print service. (First wait for the fault to be cleared.) When the fault is cleared, the interface program can resume printing the file. When printing is finished, the printer interface program can give a 0 exit code, just as if the fault had never occurred. An added advantage of this approach: The interface program can detect when the fault is cleared automatically. Thus, the administrator does not need to re-enable the printer.

Fault Messages

You can use the lp.tell program to send fault messages to the LP print service. This program is referenced by the LPTELL shell variable in the standard printer interface code. The program takes standard input and sends it to the LP print service. The LP print service puts standard input into the message that alerts the administrator to the printer fault. If its standard input is empty, the lp.tell program does not initiate an alert. For an example of how the lp.tell program is used, examine the standard printer interface code immediately after the following comment:

# Set up the $LPTELL program to capture fault messages here

If you use the special exit code 129 or the lp.tell program, the printer interface program does not need to disable the printer itself. The interface program can disable the printer directly. However, doing so overrides the fault-alerting mechanism. Alerts are sent only if the LP print service detects that the printer has a fault, and the special exit code and the lp.tell program are its main detection tools.

If the LP print service has to interrupt printing of a file at any time, it kills the interface program with a signal TERM (trap number 15). For more information, see the kill(1) and signal(3C) man pages. If the printer interface program dies from receipt of any other signal, the LP print service assumes that future print requests are not be affected. As a result, the LP print service continues to use the printer. The LP print service notifies the user who submitted the request that the request has not been finished successfully.

When the interface is first invoked, the signals HUP, INT, QUIT, and PIPE (trap numbers 1, 2, 3, and 13) are ignored. The standard interface changes this default behavior, so that the signals are trapped at appropriate times. The standard interface interprets receipt of these signals as warnings that the printer has a problem. When the standard interface receives a signal, it issues a fault alert.

Using a Customized Printer Interface Program

You can create a customized printer interface program and use it instead of the standard printer interface program on the print server. To do so, you use the lpadmin command to register the program with the LP print service for a specific printer.

How to Set Up a Custom Printer Interface Program

  1. Become superuser.
  2. Copy the standard printer interface program.
    # cp /var/spool/lp/model/standard  custom-interface
  3. (Optional) If you already have a custom printer interface program, go to Step 5.
  4. Change the copy of the standard printer interface program to meet your needs.

    Refer to the description of the program in Standard Printer Interface Program to determine what you need to change.

  5. Set up the custom printer interface program for a specific printer.
    # lpadmin -p printer-name -i custom-interface
    -p

    Specifies the printer that will use the custom printer interface program.

    -i

    Is the name of the custom printer interface program.

    The custom printer interface program is registered with the LP print service, and will be used by that printer when users submit print requests.

  6. Verify that the custom printer interface program has been added in the /etc/lp/printers/printer-name/configuration file.

Example 8-3 Setting Up a Custom Printer Interface Program

This example shows how to set up a custom printer interface program named custom for the printer luna.

# lpadmin -p luna -i custom

Example 8-4 Copying a Custom Printer Interface Program

This example shows how to copy a custom printer interface program from the printer venus to the printer asteroid.

# lpadmin -p asteroid -e venus