Successfully tested on Ubuntu Server 10.04 LTS 64-bit

Few days ago, I described how to build and install scanbd. Now, it needs to be configured to perfectly suit the scanner it’s used with. As you’ll see, you have some very interesting possibilities with a four buttons scanner such as the EPSON Perfection V200 Photo.

First, install xinetd which will allow to use scanbd as a wrapper:

apt-get install xinetd

 
Create a sane-port service configuration file /etc/xinetd.d/sane-port with the following content:

service sane-port
{
socket_type = stream
server = /usr/local/bin/scanbd
server_args = -m -c /usr/local/etc/scanbd/scanbd.conf
protocol = tcp
user = saned
group = saned
wait = no
disable = no
}

 
Stop saned service

service saned stop

 
and disable it as it will now be launched through xinetd/scanbd. Just modify /etc/default/saned as follows:

RUN=no

 
Now, restart xinetd:

service xinetd restart

 
It should return:

 * Stopping internet superserver xinetd                             [ OK ]
 * Starting internet superserver xinetd                             [ OK ]

 
Next, create your own /usr/local/etc/scanbd/scanbd.conf file (keep the original file, just in case…) to describe the available actions (buttons) on your scanner model. The configuration file I created for the EPSON Perfection V200 Photo is available here.
 
Copy the scanbd.debian initialisation script located in scanbd source directory to /etc/init.d/scanbd and install its link using the following command:

update-rc.d scanbd defaults

 
Make sure all the backends except the SANE network backend are commented out in /etc/sane.d/dll.conf:

net

 
Uncomment the following line at the end of /etc/sane.d/net.conf:

localhost

 
Comment out the SANE backend for EPSON scanners in /etc/sane.d/dll.d/iscan:

#epkowa

 
Create a /usr/local/etc/scanbd/dll.conf file including the following line:

epkowa

 
Copy (don’t move!) /etc/sane.d/epkowa.conf to /usr/local/etc/scanbd/epkowa.conf.

Copy /etc/sane.d/saned.conf to /usr/local/etc/scanbd/saned.conf.

Then, verify that you have no access list entry configured in /etc/sane.d/saned.conf and add one in /usr/local/etc/scanbd/saned.conf to restrict access to local subnet hosts only (adapt to your own network configuration):

192.168.253.0/24

 
Now that scanbd is configured for both local and LAN hosts access, let’s continue with the most interesting part of the configuration: The script executed when each button is pressed. You’ll find here the one I use to manage the 4 buttons “Start”, “Copy”, “Email” and “Pdf” available on the EPSON Perfection V200 Photo. Save it as /usr/local/etc/scanbd/actions.sh and make it executable with a chmod 755 command.

In association with my scanner model, this script offers the following functions:
– Single page scan to JPEG
– Instant copy (scan to printer)
– Email creation with JPEG or multi-page PDF attachment
Multi-page PDF creation
All this using only the scanner front buttons!

The buttons usage is explained at the beginning of the script file, along with some variables (such as SCANDIR and PRINTER) you’ll have to modify according to your needs. Also make sure to have imagemagick and mpack packages installed. If not, install them:

apt-get install imagemagick mpack

 
Scanbd setup is complete now but I added a last refinement. Having xinetd always running on the server, just because of the scanner buttons, bothered me (I don’t have any other service depending on xinetd). I updated the existing udev rule (previously added to assign the scanner to the saned group) to automatically start/stop the internet superserver when turning on/off the scanner, respectively. All you have to do is to replace your existing “scanner” udev rule (mine was /etc/udev/rules.d/40-saned.rules) with the following file and disable xinetd, scanbd and saned startup scripts using the following three commands:

update-rc.d xinetd disable
update-rc.d scanbd disable
update-rc.d saned disable

 
If ever you have other services depending on xinetd and only want to stop the scanbd service, take a look at the chkconfig package.

That’s all Folks!

(Thanks for the help, bro. You’re da man!)


For further reading, see scanbd website and Gentoo udev Guide.

Advertisements