HP 1018 / foo2zjs

Having given up on a solution to installing a Samsung 1660 printer with foo2zjs on FreeBSD 10.3, I moved to an HP 1018 type printer:

When I try to build foo2zjsfor this printer, using gmake, the script stops with an error: gs not found.

Is anyone able to tell me how to point the installer at the location of gs on FreeBSD, or otherwise report on successful installation of this printer on FreeBSD with CUPS?

(I tried posting in foo2zjs forums, but did not receive a response.)
 
gs is for ghostscript, and is installed from package ghostscript9-agpl-base-9.16_5

foo2zjs is available in FreeBSD repository ... no need to build it yourself.
 
gs (yes, ghostscript) is installed. I think I must have gone to build as I couldn't get hp printer to function correctly using pkg from FreeBSD repository: when I set up printer with cups and then go to cups admin interface, select print test page, I get the error: Unsupported format "text/plain". What am I missing here?

CUPS error log:

Code:
E [13/Feb/2017:20:24:41 +0000] [Client 119] Returning IPP client-error-document-format-not-supported for Print-Job (ipp://localhost:631/printers/HP_LaserJet_1018) from localhost
 
Two factors with foo2zjs printers is that a firmware file has to be downloaded and loaded into the printer. I do not see the 1018 firmware listed in the pkg-plist for foo2zjs and it may have a "non-free"distribution status that requires you to directly download the firmware.

Linux uses a udev rule to correctly load the firmware - not sure how to load the firmware in FreeBSD but I'll web search after I post this.

I (shep) put some links into this recent debian forums post regarding the same printer. Another option, which is more bloated, is to use print/hplip.

Edit: here is an older FreeBSD search hit for a similiar printer and an circa 9.1 forum Thread 38048
 
Bias alert: I try to avoid bloated software, which may have unmet dependencies, in order to simply print.

With that said, I would start from scratch by removing hplip cups and foo2zjf and deleting any cups configuration files. Then install cups and foo2zjs and follow the instructions in the link I provided for downloading and installing the printer firmware, enabling ulpt, setting user permissions for ulpt and the devfs rule to install the firmware via ulpt. I would search the forums for devfs rules as there is an indication that the rule syntax has changed.
 
Despite the explanations, I am still stumped. I think I've done as you suggest. As far as I know permissions are set correctly (and ultp is enabled by default).

dmesg

Code:
ugen6.2: <Hewlett-Packard> at usbus6
ulpt0: <Hewlett-Packard HP LaserJet 1018, class 0/0, rev 2.00/1.00, addr 2> on usbus6
ulpt0: using bi-directional mode

Code:
ls -l /dev/ugen6.2
lrwxr-xr-x  1 root  wheel  9  3 Mar 17:52 /dev/ugen6.2 -> usb/6.2.0

CUPS error log shows:

Code:
W [03/Mar/2017:18:22:29 +0000] [Job 4] The printer is in use.
W [03/Mar/2017:18:22:33 +0000] [CGI] Missing NickName and ModelName in /usr/local/share/cups/model/foomatic-db-ppds/BrotherE [03/Mar/2017:18:22:33 +0000] [cups-driverd] Bad driver information file \"/usr/local/share/cups/model/foomatic-db-ppds/Kyocera/ReadMe.htm\"!
...(and some more like that)...
W [03/Mar/2017:18:22:39 +0000] [Job 4] The printer is in use.
W [03/Mar/2017:18:23:11 +0000] [Job 5] The printer is in use.
W [03/Mar/2017:18:23:16 +0000] [Job 5] The printer is in use.
E [03/Mar/2017:18:23:26 +0000] [Job 5] The printer is not responding.

hmm...Maybe time to abandon the effort and find another printer.
 
There is a FreeBSD port for foo2zjs and the changelog shows it was updated about 7 weeks ago. One point of confusion is suggested by your use of "gmake" in the 1st post and building foo2zjs from a "tarball". I would stick to foo2zjs that is provided by FreeBSD packages or ports.

If you compiled it yourself using the upstream source code it is likely that the ppds were installed in the wrong directory. If possible, I would try to uninstall the source build. Then build print/foo2zjs or install the package. Download and install the firmware and double check /etc/devd.conf. Reboot and check to see that the firmware gets loaded (should be in the dmesg). Then use the cups web interface "http://localhost:631". The web interface should allow you to select /dev/ulpt and the hp1018.ppd.
 
I made a clean package install of foo2zjs
Instead of issuing ./getweb 1018
I downloaded the firmware:
http://prdownloads.sourceforge.net/hplip/hplip-3.16.11.tar.gz
I found my way to the following install instructions:
http://hplipopensource.com/hplip-web/install/manual/distros/freebsd.html
Step 4 ./configure results in:
Code:
checking for dlopen in -ldl... no
configure: error: "cannot find libdl support"
Apparently this is about dynamic linked libraries and libc ...
https://forums.freebsd.org/threads/5799/
I have Makefile.in and Makefile.am but am not sure what/whether to edit
 
You did not download just the firmware, but the entire hplip source code. This encompasses many of HP printer/scanner models and includes python based configuration gui's. The firmware is buried in the print/hplip-plugin seen here.

Myself and @ASX have both advised you to use the FreeBSD package and yet you continue to try and build outside of the FreeBSD ports system. You are making this incredibly hard on yourself.
 
Ok. So I haven't understood.

Where you say, "follow the instructions in the link I provided for downloading and installing the printer firmware" I now understand the link you are referring to is http://www.freshports.org/print/hplip

When you say, "Another option, which is more bloated, is to use print/hplip." I now understand you were saying, either use foo2zjs with the firmware, or use foo2zjs with the full print/hplip package (which contains the firmware)?

What I didn't make clear in my OP is that I started out with foo2zjs and hplip installed from packages and the printer apparently not responding. Now, with both installed from packages:

dmesg on reboot (firmware loaded?):

Code:
ulpt0: <Hewlett-Packard HP LaserJet 1018, class 0/0, rev 2.00/1.00, addr 2> on usbus2
When I go to the CUPS interface, I am offered only usb option.

I install the available printer with .ppd:

/usr/local/etc/cups/ppd/HP_LaserJet_1018_USB_KP1DMLC_HPLIP.ppd

The printer in CUPs appears as:

Code:
HP LaserJet 1018 Foomatic/foo2zjs-z1 (recommended) (grayscale)
Connection: hp:/usb/HP_LaserJet_1018?serial=KP1DMLC
..and the printer apparently is not responding

FWIW:
Code:
less /etc/devfs.rules
[system=10]
add path 'unlpt*' mode 0660 group cups
add path 'ulpt*' mode 0660 group cups
add path 'lpt*' mode 0660 group cups
add path 'usb/2.2.0' mode 0660 group cups
 
There are 2 usb options as described in section 9.2 in the handbook. Were both options presented in the cups web interface? There is a freebsd CUPS GUIDE that also mentions that your user needs to be a member of the cups group. There is also a pkg-message.in with instructions for print/foo2zjs. It indicates that /usr/local/l/etc/devd/foo2zjs.conf needs to be looked at to ensure firmware loading. I would also look at the /var/log/cups/error_log. Finally, the freebsd cups guide also has a troubleshooting section.
 
In cups admin GUI "List available printers" shows printer HP_LaserJet_1018_USB_KP1DMLC_HPLIP
Via "Add printers" the one connection offered is hp:/usb/HP_LaserJet_1018?serial=KP1DMLC
I've run through those resources again, checked that the firmware is loading, and the permissions are correct (adding also user to group cups)
GUI shows "Driver:HP LaserJet 1018 Foomatic/foo2zjs-z1 (recommended) (grayscale)"
For the installed printer, error_log for browser GUI selection "print test page":
Code:
D [12/Mar/2017:20:38:52 +0000] cupsdSetBusyState: newbusy="Dirty files", busy="Active clients and dirty files"
D [12/Mar/2017:20:39:02 +0000] [Client 52] HTTP_STATE_WAITING Closing for error 32 (Broken pipe)
D [12/Mar/2017:20:39:02 +0000] [Client 52] Closing connection.
for "print self test page":
Code:
 [Job 46] PID 3880 (/usr/local/libexec/cups/filter/commandtops) exited with no errors.
D [12/Mar/2017:21:03:06 +0000] [Job 46] STATE: +connecting-to-device
D [12/Mar/2017:21:03:06 +0000] cupsdMarkDirty(---J-)
D [12/Mar/2017:21:03:06 +0000] cupsdSetBusyState: newbusy="Dirty files", busy="Printing jobs and dirty files"
D [12/Mar/2017:21:03:06 +0000] Discarding unused printer-state-changed event...
D [12/Mar/2017:21:03:06 +0000] [Job 46] STATE: -connecting-to-device
D [12/Mar/2017:21:03:06 +0000] cupsdMarkDirty(---J-)
D [12/Mar/2017:21:03:06 +0000] cupsdSetBusyState: newbusy="Printing jobs and dirty files", busy="Dirty files"
D [12/Mar/2017:21:03:06 +0000] Discarding unused printer-state-changed event...
D [12/Mar/2017:21:03:06 +0000] [Job 46] STATE: -media-empty-error,media-jam-error,hplip.plugin-error,cover-open-error,toner-empty-error,other

...

D [12/Mar/2017:20:38:52 +0000] cupsdSetBusyState: newbusy="Dirty files", busy="Active clients and dirty files"
D [12/Mar/2017:20:39:02 +0000] [Client 52] HTTP_STATE_WAITING Closing for error 32 (Broken pipe)
for "clean print heads":
Code:
printer_state_message[0]=\"Invalid printer command \"Clean\".\"
Of possible interest, is that connecting this printer to a linux machine via usb shows similar problems (i.e. printer recognized, instructions apparently sent to but not actioned by the printer). Also, this is an old cartridge (media-empty-error?).
 
I put "cupsdMarkDirty" and HP 1018 into a web search and got a number of hits for linux systems. Many suggested turning the printer off/on while the OS was running would allow them to print a test page.
 
The printer firmware should be reloaded each time the usb recognizes the printer and should show up in your dmesg. I would cycle the printer off/on and check the last entry in dmesg. This would ensure that /usr/local/l/etc/devd/foo2zjs.conf is working correctly. I do not use cups so I have no experience as to the need to specify unlpt vs ulpt - does anyone know if cups does this automatically and correctly?

There are three other options: 1) lpr printing with a foomatic-filter using the hp1018.ppd. This would allow you to specifically choose unlpt vs ulpt. 2) print/hplip + print/hplip-plugin 3) Reach out to the port maintainer.
 
