Raspberry Pi Create a scan station with scanbd (Raspbian) Configure scanbd to poll the local scanner

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

Identify the local scanner

By using lsusb, identify the productId (1909 here) :

pi:# lsusb
pi:# Bus 001 Device 005: ID 04a9:1909 Canon, Inc. CanoScan LiDE 110

With that productId, grep the correct configuration file (it depends of your scanner model, for me it is genesys.conf) :

pi:# grep 1909 /etc/sane.d/*conf
pi:# /etc/sane.d/genesys.conf:usb 0x04a9 0x1909

Copy the file inside your scanbd configuration folder:

cp /etc/sane.d/genesys.conf /usr/local/etc/scanbd/
cp /etc/sane.d/dll.conf /usr/local/etc/scanbd/

Edit /usr/local/etc/scanbd/dll.conf and replace net with the correct scanner backend:

# /etc/sane.d/dll.conf - Configuration file for the SANE dynamic backend loader
#
# Backends can also be enabled by configuration snippets under
# /etc/sane.d/dll.d directory -- packages providing backends should drop
# a config file similar to dll.conf in this directory, named after the package.
#

# The next line enables the network backend; comment it out if you don't need
# to use a remote SANE scanner over the network - see sane-net(5) and saned(8)

genesys

Confirm that the local scanner is found by scanbd

Now we are ready to test :

scanbd -d7 -f

Avoid as much as you can to manipulate the env var SANE_CONFIG_DIR. It can break things, the default value is already configured in /usr/local/etc/scanbd/scanbd.conf and in the init script.

Output should be similar to :

scanbd: foreground
scanbd: reading config file /usr/local/etc/scanbd/scanbd.conf
scanbd: debug on: level: 7
scanbd: dropping privs to uid saned
scanbd: dropping privs to gid scanner
scanbd: group scanner has member: 
scanbd: saned
scanbd: pi
scanbd: drop privileges to gid: 110
scanbd: Running as effective gid 110
scanbd: drop privileges to uid: 110
scanbd: Running as effective uid 110
scanbd: dbus_init
scanbd: dbus match type='signal',interface='org.freedesktop.Hal.Manager'
scanbd: SANE_CONFIG_DIR=/usr/local/etc/scanbd/sane.d
scanbd: sane version 1.0
scanbd: Scanning for local-only devices
scanbd: found device: genesys:libusb:001:005 Canon LiDE 110 flatbed scanner

The most important here isfound device.

What if "found device" doesn't appear ?

You should check again your configuration, especially the identification part of this documentation and clear any eventual SANE_CONFIG_DIR env var wrongly set by typing : unset SANE_CONFIG_DIR


Configure xinetd to make scanbm listening on the network

Create /etc/xinetd.d/sane-port which contains :

service sane-port
{
        port        = 6566
        socket_type = stream
        wait        = no
        user        = saned
        group       = scanner
        server      = /usr/local/sbin/scanbm
        server_args = scanbm -c /usr/local/etc/scanbd/scanbd.conf
        disable     = no
}

/!\ Double-check the path of scanbm with which scanbm

Then, restart xinetd and start scanbd :

service xinetd restart
/etc/init.d/scanbd start

scanimage -L should now display the scanner.

Most issues at this stage concern the permissions. Ensure that scanimage -L works when you are logged as saned by doing sudo -u saned -s.

If not, check USB permissions : ls -al /dev/bus/usb/***



Got any Raspberry Pi Question?