Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Aug 2013 22:58:08 +0300
From:      Juris Kaminskis <juris.kaminskis@gmail.com>
To:        freebsd-questions@freebsd.org
Subject:   Setup HP Laserjet 1120m over network with LPD
Message-ID:  <CAKJAkzvA5+G5mOAZKKQOS6zdq+=A0i-BpbtjJtDwZJipskuz0A@mail.gmail.com>

Next in thread | Raw E-Mail | Index | Archive | Help
after several trials and errors and reading through FreeBSD handbook I am
at dead end on how to proceed further, hope someone can guide me.

my /etc/printcap entry:
-----------------------
HP:\
:rm=192.168.1.105:sd=/var/spool/hp:lf=/var/log/lpd-errs:\
:if=/usr/local/libexec/hp-network:
-----------------------

my /usr/local/libexec/hp-network entry:
-----------------------
#!/bin/sh
#
# hp-network - Text filter for HP printer `NPI2B483C' listening
# on port 9100. Installed in /usr/local/libexec/hp-network
#
exec /usr/libexec/lpr/lpf "$@" | /usr/local/libexec/netprint 192.168.1.105
9100
-----------------------

my /usr/local/libexec/netprint entry:
-----------------------
!/usr/bin/perl -w
#
# netprint - Text filter for printer attached to network
# Installed in /usr/local/libexec/netprint
#

$#ARGV eq 1 || die "Usage: $0 <printer-hostname> <port-number>";

$printer_host = $ARGV[0];
$printer_port = $ARGV[1];
use Socket;

$protocol = getprotobyname('tcp');
$address = inet_aton("192.168.1.105");
$sockaddr = sockaddr_in($printer_port, $address);

socket(PRINTER, PF_INET, SOCK_STREAM, $protocol)
  || die "Can't create TCP/IP stream socket: $!";
connect(PRINTER, $sockaddr) || die "Can't contact $printer_host: $!";

while (<STDIN>) { print PRINTER; } exit 0;
-----------------------

Now my /var/log/lpd-errs is empty and in spool directory I have following
after running command lptest 20 5 | lpr -P HP :

content of /var/spool/hp
total 16
-rw-r--r-- 1 root juris 4 Aug 6 21:55 .seq
-rw-rw---- 1 daemon juris 70 Aug 6 21:55 cfA014laptops
-rw-rw---- 1 root juris 605 Aug 6 21:55 dfA014laptops
-rw-rw-r-- 1 root juris 0 Aug 6 21:55 errs.ukc0YLC
-rw-rw-r-- 1 root juris 5 Aug 6 21:55 lock

My printer is not responding in any way, it keeps on flashing Ready. it is
on the internal network having ip 192.168.1.105

thanks
Juris



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?CAKJAkzvA5+G5mOAZKKQOS6zdq+=A0i-BpbtjJtDwZJipskuz0A>