*BSD News Article 31616


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!constellation!convex!convex!cs.utexas.edu!swrinde!pipex!demon!awfulhak.demon.co.uk!awfulhak!brian
From: brian@awfulhak.demon.co.uk (& Somers)
Newsgroups: comp.os.386bsd.questions
Subject: Re: Problem with HP Desk Jet 500
Date: 09 Jun 1994 21:07:34 GMT
Organization: Coverform Ltd.
Lines: 280
Message-ID: <BRIAN.94Jun9210734@awfulhak.demon.co.uk>
References: <2st8cn$qvp@panix3.panix.com>
NNTP-Posting-Host: awfulhak.demon.co.uk
In-reply-to: scibp6p@panix.com's message of 5 Jun 1994 15:17:43 -0400

In article <2st8cn$qvp@panix3.panix.com> scibp6p@panix.com (Boris Pitel) writes:

       Hi, everybody!
      My next problem is Printer :)) !
    I am trying to make work my HP Desk Jet 500. Under DOS it works and is
   connected to the LPT1 port. In FreeBSD it doesn't. I know that lpd DAEMON
   is running - I can see the appropriate line in /etc/rc, and can see the process
   lpd by typing ps -aux.
   In the printcap I have a line,which points to /dev/lpa0 driver, and also points
   to valid directories and files for spooling and error messages.
      When I do somrthing like lpr rc, or lpr -Plp rc to print file rc the printer
   starts to make noises prints 1 line of text, then 2 empty pages and stops.
      I don't get any error messages. When I try to cp rc /dev/lpa0 happens the
   same thing.
      Don't know what is the matter?
      Please help me!
			   Boris Pitel.

Hmmmm, De ja vous (is that how to spell it?).  I've posted the same message
in the past....  Some kind soul gave me this:

Kernel config:

device		lpa0	at isa? port "IO_LPT1" tty


File /etc/printcap:

    #	@(#)printcap	5.3 (Berkeley) 6/30/90

    lp|deskjet|HP Deskjet 500:\
	:lp=/dev/lpa0:\
	:sd=/var/spool/lpd:\
	:sh:\
	:mx#0:\
	:of=/usr/local/filters/apsfilter:\
	:lf=/var/log/lpd-errs:


File /usr/local/filters/apsfilter:
#!/bin/sh

# apsfilter-1.3 - HP Deskjet 500 - output filter - V 1.3
#
# copyright 1993 by Andreas Klemm <andreas@knobel.knirsch.de>
#
# Mon Nov 15 12:35:26 GMT 1993
#
# additional contributors:
#
#	Steven A. Reisman <unido!beehive.mn.org!sar>
#		- added dvi filter
#
#	Jeff Stern <jstern@eclectic.ss.uci.edu>
#		- use lpfilter as an input filter
#		  so it's possible to print header pages
#		  without confusing the filter.
#		--> see modification section
#

####################################################################
# A running /etc/printcap
####################################################################
#
# My /etc/printcap entry for parallel printer port lpt1:
# on a 486/33 using Linux Slackware using this filter as
# an output filter, since I don't need header pages. (andreas)
#
# HP Deskjet
# lp|deskjet|HP Deskjet 500:\
#	:lp=/dev/lp1:\
#	:sd=/usr/spool/lp1:\
#	:sh:\
#	:mx#0:\
#	:of=/usr/lib/lpfilter:
#
####################################################################

####################################################################
# MODIFICATION SECTION
#		suggestions from other creative people
#		which use another configuration than I
####################################################################
#
# A) WANT HEADER PAGES
#			Jeff Stern <jstern@eclectic.ss.uci.edu>
#			Mon Nov  1 21:21:45 GMT 1993
#
# "... I changed to using it as an input filter instead of an output 
#  filter. This way I can still print header pages without confusing 
#  the filter. This necessarily required adding a command to tell 
#  printcap to send a formfeed at the beginning of opening the device 
#  and also specifying that that formfeed really also includes the 
#  LF-> CR+LF translation: this is so that the translation also will 
#  work for the header page, too."
#  Necessary Printcap entry instead of the default:
#	lp:lp=/dev/lp1:sd=/usr/spool/lp1:if=/usr/lib/lpfilter:mx#0:\
#       :lf=/usr/adm/lpd-errs:ff=\033E\033&k2G\033&a10L:fo
#
####################################################################
# END OF MODIFICATION SECTION
####################################################################

PATH=/usr/bin:/bin:/usr/local/bin:/usr/TeX/bin:/home/bin:/usr/gnu/bin
export PATH

