Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Setup HP Laserjet 1120m over network with LPD

123 views
Skip to first unread message

Juris Kaminskis

unread,
Aug 6, 2013, 3:58:08 PM8/6/13
to
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
_______________________________________________
freebsd-...@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questi...@freebsd.org"

Warren Block

unread,
Aug 6, 2013, 4:17:18 PM8/6/13
to
On Tue, 6 Aug 2013, Juris Kaminskis wrote:

> 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.

Are you sure about that model number? I can't find specs for a Laserjet
1120M. There is a Laserjet M1120. It's a Winprinter.

The file entries are confusing and use some non-base programs. You may
be mixing the base system's lpr/lpd with the CUPS versions of the same
names from ports.

For plain lpr/lpd, I have this article:
http://www.wonkity.com/~wblock/docs/html/lpdprinting.html

Juris Kaminskis

unread,
Aug 7, 2013, 12:45:15 AM8/7/13
to
Model number: HP LaserJet M1120n MFP

I try your how-to in few days as it seems I need to redo whole config. I
will post my results, thanks
2013. gada 6. aug. 23:17 "Warren Block" <wbl...@wonkity.com> rakstīja:

> On Tue, 6 Aug 2013, Juris Kaminskis wrote:
>
> 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.
>>
>
> Are you sure about that model number? I can't find specs for a Laserjet
> 1120M. There is a Laserjet M1120. It's a Winprinter.
>
> The file entries are confusing and use some non-base programs. You may be
> mixing the base system's lpr/lpd with the CUPS versions of the same names
> from ports.
>
> For plain lpr/lpd, I have this article:
> http://www.wonkity.com/~**wblock/docs/html/lpdprinting.**html<http://www.wonkity.com/~wblock/docs/html/lpdprinting.html>

Warren Block

unread,
Aug 7, 2013, 12:57:27 AM8/7/13
to
On Wed, 7 Aug 2013, Juris Kaminskis wrote:

> 2013. gada 6. aug. 23:17 "Warren Block" <wbl...@wonkity.com> rakst?ja:
> On Tue, 6 Aug 2013, Juris Kaminskis wrote:
>
> 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.
>
>
> Are you sure about that model number?  I can't find specs for a Laserjet 1120M.  There is a Laserjet M1120.  It's a Winprinter.
>
> The file entries are confusing and use some non-base programs.  You may be mixing the base system's lpr/lpd with the CUPS versions of the same names from ports.
>
> For plain lpr/lpd, I have this article:
> http://www.wonkity.com/~wblock/docs/html/lpdprinting.html

> Model number: HP LaserJet M1120n MFP
>
> I try your how-to in few days as it seems I need to redo whole config. I will post my results, thanks

The Laserjet M1120 is a winprinter, which means it does not understand
plain text or common PDLs like PCL or PostScript. There is
print/foo2zjs in ports, but it's meant to be used with CUPS. I have not
tested it.

Polytropon

unread,
Aug 7, 2013, 1:12:52 AM8/7/13
to
It seems that a HPLIP interface is available for this printer,
so it should probably work with CUPS and _maybe_ with the
normal means of printing (FreeBSD printer spooler plus a
printer filter that turns PS, the _default_ output language
for printing, into the specific non-standard language that
printer wants to be spoken to in).

http://hplipopensource.com/hplip-web/models/laserjet/hp_laserjet_m1120_mfp.html

http://foo2xqx.rkkda.com/

I'm using a similar approach for a terrible Samsung color
laserprinter (foo2qpdl-wrapper in my specific case) which
I could easily integrate with the already mentioned CUPS,
as well as the normal system's printer subsystem.

However, I also have not tested if it works for the M1120,
because I prefer to use printers that work, that's why I
don't own such a thing. :-)


--
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

Al Plant

unread,
Aug 9, 2013, 4:45:57 PM8/9/13
to
Warren Block wrote:
> On Tue, 6 Aug 2013, Juris Kaminskis wrote:
>
>> 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.
>
> Are you sure about that model number? I can't find specs for a Laserjet
> 1120M. There is a Laserjet M1120. It's a Winprinter.
>
> The file entries are confusing and use some non-base programs. You may
> be mixing the base system's lpr/lpd with the CUPS versions of the same
> names from ports.
>
> For plain lpr/lpd, I have this article:
> http://www.wonkity.com/~wblock/docs/html/lpdprinting.html
> _______________________________________________
> freebsd-...@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to
> "freebsd-questi...@freebsd.org"
>
########
Aloha,

