System Administration Guide
Chapter 4, Managing printers and print jobs

Configuring a spooled local terminal printer

Configuring a spooled local terminal printer

To configure a spooled local terminal printer using an intelligent serial card with built-in support for local printing, configure the printer using one of the special device nodes provided with your card. 

If you are using a dumb serial port or if the device driver for your intelligent serial port does not provide special handling for local terminal printers, then you must use a special null device name. When you stop I/O on this device, no other processes are affected.

To set up the spooled local terminal printer:

  1. Log in as root.

  2. Create a second null device. Enter these commands:

    cd /dev
    mknod lpnull c 4 128
    chown lp lpnull
    chgrp lp lpnull
    chmod 660 lpnull

    Use same major number as /dev/null for lpnull (4 in this case) and use 128 for the minor number. For more information, see the mknod(C) manual page.

  3. Create a copy of the printer interface script that you want to use:

    cd /usr/spool/lp/model
    copy -om interface_script new_script
    chmod u+w new_script

    interface_script is the name of the printer interface script to use; new_script is the copy.

  4. Edit new_script to:

    a.
    Change the name in the comment at the top of the script to indicate the name of the new interface.


    NOTE: The following sequences are for a Wyse 60 terminal. If you are using a different type of terminal, refer to your terminal manual for the escape sequences to lock and unlock the terminal's keyboard and to turn on and off transparent print mode, and use them instead.

    b.
    Add the following code before any I/O occurs:
    # setup string termport="/dev/tty2h"   
    # change tty2h to port for your terminal penable="\017\033d#pdisable="
      "\024 161pnull="/dev/lpnull" codes to enable printer for Wyse 60 pdisable=
      "\024\016\c"   
    # codes to disable printer for Wyse 60 lpnull="/dev/lpnull"    
    # dummy regular file or dedicated device file sttystr="ixon -ixany 
      ixoff opost onlcr" 
    # modify for your printer if necessary
    

    # redirect std in, std out to termport std err to lpnull #sleep 3 # uncomment this is if terminal data appears on your printout exec <$termport >$termport 2>$lpnull

    # If it is necessary to change the baud rate or other stty settings for your serial printer modify the sttystr above. sttysave=`stty -g` stty $sttystr

    # escape sequence for the terminal to lock the keyboard and turn on transparent print mode. # You must first lock the keyboard then turn on transparent print echo "$penable"

    c.
    Add the following code at the end of the script immediately before the exit:
    # escape sequence for the terminal to turn off transparent print 
      mode and unlock the terminal.  First turn off transparent print 
      then unlock keyboard.
    # sleep 2        
    # uncomment this if print data appears on your terminal echo 
      "$pdisable"
    

    # reset stty settings stty $sttysave

    

  5. Use the Printer Manager to set up your local terminal printer.

  6. If you are setting up multiple spooled local terminal printers, set up each printer as described in step 5. Otherwise, skip to step 7.

    After setting up multiple spooled printers, enter these commands:

    cd /dev
    rm lpnull
    touch lpnull
    chown lp lpnull
    chgrp lp lpnull
    chmod 660 lpnull

    These commands replace the character device special file /dev/lpnull with an empty regular file of the same name. This regular file can be shared by the spooled local terminal printers without causing the problems that would occur if they shared a device special file. 

  7. If it is not already running, start up the print service.

  8. Enable the new printer.

  9. Set up the printer to accept jobs.

  10. Test the new local terminal printer. Log into the terminal and enter:

    lp -dprinter_name /etc/motd

    The message of the day should print on the local terminal printer.

Only two user IDs can use the local terminal printer: the user ID logged into the termport device and root. To allow others to access the printer temporarily:

disable ttyxx
chgrp lp /dev/ttyxx
chmod 660 /dev/ttyxx

Replace xx with the termport device name.

To return the port to normal use, enter:

enable ttyxx

Replace xx with the termport device name.