-------------------------------------------------------------------------------
 IBM 4029 SunOS* 4.1 Basic Attach Support -- README           Version 0.2 Beta
 Copyright 1992 Lexmark International, Inc.                   November 4, 1992
-------------------------------------------------------------------------------

The Files In This Archive:
-------------------------
ibm4029/
   README          -- This file.
   setup           -- Shell script for performing a default installation.
   printcap.4029   -- Contains a printcap entry for serial attachment
                      of the IBM 4029 laser printer with automatic mode
                      switching between PostScript and PPDS using the
                      4029if LPD plain text filter.
   printcap.4029ps -- Contains a printcap entry for serial attachment
                      of the IBM 4029 laser printer as a PostScript only
                      printer.
   4029if          -- Unix print spooling system plain text filter for IBM 4029
                      binary for SPARC* based (Sun-4*) machines.
   4029if.c        -- The C source to 4029if.
   Makefile        -- A makefile for compiling 4029if.

Cabling of IBM 4029 Printer to Sun workstation:
-----------------------------------------------
   The parallel and serial interfaces share the same connector on the
IBM 4029.  The connector on the printer is a 36-pin D-shell female
receptacle (Centronics connector).  There are three methods of serial
attachment for this printer.

   1. An IBM serial cable P/N 6486685 with a Male-Male gender changer.
      This cable has a 25-pin D-shell connector on the printer end and
      a Female DB-25 connector on the host end.  This cable will support
      DTR/DSR and Xon/Xoff handshaking with most DTE equipment.  As most
      Sun workstations have a Female DB-25 connector on their serial ports,
      a gender changer is necessary to make the connection.

   2. A non-IBM serial printer cable with an IBM serial adapter plug
      P/N 1319143 and a gender changer.  The serial adapter plug maps the
      pins of a Male DB-25 connector to the corresponding pins of the
      printer's 25-pin D-shell connector.  This combination will support
      DTR/DSR and Xon/Xoff handshaking with most DTE equipment.  The serial
      printer cable should have the following pin assignments:

                        Host                 Printer
                   (Female DB-25)          (Male DB-25)
                   --------------          ------------
                                2 -------- 3
                                3 -------- 2
                              4,8 -------- 5
                                5 -------- 20
                                6 -------- 4
                                7 -------- 7
                               20 -------- 6

   3. A standard null-modem cable with an IBM serial adapter plug
      P/N 1319143 and a gender changer if necessary.  This combination
      will support Xon/Xoff handshaking only.

Installation and Setup of Files Under SunOS:
-------------------------------------------
   If you are setting up a PostScript only print queue see "PostScript
Only Setup" at the end of this section.

   As supplied, the default printcap entry will allow for automatic mode
switching with the use of the 4029if filter and is set up as follows:

   1. Printer attached to workstation's ttya port at 38400,n,8,1 and will
      have the name ibm4029 associated with its queue.

   2. Spool directory of /var/spool/ibm4029.

   3. Accounting and log files of acct and log within the
      /var/spool/ibm4029 directory.

   4. The 4029if plain text filter resides in the /usr/local/lib directory.

Non-SPARCstation*/SPARCserver* (Non Sun-4 Application Architecture) Setup:
   If you are installing on a non-SPARCstation or SPARCserver, you need to
   recompile the 4029if filter program.  This can be done by typing "make".

Default Setup:
   If you are satisfied with all of the default location of directories and
   files (items 2-4 above), then you can set up the printer by typing "setup".

   This will automatically create the needed directories, copy the necessary
   files with correct ownership and permissions, and update your /etc/printcap
   file.  Note: Your old printcap file will be saved as /etc/printcap.old.

   If you wish to change any of the port parameters (item 1 above), this may
   be done by editing the ibm4029 entry of the /etc/printcap/file.  See the
   section "Example printcap Entry with Description of Components" of this
   README for more information.

   Set the printer the the appropriate communication mode (under "Main Menu").
   If using the default, they should be:

      Interface : Serial
      Protocol  : Xon/Xoff should work with any of the cabling methods
                  DTR/DSR should work if cabling method 1 or 2
      Baud      : 38400
      Data Bits : 8
      Parity    : None
      Honor DSR : Off

Custom Setup:
   If you want different locations or names for any of the directories or
   files (items 2-4 above), then perform the following steps.

   1. Copy the 4029if filter to the directory where you want it to reside.
      The /usr/local/lib directory is recommended.  Make sure it has the
      executable attribute set.

   2. Concatenate printcap.4029 to /etc/printcap by using:
      cat printcap.4029 >>/etc/printcap

   3. Edit /etc/printcap file to change the printer or spool directory names
      and to insure that the plain text filter (if=) entry of the printcap
      file describes the location where you put the 4029if filter.  You may
      also change any of the communication parameters as necessary.  See the
      description below.

   4. Create a spool directory under /var/spool corresponding to the directory
      specified in the printcap (sd=) entry.  This directory should have daemon
      owner and group and 775 permissions.  If an error logging file (lf=) or
      an accounting file (af=) were specified in the printcap file, the
      associated files should be created with daemon owner and group and 660
      permissions.

   5. Set the IBM 4029 to the interface, baud rate, parity, stop-bits,
      and hand-shaking matching the printcap entry.  In general, 38400 baud,
      no parity, 1 stop-bit, Xon/Xoff handshaking should work well.