# where do you have diskspace
#
TmpDir=/usr/tmp

#
#	Define some shorthand for PCL sequences
#

# LINE TERMINATION	\E & k # G
#	0 = CR=CR   ; LF=LF   ; FF=FF (default)
#	1 = CR=CR+LF; LF=LF   ; FF=FF
# 	2 = CR=CR   ; LF=CR+LF; FF=CR+FF
#	3 = CR=CR+LF; LF=CR+LF; FF=CR+FF
NORAW="\033&k2G"		#Translate LF to CR+LF and FF to CR+FF
RAW="\033&k0G"			#Do not translate CR, LF, or FF

UELCOMMAND="\033%-12345X"
RESETJOB="\033E\033&l2A"	#Reset printer, eject if any printing on page,
				#Select letter paper by default
RESETPAGE="\033E"		#Reset printer, eject if any printing on page
EJECTPAGE="\033&l0H"

# QUALITY
# Not standard PCL, used for Deskjet
#			\E ( s # Q
#   	1 = draft	= 240cps
# **	2 = letter	= 120cps (default)
#QUALITY="\033(s2Q"

# Text Scale Mode		\E & k # W
#   	5 = off (default)
#     	6 = on
#	ignored in landscape mode
# TEXTSCALEMODE="\033&k5W"

# Perforation Skip Mode		\E & l # L
#       0 = off = 0.0 in Top Margin
#   	1 = on  = 1/2 in Top Margin (default)
PERFSKIPMODE="\033&l0L"

# Left Margin			\E & a # L
# 	# Value = column number
#	default = 0 = 1/8 in left margin
#	used = 7 for 1" left margin
LEFTMARGIN="\033&a7L"

# Pitch				\E ( s # H
#	# = cpi
#	default = 10 characters per inch
# **	12 cpi
PITCH="\033(s12H"


PSINTERPRETER="/usr/gnu/bin/gs -q			\
		-sDEVICE=ljet3		\
		-sOutputFile=-		\
		-			\
		quit.ps"

# Temp. filename
TmpFile=$TmpDir/deskjetof.$$

# Who should be notified by e-mail in case of print problems ?
NOTIFY=root

# write print data from stdin to temp file
cat - > $TmpFile

#
# reset printer to power on values before print job
#
printf "$UELCOMMAND"
printf "$RESETJOB"

# determine file type
# set output of the ``file'' command to new script arguments $1, $2, ..., $n
#
set -- `file $TmpFile`

# throw away $1 since that is the *file name*
#
shift

# the rest is a "string" which consist of one or multiple words 
# describing the file type. For example: "Korn Shell Script"
#
FileType=$*

case $FileType in

    PostScript*)	#
			# pipe ps data through ghostscript
			#	
			cat $TmpFile			\
			| $PSINTERPRETER		\
			|| printf "$EJECTPAGE"
			# ^  if an error occurs, then
			# |  eject already loaded paper
			;;

			
    *DVI*)		#
			# TeX dvi file -> dvips -> gs
			#	
			dvips 2>/dev/null $TmpFile -f	\
			| $PSINTERPRETER		\
			|| printf "$EJECTPAGE"
			# ^  if an error occurs, then
			# |  eject already loaded paper
			;;

    *text*|*script*)	#
			# print normal text with
			#	- cr/nl conversion
			#	- letter quality
			#	- 66 lines/page
			#	- left margin
			#	- 12 cpi pitch
			#

			printf "$NORAW"
#			printf "$QUALITY"
			printf "$PERFSKIPMODE"
			printf "$LEFTMARGIN"
			printf "$PITCH"

			# print tmp file
			cat $TmpFile
			;;

	*data*)		#
			# print binary files
			#

			printf "$RAW"

			# print tmp file
			cat $TmpFile
			;;
			

	*)		#
			# Rest is an unknown file type ...... sorry ;-)
			#

			echo "deskjetof: unknown filetype $FileType" > /dev/console
			echo "deskjetof: $TmpFile: unknown filetype $FileType" \
			| mail $NOTIFY
			NotOk=1
			;;
esac

#
# keep print job, that couldn't be printed because of errors....
#
if [ ! "$NotOk" = "1" ]
then 
	rm -f $TmpFile
fi


#
# reset printer to power on values after print job
#
printf "$RESETPAGE"
printf "$UELCOMMAND"
#


I'm running FreeBSD-1.1-RELEASE with a deskjet 500C.  Hope this helps.
--
Brian <brian@awfulhak.demon.co.uk>

Don't _EVER_ lose your sense of humour....