Skip site navigation (1)Skip section navigation (2)
Date:      07 Nov 2002 19:55:43 +0000
From:      Stacey Roberts <stacey@Demon.vickiandstacey.com>
To:        FreeBSD Questions <freebsd-questions@FreeBSD.ORG>
Subject:   Printing to HP845c attached to Win2K - over samba?
Message-ID:  <1036698946.78873.41.camel@Demon.vickiandstacey.com>

next in thread | raw e-mail | index | archive | help

--=-UKRHRfsZb4e7EN8hjSoB
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

Is anyone successfully printing using apsfilter / smbprint from FBSD
4.7Stable to a printer attached to Win2K Pro, via samba?

I have followed what bits of information I could gather from various
sites and google results and I believe that I've set things up as
required, but I still have problems getting anything to print.

The problem:
First I try something simple:
lpr -Php845c /etc/hosts

This results in the same initialization noises at the printer, paper is
accepted, then all stops, manual feed button lights start blinking. The
*exact* same thing that happened before I installed apsfilter.

Pressing the manual feed button ejects the paper that has the first line
printed stair-cased.

I check the status after manually ejecting the paper:
# lpc status all
hp845c:
        queuing is enabled
        printing is enabled
        no entries in spool area
        printer idle
#
Checking logs:
# tail /var/log/messages
Nov  7 18:37:49 Demon su: stacey to root on /dev/ttyp2
Nov  7 18:39:22 Demon lpd[49267]: lpd startup: logging=3D1
Nov  7 18:39:22 Demon lpd[49267]: lpd startup: ready to accept requests
Nov  7 18:40:35 Demon su: stacey to root on /dev/ttyp2
Nov  7 18:44:42 Demon lpd[75974]: <FBSD Box> requests printjob hp845c
Nov  7 18:44:47 Demon hpijs: unable to write to output, fd=3D6,
count=3D1000: m=20
Nov  7 18:45:17 Demon last message repeated 62066 times
Nov  7 18:47:19 Demon last message repeated 202773 times
Nov  7 18:53:58 Demon last message repeated 674483 times
Nov  7 18:53:58 Demon lpd[2501]: <FBSD Box> requests printjob hp845c
#=20
# ls -la /var/spool/lpd/hp845c/
total 6
drwxr-xr-x  2 root  daemon  512 Nov  7 18:53 .
drwxr-xr-x  3 root  daemon  512 Nov  6 21:24 ..
-rwxr-xr-x  1 root  daemon   51 Nov  6 22:16 .config
-rw-r----x  1 root  daemon    4 Nov  7 18:44 .seq
-rw-r--r--  1 root  daemon    0 Nov  6 21:24 acct
-rw-rw-r--  1 root  daemon   37 Nov  7 18:44 lock
-rw-r--r--  1 root  daemon    0 Nov  6 21:24 log
-rw-rw-r--  1 root  daemon   29 Nov  7 18:44 status
#

There *is* one thing I am not sure of at all and would appreciate
someone / anyone telling me: "What are you supposed to do with the
smbprint file?"=20
From its own comments, smbprint says
that smbclient presumes that he lives in the same location as smbprint:

#smbclient=3D/usr/pkg/bin/smbclient
# Assume that smbclient will be in the same place as smbprint
smbclient=3D"`dirname $0`/smbclient"

But copying smbprint to /usr/local/samba doesn't change anything. I get
the *exact* same results no matter where smbprint lives..,


I'd appreciate any assistance with this, and would be happy to post more
info / configs should you require so.

Thanks much.

Regards,

Stacey


Some facts:
/etc/printcap:
# APS1_BEGIN:printer1
# - don't delete start label for apsfilter printer1
# - no other printer defines between BEGIN and END LABEL
hp845c|ijs/DESKJET_845;r=3D600x300;q=3Dmedium;c=3Dfull;p=3Da4;m=3Dauto:\
    :lp=3D/dev/null:\
    :if=3D/usr/local/etc/apsfilter/basedir/bin/apsfilter:\
    :sd=3D/var/spool/lpd/hp845c:\
    :lf=3D/var/spool/lpd/hp845c/log:\
    :af=3D/var/spool/lpd/hp845c/acct:\
    :mx#0:\
    :sh:
# APS1_END - don't delete this
$

Here's what smbprint looks like:
$ cat smbprint
#!/bin/sh=20

# This script is an input filter for printcap printing on a unix
machine. It
# uses the smbclient program to print the file to the specified
smb-based=20
# server and service.
# For example you could have a printcap entry like this
#
# smb:lp=3D/dev/null:sd=3D/usr/spool/smb:sh:if=3D/usr/local/samba/smbprint
#
# which would create a unix printer called "smb" that will print via
this=20
# script. You will need to create the spool directory /usr/spool/smb
with
# appropriate permissions and ownerships for your system.

