blknowle@frodo.jdssc.dca.mil (Brad L. Knowles) (04/02/91)
Several people have asked for a printcap file for HP printers. I have a DeskJet+ connected to the parallel port of my Sun 386i, but much of what I will say is germane to the serial port configuration too -- in fact, you will find that more serial port definitions for HP printers are well supported and available than parallel port definitions. I had to kind of be a one-man "trail-blazer" around here, as no one I talked to could give me any help. Although I have a Sun 386i, this stuff should work for most any Sun, and perhaps most any Unix box. Thus, I am posting this to Sun-Spots. Of course, what I will give you is totally unsupported, and absolutely no claims are made about this stuff, except that this is what works for me. Please respond via e-mail. I will summarize and re-post. __________________________________________________________________________ | Brad Knowles | Internet: blknowle@frodo.jdssc.dca.mil | | System Administrator | or: blknowle@wis-cms.dca.mil | | DCA/JDSSC/JNSL | Ph: (703) 693-5849 Fax: (703) 693-7329 | | The Pentagon, Room BE685 |_________________________________________| | Washington, D.C. 20301-7010 | my opinions != DCA's opinions or policy | |______________________________|_________________________________________| ------- Begin /etc/printcap file ----------------------------------------- # @(#)printcap.sample 1.11 88/07/08 Copyr 1987 Sun Micro # # Written by: Brad Knowles # Written on: 11 Jan 1990 # # Last Modified by: Brad Knowles # Last Modified on: 18 Mar 1991 # # Hardware: diskless Sun 386i/250, 8M swap, 16M Ram, SunOS 4.0.2 # # The examples below are ONLY useful for printers hand-administered on a # particular machine. Printers available to the network should be # configured using SNAP. SNAP uses a YP version of printcap stored in # /etc/ypprintcap and available as the ``printcap.byname'' YP-map. # The ``generic_*'' entries below are defined in the YP-map. # # If your Master YP server is NOT a Sun 386i, and you are using a 386i # yourself, you need to move the ``generic_*'' entries to this file so that # lpd, etc... can find them. If you leave them in /etc/ypprintcap, # you will get a whole host of errors. Info from Sun help line, put in # /etc/printcap by Brad Knowles on 9 Feb 1990, at 1150 hours. ##------ HP DeskJet Plus attached to this machine on Parallel port 0 # lq|hp|dj|Hewlett-Packard DeskJet Plus (Portrait, 80 Columns):\ :pw#80:\ :tc=portrait: # lqw|hpw|djw|Hewlett-Packard DeskJet Plus (Portrait, 132 Columns):\ :pw#132:\ :tc=portrait: # lqew|hpew|djew|Hewlett-Packard DeskJet Plus (Portrait, 160 Columns):\ :pw#160:\ :tc=portrait: # lqn|hpn|djn|Hewlett-Packard DeskJet Plus (Portrait, 40 Columns):\ :pw#40:\ :tc=portrait: # llq|lhp|ldj|Hewlett-Packard DeskJet Plus (Landscape, 105 columns):\ :pw#105:\ :tc=landscape: # llqw|lhpw|ldjw|Hewlett-Packard DeskJet Plus (Landscape, 175 Columns):\ :pw#175:\ :tc=landscape: # llqew|lhpew|ldjew|Hewlett-Packard DeskJet Plus (Landscape, 210 Columns):\ :pw#210:\ :tc=landscape: # llqn|lhpn|ldjn|Hewlett-Packard DeskJet Plus (Landscape, 52 Columns):\ :pw#52:\ :tc=landscape: # portrait:\ :pl#66:\ :tc=generic_php: # landscape:\ :pl#48:\ :tc=generic_php: # generic_php|Hewlett-Packard DeskJet Plus on Parallel Port 0:\ :hl:\ :lp=/dev/pp0:\ :sd=/var/spool/lp:\ :of=/usr/local/lib/dj:\ :lf=/var/spool/lp/errors: # lp|dhp|ddj|Draft Hewlett-Packard DeskJet Plus (Portrait, 80 Columns):\ :pw#80:\ :tc=dportrait: # lpw|dhpw|ddjw|Draft Hewlett-Packard DeskJet Plus (Portrait, 132 Columns):\ :pw#132:\ :tc=dportrait: # lpew|dhpew|ddjew|Draft Hewlett-Packard DeskJet Plus (Portrait, 160 Columns):\ :pw#160:\ :tc=dportrait: # lpn|dhpn|ddjn|Draft Hewlett-Packard DeskJet Plus (Portrait, 40 Columns):\ :pw#40:\ :tc=dportrait: # llp|dlhp|dldj|Draft Hewlett-Packard DeskJet Plus (Landscape, 105 columns):\ :pw#105:\ :tc=dlandscape: # llpw|dlhpw|dldjw|Draft Hewlett-Packard DeskJet Plus (Landscape, 175 Columns):\ :pw#175:\ :tc=dlandscape: # llpew|dlhpew|dldjew|Draft Hewlett-Packard DeskJet Plus (Landscape, 210 Columns):\ :pw#210:\ :tc=dlandscape: # llpn|dlhpn|dldjn|Draft Hewlett-Packard DeskJet Plus (Landscape, 52 Columns):\ :pw#52:\ :tc=dlandscape: # dportrait:\ :pl#66:\ :tc=generic_dphp: # dlandscape:\ :pl#48:\ :tc=generic_dphp: # generic_dphp|Draft Hewlett-Packard DeskJet Plus on Parallel Port 0:\ :hl:\ :lp=/dev/pp0:\ :sd=/var/spool/lp:\ :of=/usr/local/lib/ddj:\ :lf=/var/spool/lp/errors: # ---------- End /etc/printcap, begin /usr/local/lib/dj -------------------- #!/bin/sh # # @(#)hpdeskjet 1.0 - Copyright 1990 by Brad Knowles, All Rights Reserved. # Last modified by Brad Knowles, 23 Nov 1990 # # # This is the output filter for use with Hewlett-Packard DeskJet & # DeskJet Plus printers. It is called via the "of=" entry in the # generic_php printcap entry. One of the many things it does is send the # escape sequence so that: # # CR is mapped to CR # LF is mapped to CR LF # FF is mapped to CR FF # Draft mode printing selected, if appropriate # # Note that /usr/local/lib/ddj is a hard link to this same file, so that # we can tell what file name we were invoked with, and thus do a little # bit of hanky-panky to get the proper mode set! # # Also, for the purposes of getting this through the mail, I have subsituted # the characters ^ and [ for the actual escape code -- you'll have to do the # conversion back yourself. # name=$0 errorfile="/var/spool/lp/errors" if test "$name" = "/usr/local/lib/dj" then # set Letter Quality mode /usr/bin/echo -n '^[E^[&k2G' else # set Draft Quality mode /usr/bin/echo -n '^[E^[&k2gk1W' /usr/bin/echo -n '^[(s1Q' fi # # Now the fancy stuff starts! # name="DeskJet Plus Printer Driver" if test $# -gt 0 then while test $# -gt 0 do case "$1" in "-l66") ;; # Do nothing, as Portrait=66 Lines/page is default # Portrait modes listed from here to Landscape "-w40") /usr/bin/echo -n '^[(s5H';; # 5 CPI=40 columns "-w80") ;; # Do nothing, as 10 CPI=80 columns is default "-w132") /usr/bin/echo -n '^[(s16.67H';; # 16.67 CPI=132 columns "-w160") /usr/bin/echo -n '^[(s20H';; # 20 CPI=160 columns "-l48") /usr/bin/echo -n '^[&l1O';; # Landscape from here on "-w52") /usr/bin/echo -n '^[(s5H';; # 5 CPI=52 columns "-w105") ;; # Do nothing, as 10 CPI=105 columns is default "-w175") /usr/bin/echo -n '^[(s16.67H';; # 16.67 CPI=175 columns "-w210") /usr/bin/echo -n '^[(s20H';; # 20 CPI=210 columns *) /usr/bin/echo "$name: No such option '$1'." >> $errorfile esac shift done fi # # You will note that there are not options such as "letter", "portrait", # "normal" (for things like Letter Quality print, Portrait mode, or # normal stroke weight) -- all of these are the *DEFAULTS*. Since the # printer is reset before each document, these are not necessary. # /usr/bin/cat if test "$status" -eq 0 then exit 0 else exit 1 fi # # Also note that we are assuming that dip switches 7 & 8 in bank 1 and # switches 1 & 2 in bank 2 are up -- all others are down. --------- End /usr/local/lib/dj ------------------------------------------