FreeBSD + CUPS + Epson NX130 (SX130)


Hello there!

I decided to buy a printer. Actually my choice was Epson Stylus S22, but the salesman said all ones had been sold and recommended me just the same model but with scanner (Epson NX130). The model has the same cartridge type and printing head.
So, I bought Epson NX130 and CISS system for it as well. Also I asked to fill CISS with a pigment inks.
As you may know, pigment inks dry faster then dye-based inks and you need print at least every other day in full color.
Let’s start.

What I have:
FreeBSD 9.1-PRERELEASE
Preparation:
You will need to install cups (my choice is to install it from ports)
# cd /usr/ports/print/cups-base && make install clean
Please take a look into config (you will need to make sure that you have unchecked LIBUSB). It’s really important!
After installation you have to make some configuration actions.
First of all you have to find linux driver for your printer.
Fortunately Epson provides at least drivers for new models. Just go to the Epson’s website and select necessary driver (http://download.ebz.epson.net/dsc/search/01/search/)
Next you need to install linux_base (this is necessary to make ppd_filter operational, because it has been written for linux)
# cd /usr/ports/emulators/linux_base-f10/ && make install clean
And now you’re ready to install driver (rpm package) into linux base enviroment

# cd /compat/linux
# rpm2cpio -q < /path/to/epson-inkjet-printer-201101w-1.0.0-1lsb3.2.i486.rpm | cpio -id

Let’s check which libs we need to install into linux enviroment
# ldd /compat/linux/opt/epson-inkjet-printer-201101w/cups/lib/filter/epson_inkjet_printer_filter

You’ll get something like this:

# /compat/linux/opt/epson-inkjet-printer-201101w/cups/lib/filter/epson_inkjet_printer_filter:
        libdl.so.2 => /lib/libdl.so.2 (0x28072000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x28078000)
        libcupsimage.so.2 => /usr/lib/libcupsimage.so.2 (0x28168000)
        libcups.so.2 => /usr/lib/libcups.so.2 (0x28181000)
        libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x281bb000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x281de000)
        libm.so.6 => /lib/libm.so.6 (0x281f8000)
        libc.so.6 => /lib/libc.so.6 (0x28222000)
        /lib/ld-lsb.so.3 (0x2804e000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x2839a000)
        libtiff.so.3 => /usr/lib/libtiff.so.3 (0x283a8000)
        libpng12.so.0 => /usr/lib/libpng12.so.0 (0x28401000)
        libz.so.1 => /lib/libz.so.1 (0x28429000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0x2843d000)
        libgnutls.so.26 => /usr/lib/libgnutls.so.26 (0x28471000)
        libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0x28515000)
        libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x28543000)
        libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x285e2000)
        libcom_err.so.2 => /lib/libcom_err.so.2 (0x28607000)
        libtasn1.so.3 => /usr/lib/libtasn1.so.3 (0x2860b000)
        libgcrypt.so.11 => /lib/libgcrypt.so.11 (0x2861c000)
        libgpg-error.so.0 => /lib/libgpg-error.so.0 (0x28697000)
        libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0x2869b000)
        libkeyutils.so.1 => /lib/libkeyutils.so.1 (0x286a5000)
        libresolv.so.2 => /lib/libresolv.so.2 (0x286a9000)
        libselinux.so.1 => /lib/libselinux.so.1 (0x286c0000)

To check which lib you have to install, please run
# /compat/linux/opt/epson-inkjet-printer-201101w/cups/lib/filter/epson_inkjet_printer_filter
You’ll get an error (missed library or something like this)
Please be patient, next you will need to install missed packages into your linux enviroment.

Go to http://rpm.pbone.net" and find Package that you have to download and install (e.g. libtasn1.so.3)
Please be careful, now you need to download only Packages (not updates!) and only for FC10 (Fedora Core 10).

Try doing that until you run it without library error.

Some preparation configuration:
1. Add in /etc/rc.conf:

devfs_system_ruleset="system"
cupsd_enable="YES"
linux_enable="YES"

2. Create /etc/devfs.rules and put strings:
[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*' mode 0770 group cups
add path 'ugen*' mode 0660 group cups
add path 'da*' mode 0660 group wheel
add path 'cd*' mode 0666 group wheel
add path 'xpt*' mode 0660 group wheel

3. Make sure that you have added root into cups group. Check it in /etc/group
cups:*:193:root
And now, you are ready to configure CUPS.

# cd /usr/local/etc/cups/
# cp cupsd.conf.default cupsd.conf

To make cups accessible not only from localhost, you’ll need to change <Location /> vaule
<Location />
  Order allow,deny
  Allow all
</Location>

Connect your printer, make sure that you have it in

# usbconfig | grep -i epson
ugen4.5: <EPSON Epson Stylus SX130 Series EPSON> at usbus4, cfg=0 md=HOST spd=FULL (12Mbps) pwr=SAVE

Than open browser and go to http://server_ip:631
Add printer (Administration->Add Printer->USB Printer)
When you’re prompted to add ppd file into configuration, just put necessary .ppd file from RPM linux driver.
Take a look into .ppd file, you may have to change *cupsFilter: parameter with correct filter path.
The last step is to name your printer friendly (like epson)

Wait a bit, we are almost finished 🙂

So you are ready ready to configure clients (in my case it was Windows 7)
You need to install driver into system, add printer and chose remote connection (mine was http://server_ip:631/epson)

Yahoo! Try to print test page.

Additions:

As I said above I’ve filled pigment inks in my CISS, if you have pigment inks too, you need to print full color page at least every other day. It is necessary if you don’t want your printing head get dried.

Goodies and automations:
My lazy essence doesn’t want to keep in mind the schedule of printing, so I wrote a cron script that goes to , takes photo-of-the-day and sends it directly to the printer.

PHP Code:

<?php
$pattern = '/(<img src=\")(?P<img>.+)(\"  width=\"990\" height=\"742\")/';
$f=fopen('http://photography.nationalgeographic.com/photography/photo-of-the-day/','r');
#$f=fopen('php://stdin','r');
$data='';
while(!feof($f))
    $data.=fread($f,1);
preg_match($pattern, $data, $matches);
@print ($matches[img]);
fclose($f);
?>

Sheell script:


#!/bin/sh

/usr/local/bin/wget -q `/usr/local/bin/php /usr/home/virtual-hosts/zeon.kiev.ua/www/img_get.php` -O - | /usr/local/bin/lpr -P epson

Install cron rule

# crontab -u zeon -e
22      13      */2     *       *       /home/zeon/bin/print_picture_of_the_day.sh

As result, the cron will run this script every other day at 13:22 (1:22 pm).

4 thoughts on “FreeBSD + CUPS + Epson NX130 (SX130)

  1. What I mean is if I would be able to scan a document from scanner to my computer???

Leave a Reply

Your email address will not be published. Required fields are marked *