mdl90, for the part of the firmware, ensure you downloaded the image in

/usr/local/share/foo2zjs/firmware/sihp1018.img

When you installed print/foo2zjs, it create the file

/usr/local/etc/devd/foo2zjs.conf

Just uncomment the part the HP LaserJet 1018, so each time you connect the printer, the firmware is downloaded to the printer

I had the HP LaserJet 1018 working with the LDP/LPR spooler

The /etc/printcap is:

Code:
LaserJet1018|lp|HP LaserJet 1018:\
    :banner.disable:tty.device=/dev/ulpt0:\
    :filt.input=/home/martin/if-MAPS:\
    :spool.dir=/var/spool/lpd/LaserJet1018:\
    :spool.log=/var/spool/lpd/LaserJet1018/filter-errors:

Create the spool directory

mkdir -p /var/spool/lpd/LaserJet1018
chmod 770 /var/spool/lpd/LaserJet1018
chown -R daemon:daemon /var/spool/lpd/LaserJet1018

The input filter /home/martin/if-MAPS is in my home directory, and the content is

Code:
#!/bin/sh
GS_DEVICE=pbmraw
GS_FONTPATH=/usr/local/share/ghostscript/fonts:/usr/local/lib/X11/fonts/Type1
GS_LIB=
GS_OPTIONS="-g5100x6600 -r600x600 -q -dBATCH -dSAFER -dNOPAUSE"
export GS_DEVICE GS_FONTPATH GS_LIB GS_OPTIONS
/usr/local/bin/gs -sOutputFile=- | /usr/local/bin/foo2zjs -d1 -g5100x6600 -m1 -p1 -n1 -r600x600 -s -t -T3 -u150x150 -l150x150 -L0 -P -z1

