[sane-devel] Scanner Button Daemon [scanbd]: conf and script files for Canoscan 9000F

Rolf Bensch rolf at bensch-online.de
Thu Jan 24 20:54:31 UTC 2013


Hi list,

After fixing button support for my CS9000F (already committed to git), I
installed scanbd on my Ubuntu 12.04 system. During some testing I
created a scanbd conf file and two script files, which I want to share
with the ml.

Save 'cs9000f.conf' and 'cs9000f.sh' to
'/usr/local/etc/scanbd/scanner.d/' and scanb to '/usr/local/bin/'. Then
'sudo chmod 755 [path]scanb' and 'sudo chmod 755 [path]cs9000f.sh'. Last
but not least you must append this line to
'/usr/local/etc/scanbd/scanbd.conf': 'include(scanner.d/cs9000f.conf)'.

It is recommended that you setup scanbd before you can use any scanner.
There are several manuals in the internet, e.g.
http://thehomeserverhandbook.com/2012/03/03/scanbd_part1/ or
http://www.mehr4u.de/component/k2/item/99-mit-scanbd-scannertasen-an-einem-canon-mx700-nutzen.html
...

Some background infos:

The CS9000F has 7 push buttons: Auto Scan, PDF Color, PDF Gray, PDF
User, PDF End, Copy and E-Mail.

scanbd is reading all buttons as '--target' [1..7] from sane, button
'PDF End' (target 5) as '--button-2' and all other buttons (targets 1-4
and 6-7) as '--button-1' from sane. You can check the scanner buttons
behaviour with 'scanimage -A'.

'cs9000f.conf' is the configuration file of scanbd and converts sane
targets to scanbd actions.

'cs9000f.sh' is the shell script which is called at every push button.
The button equivalent scanbd actions are: auto-scan, pdf-color,
pdf-gray, pdf-user, pdf-end, copy and email.

Please adapt $SCANDIR and $PRINTER in 'cs9000f.sh' to your system's needs.

'scanb' is a wrapper script for the scanbd daemon, so that scanbd isn't
blocking my scanner. I can use 'xsane' for scanning from a gui with
preview and 'scanbd' for button controlled stupid scanning multiple
pages. 'scanb' can be called with scanimage's scan options which are
passed on the auto-scan action.

Please feel free to send me any feedback.

Cheers,
Rolf

-------------- next part --------------
/*
 * $Id: cs9000f.conf 157 2013-01-06 07:42:46Z wimalopaan $
 *
 *  scanbd - KMUX scanner button daemon
 *
 *  Copyright (C) 2008 - 2013  Wilhelm Meier (wilhelm.meier at fh-kl.de)
 *  Copyright (C) 2013  Rolf Bensch <rolf at bensch hyphen online dot de>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */

device pixma {
        function original {
                filter = ".*original.*"
                desc   = "Type of original"
                env    = "SCANBD_ORIGINAL"
	# Values: none
        }
        function target {
                filter = ".*target.*"
                desc   = "Target of the operation"
                env    = "SCANBD_TARGET"
	# Values (buttons):
	# Auto  Scan = 1
	# PDF Color = 2
	# PDF Gray = 3
	# PDF User = 4
	# PDF End = 5
	# Copy = 6
	# Email = 7
        }

       # the device matching string
       filter = "^pixma.*"

       # the device description
       desc = "Canon Canoscan 9000F Scanner"

       # device specific actions (as above)
       # (if this matches a previous defined action, it overrides)
       action auto-scan {
              filter = ".*target.*"
              numerical-trigger {
                        from-value = 0
                        to-value   = 1
              }
              desc   = "Button Auto Scan"

              # script must be an absolute pathname to the action script without arguments
              script = "/usr/local/etc/scanbd/scanner.d/cs9000f.sh"
       }
       action pdf-color {
              filter = ".*target.*"
              numerical-trigger {
                        from-value = 0
                        to-value   = 2
              }
              desc   = "Button PDF Color"

              # script must be an absolute pathname to the action script without arguments
              script = "/usr/local/etc/scanbd/scanner.d/cs9000f.sh"
       }
       action pdf-gray {
              filter = ".*target.*"
              numerical-trigger {
                        from-value = 0
                        to-value   = 3
              }
              desc   = "Button PDF Gray"

              # script must be an absolute pathname to the action script without arguments
              script = "/usr/local/etc/scanbd/scanner.d/cs9000f.sh"
       }
       action pdf-user {
              filter = ".*target.*"
              numerical-trigger {
                        from-value = 0
                        to-value   = 4
              }
              desc   = "Button PDF User"

              # script must be an absolute pathname to the action script without arguments
              script = "/usr/local/etc/scanbd/scanner.d/cs9000f.sh"
       }
       action pdf-end {
              filter = ".*target.*"
              numerical-trigger {
                        from-value = 0
                        to-value   = 5
              }
              desc   = "Button PDF End"

              # script must be an absolute pathname to the action script without arguments
              script = "/usr/local/etc/scanbd/scanner.d/cs9000f.sh"
       }
       action copy {
              filter = ".*target.*"
              numerical-trigger {
                        from-value = 0
                        to-value   = 6
              }
              desc   = "Button Copy"

              # script must be an absolute pathname to the action script without arguments
              script = "/usr/local/etc/scanbd/scanner.d/cs9000f.sh"
       }
       action email {
              filter = ".*target.*"
              numerical-trigger {
                        from-value = 0
                        to-value   = 7
              }
              desc   = "Button Email"

              # script must be an absolute pathname to the action script without arguments
              script = "/usr/local/etc/scanbd/scanner.d/cs9000f.sh"
       }
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cs9000f.sh
Type: application/x-shellscript
Size: 4364 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20130124/99ffe551/attachment.bin>
-------------- next part --------------
#!/bin/bash

echo -e "\nscanbd - the scan button daemon"
if [ "$#" -ne "0" ] 
then 
  echo -e "         using these parameters for auto scan (scanimage):"
  echo -e "         $*"
  echo $* > /tmp/scanbd_autoscan
else
  [ -e /tmp/scanbd_autoscan ] && rm /tmp/scanbd_autoscan
fi
echo -e "         exit with CTRL - c\n"

/usr/local/sbin/scanbd -f -c /usr/local/etc/scanbd/scanbd.conf


More information about the sane-devel mailing list