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>
index | next in thread | raw e-mail
[-- Attachment #1 --]
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=1
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=6,
count=1000: m
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
#
# 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?"
From its own comments, smbprint says
that smbclient presumes that he lives in the same location as smbprint:
#smbclient=/usr/pkg/bin/smbclient
# Assume that smbclient will be in the same place as smbprint
smbclient="`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=600x300;q=medium;c=full;p=a4;m=auto:\
:lp=/dev/null:\
:if=/usr/local/etc/apsfilter/basedir/bin/apsfilter:\
:sd=/var/spool/lpd/hp845c:\
:lf=/var/spool/lpd/hp845c/log:\
:af=/var/spool/lpd/hp845c/acct:\
:mx#0:\
:sh:
# APS1_END - don't delete this
$
Here's what smbprint looks like:
$ cat smbprint
#!/bin/sh
# 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
# server and service.
# For example you could have a printcap entry like this
#
# smb:lp=/dev/null:sd=/usr/spool/smb:sh:if=/usr/local/samba/smbprint
#
# which would create a unix printer called "smb" that will print via
this
# 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
# In this example I have a WfWg PC called "lapland" that has a printer
# 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
# 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
# accounting file (af=...):
#
# cdcolour:\
# :cm=CD IBM Colorjet on 6th:\
# :sd=/var/spool/lpd/cdcolour:\
# :af=/var/spool/lpd/cdcolour/acct:\
# :if=/usr/local/etc/smbprint:\
# :mx=0:\
# :lp=/dev/null:
#
# The /usr/var/spool/lpd/PRINTNAME/.config file should contain:
# server=PC_SERVER
# service=PR_SHARENAME
# password="password"
#
# E.g.
# server=PAULS_PC
# service=CJET_371
# password=""
#smbclient=/usr/pkg/bin/smbclient
# Assume that smbclient will be in the same place as smbprint
smbclient="`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=0
eval acct_file=\${$#}
spool_dir=`dirname $acct_file`
config_file=$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" = "x" ] ; then
password="-N"
fi
if [ "x$username" == "x" ] ; then
username="$server";
fi
while test $# -gt 0; do
case "$1" in
-t)
TRANS=1
;;
*) # Bad Parameters, ignore them ...
;;
esac
shift
done
command="print - ;"
if [ $TRANS -eq 1 ]; then
command="translate;$command";
fi
debugfile="/tmp/smb-print.log"
if [ "x$debug" = "x" ] ; then
debugfile=/dev/null debugargs=
else
if [ $debug -eq 0 ] ; then
debugfile=/dev/null debugargs=
else
set -x; exec >>$debugfile 2>&1
debugargs="$debugfile."
#[ "x$debugsmb" == "x" ] || debugargs="$debugargs -d $debugsmb"
fi
fi
if [ "x$smbconf" != "x" ]; then
smbconf="-s $smbconf"
fi
if [ "x$IP" != "x" ]; then
IP="-I $IP"
fi
if [ "x$debugargs" != "x" ]; then
debugargs="-l $debugargs"
fi
$smbclient \
"\\\\$server\\$service" \
$password \
$smbconf \
$IP \
$debugargs \
-U $username \
-P \
-c "$command"
#
$
--
Stacey Roberts
B.Sc (HONS) Computer Science
Web: www.vickiandstacey.com
[-- Attachment #2 --]
-----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-----
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1036698946.78873.41.camel>