This work for paper size letter and all print job been PostScript
 
I've worked through your instructions, referring to:
https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/printing-lpd.html#printing-lpd-filters

Still there is no printing happening. On CUPS restart, its logfile reports HP1018 profile being successfully loaded for the printer. CUPS log now says:

cupsdSetBusyState: newbusy="Dirty files", busy="Dirty files"
...
Discarding unused server-started event
...
Discarding unused job-progress event...
...
D [09/Apr/2017:17:14:46 +0100] Discarding unused printer-state-changed event...
D [09/Apr/2017:17:14:46 +0100] cupsdMarkDirty(---J-)
D [09/Apr/2017:17:14:46 +0100] cupsdSetBusyState: newbusy="Printing jobs and dirty files", busy="Printing jobs and dirty files"
D [09/Apr/2017:17:14:46 +0100] [Job 91] Removing document files.
D [09/Apr/2017:17:14:46 +0100] cupsdMarkDirty(---J-)
D [09/Apr/2017:17:14:46 +0100] cupsdSetBusyState: newbusy="Dirty files", busy="Printing jobs and dirty files"
D [09/Apr/2017:17:14:47 +0100] [Job 91] Unloading..

I'm not sure where to look next...any ideas?

(( After I set up the printer as LPR via CUPS with
/usr/local/etc/cups/ppd/HP_LaserJet_1018_USB_KP1DMLC_HPLIP.ppd I noticed service dbus was not running, causing CUPS to log avahi-daemon communication error on restart (why's that?) ))
 
http://www.openprinting.org/driver/Postscript
The printer firmware should be reloaded each time the usb recognizes the printer and should show up in your dmesg. I would cycle the printer off/on and check the last entry in dmesg. This would ensure that /usr/local/l/etc/devd/foo2zjs.conf is working correctly. I do not use cups so I have no experience as to the need to specify unlpt vs ulpt - does anyone know if cups does this automatically and correctly?

There seems to be only one option, which is ulpt
There are three other options: 1) lpr printing with a foomatic-filter using the hp1018.ppd. This would allow you to specifically choose unlpt vs ulpt. 2) print/hplip + print/hplip-plugin 3) Reach out to the port maintainer.