PostScript Only Setup:
   If you only want PostScript, perform the following steps.

   1. Concatenate printcap.4029ps to /etc/printcap by using:
      cat printcap.4029ps >>/etc/printcap

   2. Edit /etc/printcap file to change the printer or spool directory names.
      You may also change any of the communication parameters as necessary.
      See the description below.

   3. Create a spool directory under /var/spool corresponding to the directory
      specified in the printcap (sd=) entry.  This directory should have daemon
      owner and group and 775 permissions.  If an error logging file (lf=) or
      an accounting file (af=) were specified in the printcap file, the
      associated files should be created with daemon owner and group and 660
      permissions.

   4. Set the IBM 4029 to the interface, baud rate, parity, stop-bits,
      and hand-shaking matching the printcap entry.  In general, 38400 baud,
      no parity, 1 stop-bit, Xon/Xoff handshaking should work well.

   5. Set the IBM 4029 Emulation/Mode to PostScript.

Example File Permissions:
------------------------
/var/spool:
   drwxrwsr-x  2 daemon   daemon        512 Oct 12 15:33 ibm4029/
/var/spool/ibm4029:
   -rw-rw----  1 daemon   daemon        638 Oct  8 16:18 acct
   -rw-rw----  1 daemon   daemon          0 Oct 12 15:05 log

Default printcap Entry with Description of Fields:
-------------------------------------------------
Example:
01: ibm4029|IBM 4029 Serial:\
02:	:lp=/dev/ttya:\
03:	:br#38400:\
04:	:ms=-parity,crtscts,ixon,tabs,-onlcr,-echo:\
05:	:sd=/var/spool/ibm4029:\
06:	:lf=/var/spool/ibm4029/log:\
07:	:af=/var/spool/ibm4029/acct:\
08:	:if=/usr/local/lib/4029if:\
09:	:mx#0:\
10:	:sh:\
11:	:sf:

Explanation:
01: Specifies that name(s) associated with this printer and queue.
02: Specifies the name of the Unix special (device) file associated with
    the port that the printer is connected to.  In this case /dev/ttya.
03: Specifies the baud rate at which to communicate.  This must match the
    baud rate setting on the printer.
04: Specifies parameters for the serial device.  The params. in this example
    are as follows: -parity = no parity, 8-bit data; crtscts = honor RTS/CTS
    (hardware) handshaking; ixon = honor Xon/Xoff (software) handshaking;
    tabs = do not expand tabs; -onlcr = do not convert LF to CR-LF; -echo =
    do not echo data received from printer.  This corresponds to 38400 baud,
    no parity, 1 stop-bit, and Xon/Xoff or DTR/RTS handshaking on the printer.
    For a full explanation of these parameters may be found in the stty(1)
    man page.
05: Specifies the directory for spooling files.
06: Specifies the name of the log file for printer errors (optional).
07: Specifies the name of the accounting file for printer accounting
    (optional).
08: Specifies the name of the plain text filter. It should point to the
    4029if filter file.
09: Specifies the maximum block size of jobs allowed.  Because of the 
    ability of PostScript* to print graphics this should be set to 0 (no limit).
10: Specifies that no headers are to be generated.  This is necessary because
    Unix headers would cause PostScript to flush.  Headers could be used if
    an appropriate output filter (of=) were put in place to convert the
    ASCII headers to PostScript.
11: Specifies that the spooler is not to place formfeeds at the end of jobs.
    This is because formfeeds will cause PostScript to flush.  4029if
    automatically adds formfeeds to ASCII jobs when needed.

Note: For a full description of the printcap device entries see the
      printcap(5) man page.

The 4029if File:
---------------
   The 4029if file acts as a plain text filter for the print queue associated
with an IBM 4029 printer.  It performs 3 functions:

   1. It "sniffs" each file that is sent to the printer to determine if it
is PostScript or ASCII.  This is done by looking for a "%!" or an EOT (0x04)
as the first character(s) of a file.  If the file begins in any other manner,
it is assumed to be ASCII text.  It then switches the printer to either the
PostScript or PPDS mode.  It assumes the PostScript option has been installed
and the printer has adequate memory.

   2. If ASCII data was detected, the printer is set to 66 lines/page,
Courier 12-pitch, with a 1/2-inch left margin, and sets tab-stops at 9, 17,
25, ..., 89.  Specifying binary mode (-l on the lpr command line) overrides
this initialization.

   3. It sends the entire file (including the first two characters) to
the printer. If the filter has detected ASCII data it automatically maps LF
to CR-LF.  Binary mode overrides this mapping.

   4. If the filter has detected PostScript it appends an EOT (0x04) to
bracket jobs and to ensure that the printer does not stay waiting.  If the file
is ASCII if appends a formfeed if the last character in the file was not one.


------------------
*  SunOS, Sun-4, SPARCstation, and SPARCserver are the registered trademarks
      of Sun Microsystems, Inc.
   SPARC is the registered trademark of SPARC International, Inc.
   PostScript is the registered trademark of Adobe Systems, Inc.