I, like Warren , think your entry is too comlpicated and I have a very
old HP 1100 LaserJet that works on lpr using apsfilter from ports.
I have only 5 lines in my printcap file.


~Al Plant - Honolulu, Hawaii - Phone: 808-284-2740
+ http://hawaiidakine.com + http://freebsdinfo.org +
+ http://aloha50.net - Supporting - FreeBSD 7.2 - 8.0 - 9* +
< email: n...@hdk5.net >
"All that's really worth doing is what we do for others."- Lewis Carrol

Volodymyr Kostyrko

unread,
Aug 12, 2013, 9:38:10 AM8/12/13
to
06.08.2013 22:58, Juris Kaminskis wrote:
> 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.

I always use foomatic for such things, it's quite easier to set up. For
example I have:

hplj2420d|lp|HP LaserJet 2420|:\
:af=/usr/local/etc/foomatic/lpd/hplj2420d.ppd:\
:lf=/var/log/lp-errs:\
:ppdfile=/usr/local/etc/foomatic/lpd/hplj2420d.ppd:\
:sd=/var/spool/lpd/hplj2420d:\
:lp=/dev/ulpt0:\
:if=/usr/local/bin/foomatic-rip:\
:sh:\
:mx#0:

I installed those ones:

print/foomatic-db-engine
print/foomatic-db-hpijs

This is local setup, but I think network setup can be done almost the
same way. This printer was initially set up as a network printer but
after Windows 7 emerged there were numerous problems with printing
anything so I grabbed the box and converted it to lpd printer. Now
everything works flawlessly for years.

In your case the key might be using correct filters to feed raw data to
printer. Most winprinters doesn't know what ps is and require user to
provide correct raw data.

--
Sphinx of black quartz, judge my vow.

Juris Kaminskis

unread,
Aug 18, 2013, 2:26:46 PM8/18/13
to
as suggested i tried now foo2xqx filter. My printcap entry:
-----------------------
HP:\
:lp=:\
:sh:\
:mx#0:\
:rm=192.168.1.105:\
:rp=raw:\
:sd=/var/spool/hp:\
:if=/usr/bin/foo2xqx-wrapper:\
:lf=/var/log/lpd-errs:\
-----------------------

Now I get following errors in log file:

