[sane-devel] [genesys] Canon LiDE 210: How to use scanner buttons

Thorsten Müller thorsten at mueller-kleinheinz.de
Mon Mar 24 09:14:09 UTC 2014


Am Montag, 24. März 2014, 09:17:46 schrieb Dominik Kopp:
> Hi,
> 
> I'm using sane 1.0.24 and have a Canon LiDE 210.
> scanimage -A provides:
> ...
>   Sensors:
>     --scan[=(yes|no)] [no] [hardware]
>         Scan button
>     --file[=(yes|no)] [no] [hardware]
>         File button
>     --email[=(yes|no)] [no] [hardware]
>         Email button
>     --copy[=(yes|no)] [no] [hardware]
>         Copy button
>     --extra[=(yes|no)] [no] [hardware]
>         Extra button
> 
> then I press one one of the scanner buttons and repeat scanimage -A.
> Same result.
> 
> And using the scanner buttons in XSane and/or gscan2pdf have no
> effects. Looking in xsane at  window->show advanced options
> the five sensor flags ar always unmarked.
> 
> What am I doing wrong?
> What I want is to scan multiple pages without touching the mouse or
> keyboard by using one of the five scanner buttons.
> 
> Dominik
> 
> (tested under openSUSE 13.1 and Fedora 20)

You will need somthing like scanbd:
http://sourceforge.net/projects/scanbd/files/

AFAIK this is not included in any distro repositories, so you have to 
build it for yourself.

I wrote a script and modified the configuration of scanbd to use this 
script with my LiDE 210. The files are attached - the genesys.conf goes 
into the scanner.d subdirectory under <PATH>/etc/scanbd. The scanbd.conf 
file replaces the one shipped with the sources. The autopdf script goes 
into the <PATH>/etc/scanbd directory. It makes use of consolekit to get 
the user name who started the scanning process and KDE's kdialog to get 
file names for saving scanned pages and the like. Since you mentioned 
gscan2pdf, you probably use gnome. You could try to modify the script 
into using zenity. The autopdf config file goes into your home dir as 
.autopdf or into /etc/default/ which is the location for default 
settings on debian systems.

HTH
Greetings
Skildron
-------------- next part --------------
A non-text attachment was scrubbed...
Name: autopdf
Type: application/x-shellscript
Size: 8129 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20140324/af4586e7/attachment-0001.bin>
-------------- next part --------------
# scanbd - KMUX scanner button daemon
# main configuration file

# global settings
global {
	# turn on debugging

	# log to console
	debug   = true

	# debug logging
	# 1=error, 2=warn, 3=info, 4-7=debug
	debug-level = 1

	# drop priviliges to this user
	#=============================
	# Linux:
	# user    = saned # root
	# *BSD
	# user    = root
	user    = saned

	# Group to be used
	#=================
	# Linux (most distributions use the lp group to access scanners)
	# group   = lp
	# ArchLinux (ArchLinux uses the scanner group)
	# group = scanner
	#
	# *BSD (no group lp here, use daemon instead)
	# group   = daemon # root
	#
	group   = saned

	# the saned executable for manager-mode
	saned   = "/usr/sbin/saned"
	saned_opt  = {} # string-list
	saned_env  = { "SANE_CONFIG_DIR=/etc/scanbd/sane.d" } # list of environment vars for saned

	# Scriptdir specifies where scanbs normally looks for scripts.
	# The scriptdir option can be defined as:
	#   - a path relative to the configuations (<path>/etc/scanbd) directory
	#   - an abosolute path
	# Examples:
	# scriptdir = scripts
	# sets scriptdir to <path>/etc/scripts.
	# scriptdir = /some/path
	# sets scriptdir to the specified absolute path
	# Default scriptdir is <path>/etc/scanbd, this is normally appropriate
	# scriptdir =

	# scanbuttond_backends_dir sets the path where scanbd looks for the scanbuttond backends
	# It can be defined as relative path, starting from the scanbd config directory or
	# as an absolute path
	# Default is <libdir>/scanbd/scanbutond/backends
	# Example
	# scanbuttond_backends_dir = "/usr/local/lib/scanbd/scanbuttond/backends"

	# poll timeout in [ms]
	# (for polling the devices)
	timeout = 500

	pidfile = "/var/run/scanbd.pid"

	# env-vars for the scripts
	environment {
		# pass the device label as below in this env-var
		device = "SCANBD_DEVICE"
		# pass the action label as below in this env-var
		action = "SCANBD_ACTION"
	}

	# function definitions
	# values of the options are simply passed via env-vars

	function function_knob {
		filter = "^message.*"
		desc   = "The value of the function knob / wheel / selector"
		env    = "SCANBD_FUNCTION"
	}
	function function_mode {
		filter = "^mode.*"
		desc   = "Color mode"
		env    = "SCANBD_FUNCTION_MODE"
	}

	multiple_actions = false # allow multiple actions per option (up to the total amount of options)

	# action definitions
	# if the filter matches and the value changes
	# from from-value to to-value,
	# <script> is executed
	# <script> is the full pathname (do not include any parameters)
	# if parameters are needed, write a script

	# since we can have only a most one action for each option, the action-script
	# can use the function definition (see above) to distinguish different tasks
	# (e.g. use the env-var SCANBD_FUNCTION defined above)

	action scan {
		filter = "^scan.*"
		numerical-trigger {
			from-value = 1
			to-value   = 0
		}
		desc   = "Scan to file"
		# script must be an relative path starting from scriptdir (see above),
		# or an absolute pathname.
		# It must contain the path to the action script without arguments
		# Absolute path example: script = "/some/path/foo.script
		script = "test.script"
	}
	action email {
		filter = "^email$"
		string-trigger {
			from-value  = ""
			to-value    = "^email.*"
		}
		desc   = "Scan to email"
		# script must be an relative path starting from scriptdir (see above),
		# or an absolute pathname.
		# It must contain the path to the action script without arguments
		# Absolute path example: script = "/some/path/foo.script
		script = "test.script"
	}
	action copy {
		filter = "^copy$"
		string-trigger {
			from-value  = ""
			to-value    = "^copy.*"
		}
		desc   = "Copy to printer"
		# script must be an relative path starting from scriptdir (see above),
		# or an absolute pathname.
		# It must contain the path to the action script without arguments
		# Absolute path example: script = "/some/path/foo.script
		script = "test.script"
	}
	action preview {
		filter = "^preview$"
		numerical-trigger {
			from-value = 1
			to-value   = 0
		}
		desc   = "Preview"
		# script must be an relative path starting from scriptdir (see above),
		# or an absolute pathname.
		# It must contain the path to the action script without arguments
		# Absolute path example: script = "/some/path/foo.script
		script = "test.script"
	}
	action globaltest {
		filter = "^message.*"
		desc   = "Test (print all env vars)"
		# script must be an relative path starting from scriptdir (see above),
		# or an absolute pathname.
		# It must contain the path to the action script without arguments
		# Absolute path example: script = "/some/path/foo.script
		script = "test.script"
	}
}

