Samsung CLP-315W on NetBSD

Samsung CLP-315W is a low-end color laser printer, featuring USB, Ethernet, and wireless access. It works on NetBSD. The configuration was relatively painless with the standard tools supported by NetBSD. There was no need for something as complex as CUPS.

For initial configuration, I used a NetBSD host and standard dhcpd(8). The printer provides its own HTTP server from which all standard configuration options are available. Also IEEE 802.11 worked with a NetBSD router. But unfortunately, a local host is still required as the printer only speaks a non-standard format language.

The so-called foomatic is a prerequisite. This is available from pkgsrc(7):

# cd /usr/pkgsrc/print/foomatic-filters
# make install package clean

Samsung uses a special QPDL wire protocol, supported by foo2qpdl. For installation, fetch the sources and compile:

$ cd /tmp
$ ftp http://foo2zjs.rkkda.com/foo2zjs.tar.gz
$ tar xvfz foo2zjs.tar.gz
$ cd foo2zjs
$ gmake

If you have problems with the compilation, check the Makefile for odd CFLAGS possibly not yet supported by the NetBSD's cc(1). After having the sources successfully compiled, the required files were organized to /usr/local. From the compiled sources only the following are required:

# mkdir -p /usr/local/bin

# cp foo2qpdl /usr/local/bin
# cp foo2qpdl-wrapper /usr/local/bin

# cp foo2zjs /usr/local/bin
# cp foo2zjs-pstops /usr/local/bin

Note the permissions:

# chown root:wheel /usr/local/bin/foo*
# chmod 0555 /usr/local/bin/foo*

I used the following as the PostScript printer description (PPD) file. In order to avoid wasting the color toner cartridges, two separate files for monochrome and color setup were used:

# mkdir -p /usr/local/share

# cd /tmp/foo2zjs/PPD
# cp Samsung-CLP-310.ppd /usr/local/share/samsung-mono.ppd
# cp Samsung-CLP-310.ppd /usr/local/share/samsung-color.ppd

# chown root:wheel /usr/local/share/*
# chmod 0444 /usr/local/share/samsung*

By default, the used PPD file does not use colors. This was solved by editing the samsung-color.ppd file:

# diff -ur Samsung-CLP-310.ppd /usr/local/share/samsung-color.ppd

--- Samsung-CLP-310.ppd 2011-03-08 09:01:45.000000000 +0200
+++ samsung-color.ppd   2011-03-12 11:02:17.000000000 +0200
@@ -98,7 +98,7 @@
 *OpenUI *ColorMode/Color Mode: PickOne
 *FoomaticRIPOption ColorMode: enum CmdLine A
 *OrderDependency: 120 AnySetup *ColorMode
-*DefaultColorMode: Monochrome
+*DefaultColorMode: Color
 *ColorMode Color/Color: "%% FoomaticRIPOptionSetting: ColorMode=Color"
 *FoomaticRIPOptionSetting ColorMode=Color: "-c "
 *ColorMode Monochrome/Monochrome: "%% FoomaticRIPOptionSetting:
 *ColorMode=Monochrome"

The following network setup was used: one host named print.lan was dedicated to forward the printing requests to the printer or printer.lan. This way all hosts inside the LAN can easily use the printer. Two entries were required for the printcap(5) file:

# Color (default; just 'lpr').
#
lp|rp:\
    :lp=:\
    :rp=lp:\
    :rm=printer.lan:\
    :lf=/var/log/lpd-errs:\
    :sd=/var/spool/output/lpd:\
    :af=/usr/local/share/samsung-color.ppd:\
    :if=/usr/pkg/bin/foomatic-rip:\
    :mx#0:

# Monochrome ('lpr -P lpm').  
#
lpm|rpm:\
    :lp=:\
    :rp=lp:\
    :rm=printer.lan:\
    :lf=/var/log/lpd-errs:\
    :sd=/var/spool/output/lpd:\
    :af=/usr/local/share/samsung-mono.ppd:\ 
    :if=/usr/pkg/bin/foomatic-rip:\
    :mx#0:

Thus, for color and monochrome output, respectively, one needs only:

lpr /etc/passwd
lpr -P lpm /etc/passwd

Remote clients can access the print.lan host by using:

# We have a CNAME record for the printer host inside LAN.
#
lp|rp|remote printer:\
        :lp=:\
        :rp=lp:\
        :rm=print.lan:\
        :sd=/var/spool/output/lpd:\
        :lf=/var/log/lpd-errs:

Finally, enable lpd(8) in rc.conf(5):

lpd=YES
lpd_flags="-r -n 2"

The output quality is relatively good. There are no visible differences compared to the output with Windows and Samsung's own drivers.