DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Managing printers and print jobs

Attaching a printer to a serial terminal

The operating system supports the use of local printers attached to the AUX or PRINT port on the back of many serial terminals. You can connect these printers via standard RS-232 connections to reduce the load on shared system printers. Once you configure the terminal properly, you can use the lprint(C) command to print files on the local printer.


NOTE: Your terminal's stty settings must match those of the printer. (In most cases, this is true.) If the terminal and printer require different stty settings, see ``Handling different stty settings''.

To add a printer connected to the AUX or PRINT terminal port:

  1. Connect your local serial printer to the AUX port on your terminal with a standard RS-232 cable with at least pins 2, 3, and 7 connected. Make sure the printer is powered on and online. (If the terminal supports pass-through mode to the parallel port, you can use the parallel port.)

  2. Log into the system on the terminal and verify that the terminal is working correctly.

  3. Make sure that the AUX port on your terminal is configured with the same settings as your printer (baud rate, parity, data bits, XON/XOFF, and so forth).

  4. Verify that the entry for your terminal in /etc/termcap (or an alternate file, defined by the TERMCAP variable) includes definitions for PN (start printing) and PS (stop printing).

    The lprint command must know how to start and stop local printing for each specific terminal. The PN and PS terminal attributes in /etc/termcap define escape sequences that are sent to the terminal to control local printing.


    NOTE: Very few terminals have these attributes defined in their termcap entries.

    Use a text editor to search for the entry for your terminal in the /etc/termcap file. For example, if your terminal is a Wyse 60, search for ``wyse60''.

    Wyse 60 termcap entry

    w7|wy60|wyse60|Wyse WY-60 with 80 column/24 line screen in wy60 mode:\
        :is=\E`\072\Ee(\EO\Ee6\Ec41\E~4\Ec21\Ed/:\
        :if=/usr/lib/tabset/std:pt:\
        :G1=\EH3:G2=\EH2:G3=\EH1:G4=\EH5:GD=\EH0:GG#0:GH=\EH\072:\
        :GU=\EH=:GV=\EH6:GR=\EH4:GL=\EH9:GC=\EH8:GF=\EH7:\
        :PU=\EJ:PD=\EK:\
        :al=\EE:am:bs:bt=\EI:cd=\EY:ce=\ET:cl=\E+:\
        :cm=\Ea%i%dR%dC:co#80:dc=\EW:dl=\ER:ei=\Er:im=\Eq:k0=^AI\r:\
        :k1=^A@\r:k2=^AA\r:k3=^AB\r:k4=^AC\r:k5=^AD\r:k6=^AE\r:k7=^AF\r:\
        :k8=^AG\r:k9=^AH\r:kd=^J:kh=^~:kl=^H:kr=^L:ku=^K:\
        :li#24:mi:nd=^L:se=\EG0:so=\EG4:sg#0:ug#0:ue=\EG0:ul:up=^K:us=\EG8:\
        :PN=\Ed#:PS=^T:hs:ts=\Ez(:fs=^M:
    

    The Wyse 60 has PN and PS defined.

  5. If termcap does not define PN and PS for your terminal, you must add a line with the following format:

    :PN=start sequence:PS=stop sequence:

    Log in as root to edit /etc/termcap. Make a backup copy of /etc/termcap before editing it.

    Refer to your terminal manual to find the sequence of control characters used to switch the auxiliary port on and off (this is sometimes referred to as ``passthrough'' or ``transparent'' mode). For example, for a Wyse 60 terminal, the code to switch on the port auxiliary printing is:

    <Esc> d #

    And the code to turn it off is:

    <Ctrl>t

    You must translate these keystrokes into termcap format before inserting them into the termcap file. termcap uses the codes in ``termcap keystroke translations'' to represent keystrokes.

    termcap keystroke translations

    Keystroke termcap sequence
    ESCAPE \E
    CTRLx ^x (x is any character)
    NEWLINE \n
    RETURN \r
    TAB \t
    BACKSPACE \b
    FORMFEED \f


    NOTE: To use a control sequence, use the caret (^) symbol, not the <Ctrl> key. For example, <Ctrl>x translates to ^x.

    You can represent characters by their caret (^) and backslash (\) characters or by their octal codes. See the ascii(M) manual page. Separate termcap attributes by a colon (:).

    Translate the termcap entry for the Wyse 60 keystrokes for PN (<Esc> d #) and PS (<Ctrl>t) into a termcap entry.

       :PN=\Ed#:PS=^T:\
    
    For a terminal missing these entries, simply insert a modified version of this line into the termcap entry for the terminal. For other terminals, check your owner's manual and locate the proper sequences for turning the auxiliary print mode on and off and substitute the termcap sequences as in the example. Some terminals (such as the Wyse 60) include a transparent mode, where the data is not displayed on the screen as it is printed. This is the mode selected by the PN sequence in the example.

  6. Once you add the PN and PS entries, log out of and back into the terminal to activate the new termcap entry.

  7. Use the following command to print the file filename on your new local printer:

    lprint filename

    Do not touch your keyboard while local printing is taking place. You cannot perform other tasks on your terminal while printing.

If your file prints on the screen instead of on the printer, the PS and PN entries you created are incorrect. Revise the entries with the correct codes. If the file still does not print on the printer or the terminal, try crossing the Transmit and Receive Data pins in the cable connecting the terminal AUX port and the printer. (This is also known as a ``null modem'' connection.)

To eliminate carriage return delays, set the environment variable CRDELAY to ``N''. Do this only if you are running a fast printer.

If, when printing with lprint, everything prints on one line, set the environment variable FORMS to ``X'' to turn on lprint's ``transparent'' mode. In this mode, lprint does not perform special processing of carriage returns, line feeds, form feeds, or tabs.

Put these definitions either in individual users' .profile or .cshrc files or in the /etc/profile or /etc/cshrc files. If you add them to /etc/profile and /etc/cshrc, they affect all users on the system.

Handling different stty settings

If the terminal and printer require different stty settings, you must create a shell script to handle that:

  1. Create a file called lprints and enter the following text:
       :
       # /usr/bin/lprints
       #
       # Do local printing with stty settings that differ from
       # those of the terminal. The required settings are read
       # from environment variable LPRINTSTTY.
       

    oldstty=`stty -g` [ "$LPRINTSTTY" != "" ] && stty $LPRINTSTTY

    FORMS=X /usr/bin/lprint "$@"

    stty $oldstty

  2. Change the permissions on the file:

    chmod 755 lprints

  3. Put the file in an appropriate directory (for example: /usr/bin) and use it instead of lprint:

    lprints filename

    Users can store the stty settings required for a local printer using the environment variable LPRINTSTTY. You can set system-wide values in the /etc/profile and /etc/cshrc files:

       LPRINTSTTY="ixon ixoff -ixany onlcr"; export LPRINTSTTY
    

See also:


Next topic: Configuring a spooled local terminal printer
Previous topic: Setting up a printer with multiple names

© 2007 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 05 June 2007