Thanks for these suggestions. For information, with the plugin from ports and printer installed with the hp cups driver, printing in CUPS gives 'filter failed'
 
Some new confusion this time between cups and LPR. These are 2 different printing systems and you cannot jump between them. Following Martin Paredes post will result in the simplest, least bloated setup. It does not use cups at all but the LPR system which is included in the base install. The handbook link your provided is for the LPR spooler - NOT cups.

Martin's setup just needs print/foo2zjs added. I am unfamiliar with Matins's printcap syntax but I'm guessing that
Code:
:banner.disable:
does the same thing as
Code:
:sh:
(suppress header). Given the detail he provided one option would be to copy/paste his example.
 
Detailed instructions for using print/foo2zjs, print/cups-filters with the base LPR print spooler were found for the equivalent OpenBSD ports.
In OpenBSD there is also a ulpt firmware port which easily supplies the firmware for the HP 1018.

Instructions for
foo2zjs
and
foomatic-rip with LPR.

These instructions can be implemented on FreeBSD although the /var/spool directories have different names and you need to uncomment the above script for the firmware upload.

In OpenBSD, your printer firmware would install automatically as a ulpt device
If your printer attaches as ulpt(4) device the firmware will be loaded automatically.
.
 
Some new confusion this time between cups and LPR. These are 2 different printing systems and you cannot jump between them. Following Martin Paredes post will result in the simplest, least bloated setup. It does not use cups at all but the LPR system which is included in the base install. The handbook link your provided is for the LPR spooler - NOT cups.

Yes, the handbook link I provided is for the LPR spooler - not cups. CUPS interface offers set up for printer with LPR/LPD. I tried this after failing to print directly with LPR.
 
CUPS interface offers set up for printer with LPR/LPD.

The CUPS interface does not configure FreeBSD's lpr/lpd system. It is confusing. Prior to CUPS being developed, BSD's users would print from the command line with lpr(1). CUPS tried to provide the same command line syntax and unfortunately duplicated the command. In recent FreeBSD versions, when cups is installed, it disables the lpr command in the base install.
 
I ran into the same problem and I have edited /usr/local/etc/devd/foo2zjs.conf so that it looks like:
# HP Laserjet 1018
attach 100 {
match "vendor" "0x03f0";
match "product" "0x4117";
action "arm2hpdl /usr/local/share/foo2zjs/firmware/sihp1018.img > /dev/$device-name";
};

However, I can find no package providing the firmware sihp1018.img and I do not understand where I can download it. I have read through this thread but I cannot find any indication regarding the location of the firmware.
 
Back
Top