# include
# include another file at this point. This may only occur outside general and devices blocks
# an include statement may be relative (to the direcory where scanbd.conf is located or aboslute
# include("scanner.d/myscanner.conf")
# include("/my/long/path/myscanner.conf")

# devices
# each device can have actions and functions, you can disable not relevant devices
include(scanner.d/avision.conf)
include(scanner.d/fujitsu.conf)
include(scanner.d/hp.conf)
include(scanner.d/pixma.conf)
include(scanner.d/snapscan.conf)
#include(scanner.d/canon.conf)
include(scanner.d/genesys.conf)
-------------- next part --------------
# scanbd configuration file for Canon CanoScan LiDE 210

# Button Name (On front panel)	SCANBD_ACTION_TRIGGER	SCANBD_ACTION
# pdf				file			pdf
# pdf-page			extra			pdfmulti
# scan				scan			scan
# copy				copy			copy
# email				email			email

# device settings
device genesys {
	# the device matching string
	filter = "^genesys.*" # regex

	# the device description
	desc = "CanoScan LiDE 210 Scanner"

	action scan {
		filter = "^scan.*"
		numerical-trigger {
			from-value = 1
			to-value   = 0
		}
		desc   = "Scan to file"
		script = "autopdf"
	}
	action email {
		filter = "^email$"
		numerical-trigger {
			from-value = 1
			to-value   = 0
		}
		desc   = "Scan to email"
		script = "autopdf"
	}
	action copy {
		filter = "^copy$"
		numerical-trigger {
			from-value = 1
			to-value   = 0
		}
		desc   = "Copy to printer"
		script = "autopdf"
	}
	action pdf {
		filter = "^file$"
		numerical-trigger {
			from-value = 1
			to-value   = 0
		}
		desc   = "Scan to single page PDF"
		script = "autopdf"
	}
	action pdfmulti {
		filter = "^extra$"
		numerical-trigger {
			from-value = 1
			to-value   = 0
		}
		desc   = "Scan to multi page PDF"
		script = "autopdf"
	}
}
-------------- next part --------------
# Default settings for /etc/scanbd/autopdf

# Manufacturer / Model of scanner in use
SCANNER="Canon LiDE 210"

### Possible workflow for pdf creation ###
# scan_ps_pdf			fastest
# scan_tiff_pdf			larger than A4
# scan_tiff_ps_pdf		best quality
WORKFLOW="scan_ps_pdf"

#### Default values ###
# Scan quality
# Warning: depth=16 leads to impossible big and slightly distorted
# pdf files with scan_tiff_ps_pdf workflow.
MODE="Color"
DEPTH="8"
RESOLUTION="300"

# ICC profile file for scanner in use
PROFILE="/usr/share/color/icc/cnsr0c.icc"

# Log to syslog? Default is yes
#VERBOSE="no"

# Deactivate autopdf, e.g. for debugging reasons of scanbd?
#RUN_AUTOPDF="no"


More information about the sane-devel mailing list