How to for installing sane-backends from git for kodak AiO printer / scanners.
==============================================================================
Version 1.3 P.Newall 14 Sep 2013 (network discovery changed to avahi)
This how-to is aimed at ubuntu, but should not be too different for other distros.
I have extensively borrowed material from the following sources:
Ubuntu documentation (https://help.ubuntu.com/community/CompileSaneFromSource)
A How-to written by James (jmlynesjr) (http://sourceforge.net/projects/cupsdriverkodak/forums/forum/2125778/topic/5396909)
The sane backend kodakaio for the kodak AiO printer / scanners is incorporated into the sane-backends package of the sane project. The advantage of this over a separate package aimed only at installing kodakaio is that it should eventually find its way into the main repositories of the distros. So the sane project package is the preferred route for distribution.
Installing from git is useful if you want to keep sane right up to date.
If you want to install the latest version and do not plan to keep updating after that, it might be simpler to use the daily snapshot of sane, since you do not have to install git or learn how to use it.
The daily snapshot is here:
http://www.sane-project.org/snapshots/
Installation of sane-backends
=============================
If you will use the scanner via a network connection, avahi is now used to autodetect the scanner. This used to be done by using cups
Open a Terminal. You need some dependencies, so type:
sudo apt-get install build-essential libsane-dev
For a usb connection get the usb dependencies:
sudo apt-get install libusb-dev
For a network connection get the avahi development dependencies:
sudo apt-get install libavahi-client-dev
sudo apt-get install libavahi-glib-dev
Install git-core
sudo apt-get install git-core
Download the source code
git clone git://git.debian.org/sane/sane-backends.git
cd sane-backends
Now you can choose to install all the backends, or one or more specified backends (just for the scanners that you own). Compiling takes a long time for all backends!
To install all backends
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
To install only kodakaio
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var BACKENDS=kodakaio
Some documentation building process that uses latex does not seem to work (for example in mint)
If you have latex installed and want to be sure it will not cause a problem, add the option --disable-latex
For example
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --disable-latex BACKENDS=kodakaio
Then continue to compile and install
make
sudo make install
Open the file /etc/sane.d/dll.conf and edit if necessary so that it contains uncommented lines for your backends. Sane looks in dll.conf to decide which backends will be activated.
You need to edit as root, for example using the editor gedit:
sudo gedit /etc/sane.d/dll.conf
If you will use a usb connection, test the connection by plugging in your scanner and typing
sane-find-scanner
and your scanner should be listed.
Now for usb or network connection
sudo scanimage -L
scanimage -L
If your scanner is detected with both of these commands, you have a successful install. If it is detected with sudo but not as user, then you have a permissions problem. If it is not detected with either, see Troubleshooting below
Setting permissions for a usb connection
========================================
If you can scan as root, but not as user, you have a permissions issue. Current Ubuntu releases use udev to set permisions. Some previous releases used HAL. To set permissions for udev:
sudo cp tools/udev/libsane.rules /etc/udev/rules.d/90-libsane.rules
or edit /etc/udev/rules.d/nn-libsane.rules as root and add the following two lines(change the # scanner name and usb product id and vendor id to match your scanner. Usb product id and vendor id are reported by sane-find-scanner):
# Kodak 5250
ATTRS{idVendor}=="040a", ATTRS{idProduct}=="4041", ENV{libsane_matched}="yes"
Save the file, exit gedit and Scan Away.
Troubleshooting
===============
If you follow the above instructions and cannot scan, there are several useful things you try.
First, check the file /etc/sane.d/<backend.conf>, where backend is the name of the backend that your scanner uses (kodakaio.conf in our case). The default kodakaio.conf has settings that autodetect usb or network scanners. If autodetection does not work, it is possible to list scanners with their usb id or IP address. See comments if the file for instructions.
Some additional commands that can be helpful are:
lsusb
Returns all usb devices
sane-find-scanner
Returns all attached scanners, supported or not
scanimage -L
Returns attached supported scanners
sudo scanimage -L
same as above, with root privileges.
scanimage -T
Runs a test of the scanner
scanimage -V
returns version of sane-backends
Updating sane-backends After Initial "git clone"
================================================
If you have previously cloned the source code and want to download the latest code, use the following:
cd ~/sane-backends
git pull
Then proceed with compiling sane as described above.
Compiled Sane without Configure Flags
Another problem that occasionally comes up is that someone tries to build the latest version of sane as described above, but they forget to add the recommended flags after the ./configure command.
--prefix=/usr --sysconfdir=/etc --localstatedir=/var
What happens is that Ubuntu ships with the sane libraries in /usr/lib/sane.
If you build sane from source with
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
the new sane libraries will be installed over the previous ones in /usr/lib/sane.
But if you build sane with just
./configure
the new sane libraries will be installed in /usr/local/lib/sane.
To make sure that the newest version of sane (in /usr/local/lib/sane) is used
gksu gedit /etc/ld.so.conf
To use the old version it should read
include /etc/ld.so.conf.d/*.conf
include /usr/lib
To use the new version, change it to
include /etc/ld.so.conf.d/*.conf
include /usr/local/lib
Then run
sudo ldconfig
and you should be running the latest sane.