SANE

SANE - Scanner Access Now Easy

Sane frontends in Debian

  • xsane
  • xscanimage - simple GUI, scans directly to file, not possible to view scanned image
  • simple-scan - perfect to fast scanning of books, etc ,very simple GUI (photo/text) to create multi-pages documents (view of live scan)
    • [-] brightness/contasrt adjustments doesn't work
  • skanlite - works slowly, performs some USB polling
  • gscan2pdf

Sane backend

apt-get install sane xsane sane-utils
usermod -aG scanner user
usermod -aG lp saned

Prepare udev rules to give access permission to USB:

  • Download and extract udev rules from: ScanGear MP package
  • sudo udevadm control --reload-rules
  • sudo udevadm trigger --action=add --subsystem-match=usb

List scanners:

scanimage -L

Canon Lide 400

Bus 001 Device 003: ID 04a9:1912 Canon, Inc.

proprietary

Download and install Canon's ScanGear debian package. This package provides no compatibility with sane, it provides own tool scangearmp2

sane

From sane list, it should be supproted by sane-pixma driver: Backend: pixma (0.23.0)

sane-pixma.5

Build as DEB

apt-get install build-essential fakeroot devscripts

manual download

Download source package from https://packages.debian.org/unstable/source/sane-backends:

  • sane-backends_1.0.31-4.dsc
  • sane-backends_1.0.31.orig.tar.gz
  • sane-backends_1.0.31-4.debian.tar.xz
dpkg-source -x sane-backends_1.0.31-4.dsc
cd sane-backends-1.0.31
dpkg-checkbuilddeps
sudo mk-build-deps -i
# sudo apt-get install libcurl4-gnutls-dev
dpkg -i ../sane-backends.deb

apt source download

apt-get source sane-backends
cd sane-backends-1.0.27

build

apt-get build-dep sane-backends
debuild -b -uc -us
dpkg -i ../sane-backends.deb

Build from source

Remove files installed by distribution:

sudo apt-get purge libsane-extras
apt-get install libjpeg-dev libpng-dev libpoppler-glib-dev
git clone https://gitlab.com/sane-project/backends.git

read INSTALL.linux how to install

libsane.so: undefined reference to `libusb_set_option' Solution: check for old libusb in /usr/local/lib. Mine was from microchip IDE.

Download daily snapshoot from: http://www.sane-project.org/snapshots/

apt-get install libjpeg-dev libpng-dev libpoppler-glib-dev libglib2.0-dev
./configure
make
sudo make install
sudo ldconfig

Now it works:

$ scanimage -L
device `pixma:04A91912_413B3B' is a CANON CanoScan LiDE 400 multi-function peripheral
device `pixma:04A91912' is a CANON CanoScan LiDE 400 multi-function peripheral

gamma adjust

Scanner backends supports custom gamma table of size 1024 (10bits). Color range is from 0 to 65535. To get raw color scan from scanner:

scanimage --custom-gamma=yes --gamma-table `gamma4scanimage 1.0 0 1023 1023 65535`  >image.pnm

Options are described here: gamma4scanimage.1

To get white paper scans:

scanimage -p --resolution=150 --custom-gamma=yes --gamma-table `gamma4scanimage 1.0 0 700 1023 65535`  >image.pnm

Issues

After restart of computer scanner stops working.

$ scanimage -L
device 'pixma:04A91912' is a CANON CanoScan LiDE 400 multi-function peripheral
 
$ scanimage
Output format is not set, using pnm as a default.
scanimage: open of device pixma:04A91912 failed: Device busy
 
$ SANE_DEBUG_PIXMA=4 scanimage
Output format is not set, using pnm as a default.
[sanei_debug] Setting debug level of pixma to 4.
[pixma] pixma is compiled with pthread support.
[pixma] pixma version 0.24.1
[pixma] pixma_collect_devices() found CanoScan LiDE 400 at libusb:001:004
[pixma] pixma_find_scanners() found 1 devices
[pixma] pixma_collect_devices() found CanoScan LiDE 400 at libusb:001:004
[pixma] pixma_open(): CanoScan LiDE 400
[pixma] pixma_connect() failed EBUSY
[pixma] pixma_open() failed EBUSY
[pixma] pixma_close(): CanoScan LiDE 400
scanimage: open of device pixma:04A91912 failed: Device busy

Download latest backend snapshot, compile and reinstall - doesn't help.

strace:

openat(AT_FDCWD, "/dev/bus/usb/001/007", O_RDWR|O_CLOEXEC) = 9
ioctl(9, USBDEVFS_GET_CAPABILITIES, 0x56212f5f4098) = 0
ioctl(9, USBDEVFS_CLAIMINTERFACE, 0x7ffff58ba40c) = -1 EBUSY (Device or resource busy)
close(9)                                = 0

SOLUTION:

sudo apt-get remove scanbd

Others

Epson driver: Image Scan v3