Printer device driver pass-through mode

The printer device driver itself, for example /dev/lp0, by default operates in non-pass-through mode.

A user can query or modify the operating rules for /dev/lp0 by issuing the splp command. For example, below are the results of issuing the command splp lp0 on a system with an IBM® 4029 LaserPrinter defined as lp0. The results are output to the display element specified by the TERM environment variable.

device = /dev/lp0      (+ yes     ! no)
CURRENT FORMATTING PARAMETERS (ignored by qprt, lpr, and lp commands)
Note: -p + causes the other formatting parameters to be ignored.

-p !    pass-through?                   -c +    send carriage returns?
        
-l 64   page length (lines)             -n +    send line feeds?
              
-w 80   page width (columns)            -r +    carriage rtn after line fee?

-i 0    indentation (columns)           -t +    suppress tab expansion?
       
-W !    wrap long lines?                -b +    send backspaces?
              
-C !    convert to upper case?          -f +    send form feeds? 
             
CURRENT ERROR PROCESSING PARAMETERS
-T 600  timeout value (seconds)         -e !    return on error? 
             
CURRENT SERIAL INTERFACE PARAMETERS
-B 19200baud rate                       -s 8    character size (bits) 
        
-N !    enable parity?                  -S !    two stop bits? 
               
-P !    odd parity?                   

The -p parameter determines whether the printer device driver, /dev/lp0, will default to a pass-through mode of operation; the mode of operation can be overridden for a specific data stream. By default, the value of the -p parameter is !, or no. It is important to note that the question asked by the -p parameter is "Will the mode of operation be pass-through mode?"

If the value of the -p parameter is !, then all of the other parameters listed are honored by the device driver during data stream processing. Likewise, if the value of the -p parameter is +, or yes, then all of the other parameters are ignored during data stream processing.

Using the splp command to change the parameter values of the printer device driver does not affect the operation of the spooler. The splp command affects commands such as cat when they are used to access the device driver directly, bypassing the spooler. For example, the command

cat /etc/motd > /dev/lp0

opens /dev/lp0 and writes the contents of the "message of the day" directly to the printer. The output on the printer is formatted similar to the following example:

This is a test version of /etc/motd, used to demonstrate
what happens when a printer device driver, such as
/dev/lp0, is placed into or taken out of passthru mode.
Printers will print either exactly what they are sent,
if you set the job conditions up correctly, or, on the
most current printers, you may be able to direct the
printer to perform certain mappings for you.
There are no carriage returns in
this file, and the only blank line occurs
immediate before this one.

Notice that the -r parameter dictates the mapping of each linefeed to a linefeed and carriage return if the value of -p is !. This is necessary as most UNIX-based operating systems only use linefeeds; unlike DOS or OS/2 or other operating systems, in UNIX-based operating systems a linefeed implies a carriage return. While this works well with text editors and in other similar situations, it does not work with printers. Printers print only the data which they are sent. For example, issuing the two commands

splp -p+ lp0
cat /etc/motd > /dev/lp0

results in output similar to the following appearing on the printer.

This is a test version of /etc/motd, used to demonstrate
what happens when a printer device driver, such as
/dev/lp0, is placed into or taken out of passthru mode.
Printers will print either exactly what they are sent,
if you set the job conditions up correctly, or, on the
most current printers, you may be able to direct the
printer to perform certain mappings for you.
There are no carriage returns in
this file, and the only blank line occurs
immediately before this one.

In the first example, all of the device driver settings are honored. In particular, the mapping of a linefeed to a linefeed and a carriage return is turned on. When the device drivers are writing characters to the physical printer, it sends a carriage return after each linefeed. It also honors the settings for page width.

In the second example, the device driver is limited to simply writing each single-byte character of /etc/motd to the physical printer, without any mapping or other modification of the data stream occurring. When the first sentence of /etc/motd ends, the linefeed drops the printhead straight down one line; there is no carriage return to move the printhead back to the left margin. The first four letters of the word "printer, prin, are printed. At that point the printer itself, not the device driver, determines that the right margin has been reached and so prints a carriage return, returning the printhead to the left margin. Printing continues with the next character in the data stream.

In the second example, the job does not even print until the reset button on the printer is pressed. This is because the printer has not received enough date (characters) to automatically eject a page, and no formfeeds were sent to the printer to cause it to eject the page; the -f parameter on the device driver is ignored.