[sane-devel] Scanner Button Daemon [scanbd] 1.3: parse error in config file

Rolf Bensch rolf at bensch-online.de
Sun Jan 20 16:28:20 UTC 2013


Hi Louis,

I'm running the stock 1.3 version.

The config files are the ones which have been installed with 'sudo make
install'.

The config and script files are in /usr/local/etc/scanbd/ and pixma.conf
is in the subfolder scanner.d/.

For testing I'm running this command: '/usr/local/bin/scanbd -df -c
/usr/local/etc/scanbd/scanbd.conf'.

Many thanks for your support,
Rolf



Am 19.01.2013 23:55, schrieb Louis Lagendijk:
> 
> On Sat, 2013-01-19 at 18:54 +0100, Rolf Bensch wrote:
>> Hi Wilhelm,
>>
>> Yesterday I started with scanbd and my CS9000F.
>>
>> I mentioned an error with scanbd.conf:
>>
>> $ /usr/local/bin/scanbd -df -c /usr/local/etc/scanbd/scanbd.conf
>> /usr/local/etc/scanbd/scanbd.conf:197: no such option 'include'
>> /usr/local/bin/scanbd: parse error in config file
>>
>> As a workaround I copied the contents of pixma.conf into scanbd.conf.
>>
>> It could be nice to use the 'include' function. Configuration will be
>> much easier to use prepared conf files. I'll provide my conf and script
>> files to the ml when everything is working.
>>
>> Cheers,
>> Rolf
> 
> hello Rolf
> include works only in between sections. It does work here with the
> default config. Could you please mail me the failing configuration so I
> can have a look at it? As Wilhelm already pointed out, I did most of the
> changes (and bugs :-) ) for the 1.3 release
> 
> Are you running the stock 1.3 version or from subversion?
> Kind regards, Louis 
> 
> 
> 
-------------- next part --------------
/*
 * $Id: scanbd.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)
 *
 *  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.
 */


# global settings
global {
        # turn on debugging
        
        # log to console
        debug   = true 

        # debug logging
        # 1=error, 2=warn, 3=info, 4-7=debug
        debug-level = 7
        
        # 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   = lp

        # the saned executable for manager-mode
        saned   = "/usr/sbin/saned"
        saned_opt  = {} # string-list
        saned_env  = { "SANE_CONFIG_DIR=/usr/local/etc/scanbd" } # 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 = true # 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)
-------------- next part --------------
/*
 * $Id: pixma.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)
 *
 *  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:
	# Document = 1
	# Foto = 2
	# Film = 5
        }
        function target {
                filter = ".*target.*"
                desc   = "Target of the operation"
                env    = "SCANBD_TARGET"
	# Values:
	# To computer (save) = 1
	# To pdf = 2
	# To email = 3
	# to application = 4
        }

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

       # the device description
       desc = "Canon Pixma Scanner"

       # device specific actions (as above)
       # (if this matches a previous defined action, it overrides)
       action scan-color {
              filter = ".*button-1.*"
              desc   = "Button-1"

              # script must be an absolute pathname to the action script without arguments
              script = "example.script"
       }
       action scan-bw {
              filter = ".*button-2.*"
              desc   = "Button-2"

              # script must be an absolute pathname to the action script without arguments
              script = "example.script"
       }

}


More information about the sane-devel mailing list