meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
linux:sane [2019/11/05 18:12] niziaklinux:sane [2024/12/15 19:21] (current) niziak
Line 1: Line 1:
 +====== SANE ======
 +
 +SANE - Scanner Access Now Easy
 +
 +
 +
 ====== Sane frontends in Debian ====== ====== Sane frontends in Debian ======
   * xsane   * xsane
   * xscanimage - simple GUI, scans directly to file, not possible to view scanned image   * 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)   * simple-scan - perfect to fast scanning of books, etc ,very simple GUI (photo/text) to create multi-pages documents (view of live scan)
-  * skanlite+    * [[https://gitlab.gnome.org/GNOME/simple-scan|project page]] 
 +    * [-] brightness/contasrt adjustments doesn't work 
 +  * skanlite - works slowly, performs some USB polling
   * gscan2pdf   * gscan2pdf
 + 
 ====== Sane backend ====== ====== Sane backend ======
  
Line 13: Line 21:
 usermod -aG lp saned usermod -aG lp saned
 </code> </code>
 +
 +Prepare udev rules to give access permission to USB:
 +    * Download and extract udev rules from: [[https://tw.canon/en/support/0100993201/1|ScanGear MP package]]
 +        * rules are inside `CONTENTS.cpio` file
 +        * or here: {{ :linux:80-canon_mfp2.rules.gz |}}
 +    * <code bash>sudo udevadm control --reload-rules</code>
 +    * <code bash>sudo udevadm trigger --action=add --subsystem-match=usb</code>
  
 List scanners: List scanners:
 +
 <code bash> <code bash>
 scanimage -L scanimage -L
Line 21: Line 37:
 ====== Canon Lide 400 ====== ====== Canon Lide 400 ======
  
-Bus 001 Device 003: ID 04a9:1912 Canon, Inc.+<code>Bus 001 Device 003: ID 04a9:1912 Canon, Inc.</code>
  
 ===== proprietary ===== ===== proprietary =====
Line 29: Line 45:
  
 ===== sane ===== ===== sane =====
-From sane list, it should be supproted by ''sane-pixma'' driver: Backend: pixma (0.23.0)+ 
 +From sane list, it should be supported by ''sane-pixma'' driver: Backend: pixma (0.23.0) 
 + 
 +[[http://www.sane-project.org/man/sane-pixma.5.html|sane-pixma.5]] 
 + 
 +Move all .conf files from ''/etc/sane.d'' to speedup autodetection. 
 +<code bash> 
 +mkdir /etc/sane.d/OFF 
 +mv /etc/sane.d/*.conf /etc/sane.d/OFF 
 +</code> 
 + 
 +Create new config: 
 +<file ini /etc/sane.d/canon_lide400.conf> 
 +# Autodetect the Canon CanoScan LiDE 400 
 +usb 0x04a9 0x1912 
 +</file>
  
 ==== Build as DEB ==== ==== Build as DEB ====
 +
 +<code bash>apt-get install build-essential fakeroot devscripts</code>
 +
 +=== 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
 +
 +<code bash>
 +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
 +</code>
 +
 +
 +=== apt source download ===
  
 <code bash> <code bash>
-apt-get install build-essential fakeroot devscripts 
-cd /usr/src 
 apt-get source sane-backends apt-get source sane-backends
-cd sane-backends-1.0.27/+cd sane-backends-1.0.27 
 +</code> 
 + 
 +=== build === 
 + 
 +<code bash>
 apt-get build-dep sane-backends apt-get build-dep sane-backends
 debuild -b -uc -us debuild -b -uc -us
-dpkg -i ../fdupes_1.50-PR2-3_<your arch>.deb+dpkg -i ../sane-backends.deb
 </code> </code>
  
 ==== Build from source ==== ==== Build from source ====
  
-<code> +Remove files installed by distribution: 
-apt-get install libjpeg-dev libpng-dev apt-get install libjpeg-dev libpng-dev+<code bash
 +sudo apt-get purge libsane-extras 
 +</code> 
 +<code bash> 
 +apt-get install libjpeg-dev libpng-dev libpoppler-glib-dev
 git clone https://gitlab.com/sane-project/backends.git git clone https://gitlab.com/sane-project/backends.git
 </code> </code>
Line 57: Line 116:
 Download daily snapshoot from: http://www.sane-project.org/snapshots/ Download daily snapshoot from: http://www.sane-project.org/snapshots/
 <code bash> <code bash>
 +apt-get install libjpeg-dev libpng-dev libpoppler-glib-dev libglib2.0-dev
 ./configure ./configure
 make make
 sudo make install sudo make install
 +sudo ldconfig
 </code> </code>
  
Line 70: Line 131:
  
  
 +===== 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:
 +<code bash>
 +scanimage --custom-gamma=yes --gamma-table `gamma4scanimage 1.0 0 1023 1023 65535`  >image.pnm
 +</code>
 +
 +Options are described here: [[http://www.sane-project.org/man/gamma4scanimage.1.html|gamma4scanimage.1]]
 +
 +To get white paper scans:
 +<code bash>scanimage -p --resolution=150 --custom-gamma=yes --gamma-table `gamma4scanimage 1.0 0 700 1023 65535`  >image.pnm</code>
 +
 +
 +
 +
 +===== Issues =====
 +
 +After restart of computer scanner stops working. 
 +
 +<code bash>
 +$ 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
 +
 +</code>
 +
 +Download latest backend snapshot, compile and reinstall - doesn't help.
 +
 +strace:
 +<code 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
 +</code>
 +
 +**SOLUTION:**
 +<code bash>
 +sudo apt-get remove scanbd
 +</code>
 +
 +===== Others =====
  
 +Epson driver: [[https://support.epson.net/linux/en/imagescanv3.php|Image Scan v3]]