-----------------------
Aug 18 21:16:17 laptops lpd[11798]: lpd startup: logging=0
Aug 18 21:16:17 laptops foo2xqx-wrapper: foo2xqx-wrapper -w132 -l66 -i0 -n
root
Aug 18 21:16:18 laptops lpd[11799]: restarting HP
Aug 18 21:16:18 laptops foo2xqx-wrapper: foo2xqx-wrapper -w132 -l66 -i0 -n
root
Aug 18 21:16:19 laptops lpd[11799]: restarting HP
Aug 18 21:16:19 laptops foo2xqx-wrapper: foo2xqx-wrapper -w132 -l66 -i0 -n
root
Aug 18 21:16:19 laptops lpd[11799]: restarting HP
Aug 18 21:16:19 laptops foo2xqx-wrapper: foo2xqx-wrapper -w132 -l66 -i0 -n
root
Aug 18 21:16:19 laptops lpd[11799]: restarting HP
Aug 18 21:16:19 laptops foo2xqx-wrapper: foo2xqx-wrapper -w132 -l66 -i0 -n
root
Aug 18 21:16:19 laptops lpd[11799]: HP: job could not be sent to remote
host (cf
Aug 18 21:16:20 laptops lpd[11799]: mail sent to user root about job
<unknown> o
-----------------------

why foo2xqx-wrapper is forcing restart for the printer?



2013/8/6 Juris Kaminskis <juris.k...@gmail.com>

>
> 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.
>

Chris Hill

unread,
Aug 18, 2013, 3:01:25 PM8/18/13
to
On Sun, 18 Aug 2013, Juris Kaminskis wrote:

> as suggested i tried now foo2xqx filter. My printcap entry:
> -----------------------
> HP:\
> :lp=:\
> :sh:\
> :mx#0:\
> :rm=192.168.1.105:\
> :rp=raw:\
> :sd=/var/spool/hp:\
> :if=/usr/bin/foo2xqx-wrapper:\
> :lf=/var/log/lpd-errs:\
> -----------------------
^
That backslash needs to go, for one thing. The backslash indicates
continuation on the next line, but I don't know what would happen if
there is no next line. In other words, the last line should NOT end with
a backslash.

HTH.

--
Chris Hill ch...@monochrome.org
** [ Busy Expunging </> ]

Juris Kaminskis

unread,
Aug 18, 2013, 3:24:09 PM8/18/13
to
Yes indeed, i corrected, but i have still the problem

Warren Block

unread,
Aug 18, 2013, 3:38:32 PM8/18/13
to
On Sun, 18 Aug 2013, Juris Kaminskis wrote:

> Yes indeed, i corrected, but i have still the problem

Please don't top-post, it makes responding more difficult.

lpd will restart a queue when it gets an error from a filter. Manually
test the filter before trying to use it with lpd.

Juris Kaminskis

unread,
Aug 19, 2013, 9:55:18 AM8/19/13
to
ok I realised the problem was that i sent plain text to filter instead a
postscript.

when I run now:

lpr test.ps

no error messages appear anymore except that in the /var/spool/hp which is
my spooling directory in the status file I have Sending to 192.168.1.105
and printer is silent

Warren Block

unread,
Aug 20, 2013, 9:31:09 AM8/20/13
to
On Mon, 19 Aug 2013, Juris Kaminskis wrote:

> ok I realised the problem was that i sent plain text to filter instead a
> postscript.
>
> when I run now:
>
> lpr test.ps
>
> no error messages appear anymore except that in the /var/spool/hp which is
> my spooling directory in the status file I have Sending to 192.168.1.105
> and printer is silent

I would get the filter working alone before involving the extra
complication of lpd. The documentation at the foo2xqx home page may
help: http://foo2xqx.rkkda.com/

Polytropon

unread,
Aug 20, 2013, 9:33:21 AM8/20/13
to
On Tue, 20 Aug 2013 07:31:09 -0600 (MDT), Warren Block wrote:
> I would get the filter working alone before involving the extra
> complication of lpd. The documentation at the foo2xqx home page may
> help: http://foo2xqx.rkkda.com/

That is a good advice. I'd suggest to use a PS test page as
input, let it run through the filter, and send its output
directly to the printer (with netcat if networked, with >
to /dev/lpt or /dev/ulpt if local). If _that_ part is
working, integrate it with the LPD subsystem or CUPS.


--
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

Juris Kaminskis

unread,
Aug 22, 2013, 8:43:46 AM8/22/13
to
finally my printer responds with this command:

nc 192.168.1.105 9100 < output.xqx

but I have no idea how to get it running through the normal LPD spooling
system. output.xqx file I generate first with the foo2xqx-wrapper filter
and it accepts only postscript

i tried this printcap entry:

HP|lp|Printer:\
:lp=91...@192.168.1.105:\
:sh:\
:mx#0:\
:sd=/var/spool/hp:\
:if=/usr/bin/foo2xqx-wrapper:\
:lf=/var/log/lpd-errs:

but in the Status file i have: waiting for 91...@192.168.1.105 to come up

btw: gsed package was not mentioned as dependency for foo2xqx-wrapper in
the Installation Notes

Matthias Apitz

unread,
Aug 22, 2013, 8:53:16 AM8/22/13
to
El día Thursday, August 22, 2013 a las 03:43:46PM +0300, Juris Kaminskis escribió:

> finally my printer responds with this command:
>
> nc 192.168.1.105 9100 < output.xqx

I can't imagine that LPD port 515 is not supported by the printer; what

telnet 192.168.1.105 515

gives? If this is timing out, I would rather think in firewall issue;

if you really need to print raw to port 9100, with CUPS you would
just configure it through CUPS' web inteface as

socket://192.168.1.105:9100/?waiteof=false

or on command line with

# lpadmin -U root -p myprinter -D '' -L '' -E -v \
'socket://192.168.1.105:9100/?waiteof=false' -P file.ppd

HIH

matthias
--
Sent from my FreeBSD netbook

Matthias Apitz, <gu...@unixarea.de>, http://www.unixarea.de/ f: +49-170-4527211
UNIX since V7 on PDP-11, UNIX on mainframe since ESER 1055 (IBM /370)
UNIX on x86 since SVR4.2 UnixWare 2.1.2, FreeBSD since 2.2.5

Juris Kaminskis

unread,
Aug 22, 2013, 9:19:35 AM8/22/13
to
> I can't imagine that LPD port 515 is not supported by the printer; what
>
> telnet 192.168.1.105 515
>
> gives?


telnet 192.168.1.105 515
Trying 192.168.1.105...
Connected to NPI2B483C.
Escape character is '^]'.

port 515 is not accepting file directly, when I tried the output.xqx to
this port nothing happened, only 9100 accepts


> If this is timing out, I would rather think in firewall issue;
>
> if you really need to print raw to port 9100, with CUPS you would
> just configure it through CUPS' web inteface as
>
>
How in CUPS i will be able to use foo2xqx-wrapper, plus I am planning to
add smart apsfilter from ports on top . I would like that all print jobs
are converted first by apsfilter into postscript, then foo2xqx-wrapper
makes them compatible for HP and finally I ship this data over network to
my printer

generally i would prefer to stick with the native freebsd printing system
which is LPD

Mark Felder

unread,
Aug 22, 2013, 10:55:53 AM8/22/13
to


On Thu, Aug 22, 2013, at 8:19, Juris Kaminskis wrote:
>
> generally i would prefer to stick with the native freebsd printing system
> which is LPD
>

As you should! CUPS is horrible... I also use apsfilter. I can print
almost any file I want just by doing lpr filename

apsfilter's generated config required some hand tweaking by me, but
here's an example I'll drop for you:

/etc/printcap:

netlaser|netlaser;r=600x600;q=medium;c=gray;p=letter;m=auto:\
:lp=9100@netlaser:\
:if=/usr/local/etc/apsfilter/basedir/bin/apsfilter:\
:sd=/var/spool/lpd/netlaser:\
:lf=/var/spool/lpd/netlaser/log:\
:af=/var/spool/lpd/netlaser/acct:\
:mx#0:\
:sh:

/etc/hosts:

192.168.94.5 netlaser

/usr/local/etc/apsfilter/netlaser/apsfilterrc:

#
# don't delete these settings
#
PRINTER='PS'
PAPERSIZE='letter'
METHOD='auto'
QUALITY='medium'
COLOR='gray'
RESOLUTION='600x600'
# apsfilter as jukebox
# important if audio playback device is a network print queue
# INTERFACE='network'
INTERFACE='network'


And then I think I just had to create /var/spool/lpd/netlaser with
ownership root:daemon and 755


After that I think restarting lpd and it just works?

Juris Kaminskis

unread,
Aug 22, 2013, 12:55:25 PM8/22/13
to
not sure what exactly did the trick either restart of LPD, or removing
Hplip and CUPS packages, but now my printer responds via:

lpr test.ps

Success! Thank you very much to everyone!

Warren Block

unread,
Aug 22, 2013, 4:39:32 PM8/22/13
to
On Thu, 22 Aug 2013, Juris Kaminskis wrote:

> finally my printer responds with this command:
>
> nc 192.168.1.105 9100 < output.xqx

Okay, that's a good start.

> but I have no idea how to get it running through the normal LPD spooling
> system. output.xqx file I generate first with the foo2xqx-wrapper filter
> and it accepts only postscript

That is considered normal for Unix printers. If you want the complexity
of a filter that autodetects input type, save adding that for later.

> i tried this printcap entry:
>
> HP|lp|Printer:\
> :lp=91...@192.168.1.105:\
> :sh:\
> :mx#0:\
> :sd=/var/spool/hp:\
> :if=/usr/bin/foo2xqx-wrapper:\
> :lf=/var/log/lpd-errs:
>
> but in the Status file i have: waiting for 91...@192.168.1.105 to come up

Do not use IP addresses. lpd really, really, *really* wants a
resolvable hostname. Entering it in /etc/hosts is enough, then use that
name above.

> btw: gsed package was not mentioned as dependency for foo2xqx-wrapper in
> the Installation Notes

Depending on where those notes are, that should be mentioned to the
author of the notes or the port maintainer.
0 new messages