EanderAlx.org

Linux, Virtualization and whatever I find interesting ...

User Tools


Site Tools


linux:scanner_lide110

Scansystem with Canon CanoScan LiDE 110

Unfortunately, there are still letters, some of them are useful for the tax return or just useful to have in digital form because of searching is much easier. So I want an system which is always ready to use. I bought a scanner and connected it to my Server. But how to use the buttoms on the scanner? So hear the setup for an Canon CanoScan LiDE 110 scanner. Most configuration work out of the box. Important is don't use scanbuttond, it's no longer really maintained and complicated when you want to use it with scanners that are not supported by default additionally it seems to have some usb issues on Arch Linux because theoretical, it would detect my scanner after patching sources.

Software

The software chosen for this is scanbd which work with sane. scanbd and the included socket will made the scanner accessible and read the buttons pressed. Sane itself is important for its config for all the scanner and for local scanning.

I've made these with:

OS Arch Linux x64
sane Version 1.0.24-2
scanbd Version 1.3-2

Installation

The documentation in the Arch Wiki for this is very good so I will limit myself to the most important.
Install the software form AUR. I used aurget but you also can do it manually or with other tools.

pacman -S sane
aurget -S scanbd

copy the sane configs for using with scanbd

cp /etc/sane.d/* /etc/scanbd/sane.d/

tell the local sane only to use network scanner so it won't block the scanner. We will make the scanner accessible via a socket for the local sane.

/etc/sane.d/dll.conf
net
/etc/sane.d/net.conf
connect_timeout = 3
localhost # scanbm is listening on localhost

configure scanbd's sane part to not use network

/etc/scanbd/sane.d/dll.conf
#net
genesys
#... whatever other scanner backend needed ...

When I installed scanbd inside the default config was a full debuging loglevel enabled. Change this before you start scanbd to save disk space on your system.

/etc/scanbd/scanbd.conf
...
        debug-level = 2
...

Make adjustments to use the “PDF” buttom on the LiDE 110 and insert this after the copy action.

/etc/scanbd/scanbd.conf
        action pdf {
                filter = "^file$"
                numerical-trigger {
                        from-value = 1
                        to-value   = 0
                }
                desc   = "Scan to PDF"
                script = "test.script"
        }

enable and start services and the socket

systemctl enable scanbd.service
systemctl start scanbd.service
systemctl start scanbm.socket

The default test script will only work with logger which is shipped with syslog-ng!

Now you should see an action to buttom pressed in your log.

Action Script

But you need an useful action script to do something when one buttom is pressed.

Here is my:

/etc/scanbd/action.script
#!/bin/bash
 
SCAN_DIR=/data/user/Scanner
DATE_T=`date +%d-%m-%Y_%H%M%S`
SEND_TO=user@example.org
PDF_DIR=$SCAN_DIR/PDF
MAIL_DIR=$SCAN_DIR/Mail
SCAN_IN_DIR=$SCAN_DIR/scan
PRINT_DIR=$SCAN_DIR/printed
TMP_DIR=$SCAN_DIR/tmp
PRINTER_DEF="SamsungML-1660"
 
case $SCANBD_ACTION in
 pdf)
  logger -t "scanbd_action: $0" "$SCANBD_ACTION - scan and convert to pdf"
  scanimage -d $SCANBD_DEVICE --mode Gray --resolution 300 --format=tiff > $TMP_DIR/tempscan_${DATE_T}.tiff
  logger -t "scanbd: $0" "$SCANBD_ACTION - convert tiff to PDF"
	convert -quality 5 -compress jpeg $TMP_DIR/tempscan_${DATE_T}.tiff $PDF_DIR/scan_${DATE_T}.pdf
  rm $TMP_DIR/tempscan_${DATE_T}.tiff
  logger -t "scanbd_action: $0" "$SCANBD_ACTION - finished"
  ;;
 scan)
  logger -t "scanbd_action: $0" "$SCANBD_ACTION - scan as Tiff"
  scanimage -d $SCANBD_DEVICE --resolution 300 --mode Color --format=tiff > $SCAN_IN_DIR/scan_${DATE_T}.tiff
  logger -t "scanbd_action: $0" "$SCANBD_ACTION - finished"
  ;;
 copy)
  logger -t "scanbd_action: $0" "$SCANBD_ACTION - create an copy"
  scanimage -d $SCANBD_DEVICE --resolution 300 --format=tiff --mode=Lineart > $PRINT_DIR/scan_${DATE_T}.tiff
  logger -t "scanbd_action: $0" "$SCANBD_ACTION - print on $PRINTER_DEF"
	lpr -P $PRINTER_DEF $PRINT_DIR/scan_${DATE_T}.tiff
  logger -t "scanbd_action: $0" "$SCANBD_ACTION - finished"
  ;;
email)
  logger -t "scanbd_action: $0" "$SCANBD_ACTION - scan as PDF and send via mail"
  scanimage -d $SCANBD_DEVICE --mode Gray --resolution 300 --format=tiff > $TMP_DIR/tempscan_${DATE_T}.tiff
  logger -t "scanbd_action: $0" "$SCANBD_ACTION - convert tiff to PDF"
  convert -quality 5 -compress jpeg $TMP_DIR/tempscan_${DATE_T}.tiff $MAIL_DIR/scan_${DATE_T}.pdf
  rm $TMP_DIR/tempscan_${DATE_T}.tiff
  logger -t "scanbd_action: $0" "$SCANBD_ACTION - send PDF as mail"
	SIZE=$(ls -lah $MAIL_DIR/scan_${DATE_T}.pdf | awk '{print $5}')
	logger -t "scanbd_action: $0" "Größe $SIZE"
  echo -ne "Document scanned on Canon LiDE 110\n\nFile: scan_${DATE_T}.pdf" | mailx -s "scanned document" -a $MAIL_DIR/scan_${DATE_T}.pdf $SEND_TO
  logger -t "scanbd_action: $0" "$SCANBD_ACTION - finished"
  ;;
*)
  logger -t "scanbd: $0" "unknown Action"
  ;;
esac
 
exit 0

Network Scanner

With sane you can use your scanner via network and XSane or scanimage on an desktop installation.

  1. edit /etc/scanbd/sane.d/saned.conf and allow your ip range, no service restart is needed because saned is loaded when anyone connect to the socket
  2. edit /etc/sane.d/net.conf on your client and set the right server
  3. search for scanners on the client scanimage -L

Comments

Whaow this is VERY interesting! I have the same scanner and I tried to follow your instructions but I got a bit lost… I am on Ubuntu (14.04) so I tried to mix your article with this one: http://virantha.com/2014/03/17/one-touch-scanning-with-fujitsu-scansnap-in-linux/ wich is adapted to another scanner but on Ubuntu.

I understand I have to adapt paths (“/etc/scanbd/” becomes “/usr/local/etc/scanbd/”) and commands (“systemctl start scanbd.service” becomes “service scanbd start” for example) but I still don't see anything in the syslog (with “tail -f /var/log/syslog”) when I press the buttons of the scanner (I am testing with the original “test.script” from scanbd for the moment). Would it be possible for you to adapt your article to an Ubuntu setup?

Thank you very much for any help!

1 |
max
| 23.05.2014 06:09 | reply

@max: the action script does the logging, the ubuntu test script also?

2 |
EanderAlx
| 10.06.2014 10:34 | reply

I recently purchased the Lide 110 and tried to get the scanner buttons working on my ubuntu home server using a tool called scanbuttond. But after a day of trying to compile everything, I figured two things:

  1. The genesys backend that is available from older versions of

scanbuttond works only with lower versions of the Canon Lide series, including Lide 100 and 200.

  2. The USB protocol and handshake have changed in the Lide 110 and Lide

210. So even if you manage to get it all compiled, the old genesys backend no longer works.

So I started to dig into the various information on the internet and have finally figured a way to get this working. I thought it would be useful to share with people who need to get this combination working.

I have detailed the full steps in my own blog:

http://vinayaga-raman.blogspot.in/2014/10/getting-scanbuttond-to-work-with-lide.html

-Vinayaga

3 |
Vinayaga
| 17.10.2014 18:26 | reply
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
linux/scanner_lide110.txt · Last modified: 28.10.2013 17:58 by eanderalx