# Set these to the server and service you wish to print to=20
# In this example I have a WfWg PC called "lapland" that has a printer=20
# exported called "printer" with no password.

#
# Script further altered by hamiltom@ecnz.co.nz (Michael Hamilton)
# so that the server, service, and password can be read from=20
# a /usr/var/spool/lpd/PRINTNAME/.config file.
#
# Script further modified by Richard Sharpe to fix some things.
# Get rid of the -x on the first line, and add parameters
#
#    -t  now causes translate to be used when sending files
#
# Further modifications by Alfred Perlstein to fix some problems and
# improve the quality of the code (3-Dec-2001).
#
# More hacking by Richard Sharpe to improve portability. 9-Dec-2001.
#
# In order for this to work the /etc/printcap entry must include an=20
# accounting file (af=3D...):
#
#   cdcolour:\
#	:cm=3DCD IBM Colorjet on 6th:\
#	:sd=3D/var/spool/lpd/cdcolour:\
#	:af=3D/var/spool/lpd/cdcolour/acct:\
#	:if=3D/usr/local/etc/smbprint:\
#	:mx=3D0:\
#	:lp=3D/dev/null:
#
# The /usr/var/spool/lpd/PRINTNAME/.config file should contain:
#   server=3DPC_SERVER
#   service=3DPR_SHARENAME
#   password=3D"password"
#
# E.g.
#   server=3DPAULS_PC
#   service=3DCJET_371
#   password=3D""

#smbclient=3D/usr/pkg/bin/smbclient
# Assume that smbclient will be in the same place as smbprint

smbclient=3D"`dirname $0`/smbclient"

#
# The last parameter to the filter is the accounting file name.
#   Extract the directory name from the file name.
#   Concat this with /.config to get the config file.
#
TRANS=3D0
eval acct_file=3D\${$#}
spool_dir=3D`dirname $acct_file`=20
config_file=3D$spool_dir/.config

# Should read the following variables set in the config file:
#   server
#   service
#   password
#   username (optional)
#   IP (optional)
#   debug (optional)
#   debugsmb (optional)
#   debugfile (optional)
. $config_file

if [ "x$password" =3D "x" ] ; then
	password=3D"-N"
fi

if [ "x$username" =3D=3D "x" ] ; then
	username=3D"$server";
fi

while test $# -gt 0; do
	case "$1" in
	-t)
		TRANS=3D1
		;;

	 *)   # Bad Parameters, ignore them ...
		;;
	 esac
	 shift
done

command=3D"print - ;"
if [ $TRANS -eq 1 ]; then
	command=3D"translate;$command";
fi

debugfile=3D"/tmp/smb-print.log"
if [ "x$debug" =3D "x" ] ; then=20
		debugfile=3D/dev/null debugargs=3D
else
        if [ $debug -eq 0 ] ; then
		debugfile=3D/dev/null debugargs=3D
	else
		set -x; exec >>$debugfile 2>&1
		debugargs=3D"$debugfile."
		#[ "x$debugsmb" =3D=3D "x" ] || debugargs=3D"$debugargs -d $debugsmb"
	fi
fi

if [ "x$smbconf" !=3D "x" ]; then

	smbconf=3D"-s $smbconf"

fi

if [ "x$IP" !=3D "x" ]; then

	IP=3D"-I $IP"

fi

if [ "x$debugargs" !=3D "x" ]; then

	debugargs=3D"-l $debugargs"

fi

$smbclient \
	"\\\\$server\\$service" \
	$password \
	$smbconf \
	$IP \
	$debugargs \
	-U $username \
	-P \
	-c "$command"
#
$
--=20
Stacey Roberts
B.Sc (HONS) Computer Science

Web: www.vickiandstacey.com


--=-UKRHRfsZb4e7EN8hjSoB
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: PGP 6.5.8

iQEVAwUAPcrFPJvQeubckvvXAQH2DAgAqRuyKzwt50zAF6UGu+n7mwIaqJmqrLKm
MSr7K8NOXs0oRLiVoOf+Q+V68uJ20EL8LnoWiNPc5pcLmNJK0lqg3sPAQIjD6LPu
YImvFSkSZ2oP5wir+Ia/rJOXsgyKODI/Nv0Wh4UeZVis8NHyexsnIzkTLCMyHDC8
ZHr7zRSiaUxSJH8xanTX3BPr8K2A/XlKxBe25zlS2hzDBz5N9xsfqQu4T3l3UhYA
0T0G6z/i/shcLZ8+uwxn7QPIcJJV5J+o0u50c+wtCQxJ5Y9QEea7eJchFpw6zQII
5QtukkLAEB2++hxzxKzSaw9XyfLwTqccUWeBzONdc+Gl4UElFivsAQ==
=92gx
-----END PGP SIGNATURE-----

--=-UKRHRfsZb4e7EN8hjSoB--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1036698946.78873.41.camel>