[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#901695: scanbd: After powercycling a scanner, scanbd tries to open old ID



Package: scanbd
Version: 1.5.1-4
Severity: important

Dear Maintainer,

scanbd is running on a machine connected via USB with a scanner that has an actual power switch. If switched off, the USB device becomes unavailable.

scanbd is not correctly reacting, when the device is switched on while it is already running. Everything is perfect if scanbd is restarted when the 
scanner is switched on.

The logs attached below occur at step 5 in the following context:
1) Scanner is switched on
2) scanbd is started
3) scanning is done
4) scanner is switched off for a while
5) scanner is switche on again

The logs seem to show that scanbd receives an error on trying to open the old scanner ID, i.e. containing the USB path the scanner had in step 2.
This device no longer exists in step 5, so the problem seems to be that scanbd tries to open an outdated device ID.

At the same time, scanimage -L shows a different device ID, so it seems that scanbd fails to correctly operate on an updated device list.

Obviously, I expected that scanbd would open the new device ID and started polling for the button to be pressed.

Regards,
Andreas

-- Relevant excerpt from daemon.log (when switching on the scanner):
Jun 15 19:35:30 athlon1 scanbd[31505]: /usr/sbin/scanbd: new devive
Jun 15 19:35:30 athlon1 scanbd[31505]: /usr/sbin/scanbd: udev device type: usb_device
Jun 15 19:35:30 athlon1 scanbd[31505]: /usr/sbin/scanbd: udev device action: add
Jun 15 19:35:30 athlon1 scanbd[31505]: /usr/sbin/scanbd: dbus_signal_device_added
Jun 15 19:35:30 athlon1 scanbd[31505]: /usr/sbin/scanbd: stop_sane_threads
Jun 15 19:35:30 athlon1 scanbd[31505]: /usr/sbin/scanbd: stopping poll thread for device epkowa:usb:001:021
Jun 15 19:35:30 athlon1 scanbd[31505]: /usr/sbin/scanbd: waiting for poll thread for device epkowa:usb:001:021
Jun 15 19:35:30 athlon1 scanbd[31505]: /usr/sbin/scanbd: closing device epkowa:usb:001:021
Jun 15 19:35:30 athlon1 scanbd[31505]: /usr/sbin/scanbd: Iteration on dbus call
Jun 15 19:35:30 athlon1 scanbd[31505]: /usr/sbin/scanbd: hook_device_insert
Jun 15 19:35:30 athlon1 scanbd[31505]: /usr/sbin/scanbd: hook_device_ex
Jun 15 19:35:30 athlon1 scanbd[31505]: /usr/sbin/scanbd: hook_device_ex: parameter: device_insert_script
Jun 15 19:35:30 athlon1 scanbd[31505]: /usr/sbin/scanbd: hook_device_ex: action: insert
Jun 15 19:35:30 athlon1 scanbd[31505]: /usr/sbin/scanbd: hook_device_ex: device: dbus device
Jun 15 19:35:30 athlon1 scanbd[31505]: /usr/sbin/scanbd: No hook script for inserting device: dbus device
Jun 15 19:35:30 athlon1 scanbd[31505]: /usr/sbin/scanbd: get new devices
Jun 15 19:35:30 athlon1 scanbd[31505]: /usr/sbin/scanbd: Scanning for local-only devices
Jun 15 19:35:30 athlon1 scanbd[31505]: /usr/sbin/scanbd: found device: epkowa:usb:001:021 Epson (unknown model) flatbed scanner
Jun 15 19:35:30 athlon1 scanbd[31505]: /usr/sbin/scanbd: start_sane_threads
Jun 15 19:35:30 athlon1 scanbd[31505]: /usr/sbin/scanbd: Starting poll thread for epkowa:usb:001:021
Jun 15 19:35:30 athlon1 scanbd[31505]: /usr/sbin/scanbd: Thread started for device epkowa:usb:001:021
Jun 15 19:35:30 athlon1 scanbd[31505]: /usr/sbin/scanbd: sane_poll
Jun 15 19:35:30 athlon1 scanbd[31505]: /usr/sbin/scanbd: new devive
Jun 15 19:35:30 athlon1 scanbd[31505]: /usr/sbin/scanbd: Can't open device epkowa:usb:001:021: Invalid argument
Jun 15 19:35:30 athlon1 scanbd[31505]: /usr/sbin/scanbd: udev device type: usb_interface
Jun 15 19:35:30 athlon1 scanbd[31505]: /usr/sbin/scanbd: abandon polling of epkowa:usb:001:021
Jun 15 19:35:30 athlon1 scanbd[31505]: /usr/sbin/scanbd: sane_thread_cleanup_mutex
Jun 15 19:35:30 athlon1 scanbd[31505]: /usr/sbin/scanbd: new devive
Jun 15 19:35:30 athlon1 scanbd[31505]: /usr/sbin/scanbd: udev device type: usb_device
Jun 15 19:35:30 athlon1 scanbd[31505]: /usr/sbin/scanbd: udev device action: bind
Jun 15 19:35:30 athlon1 scanbd[31505]: /usr/sbin/scanbd: new devive
Jun 15 19:35:30 athlon1 scanbd[31505]: /usr/sbin/scanbd: udev device type: usb_interface
Jun 15 19:35:30 athlon1 scanbd[31505]: /usr/sbin/scanbd: new devive
Jun 15 19:35:30 athlon1 scanbd[31505]: /usr/sbin/scanbd: udev device type: usb_interface
Jun 15 19:35:30 athlon1 scanbd[31505]: /usr/sbin/scanbd: Iteration on dbus call
Jun 15 19:35:30 athlon1 scanbd[31505]: /usr/sbin/scanbd: Iteration on dbus call

-- Output of scanimage -L at the same time
device `epkowa:usb:001:027' is a Epson Perfection 1640 flatbed scanner


-- System Information:
Debian Release: buster/sid
APT prefers testing
APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.15.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), LANGUAGE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages scanbd depends on:
ii  libc6                             2.27-3
ii  libconfuse2                       3.2.1+dfsg-4
ii  libdbus-1-3                       1.12.8-2
ii  libsane                           1.0.25-4.1
ii  libudev1                          238-5
ii  lsb-base                          9.20170808
ii  openbsd-inetd [inet-superserver]  0.20160825-3
ii  sane-utils                        1.0.25-4.1
ii  update-inetd                      4.45

scanbd recommends no packages.

scanbd suggests no packages.

-- Configuration Files:
/etc/scanbd/scanbd.conf changed:
/*
* $Id: scanbd.conf 213 2015-10-05 06:52:50Z wimalopaan $
*
*  scanbd - KMUX scanner button daemon
*
*  Copyright (C) 2008 - 2016 Wilhelm Meier (wilhelm.meier@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 {
      # turn on debugging

      # log to console
      debug   = true 
      # debug logging
      # 1=error, 2=warn, 3=info, 4-7=debug
      debug-level = 4

      # drop priviliges to this user
      #=============================
      # Linux (most distributions use the saned user):
      # user    = saned
      # ArchLinux (ArchLinux doesn't have saned user)
      # user    = daemon
      # *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   = scanner
      # the saned executable for manager-mode
      saned   = "/usr/sbin/saned"
      saned_opt  = {} # string-list
		saned_env  = { "SANE_CONFIG_DIR=/etc/sane.d" } # list of environment vars for saned
      # Scriptdir specifies where scanbd 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/scanbd/scripts.
      # scriptdir = /some/path
      # sets scriptdir to the specified absolute path
      # Default scriptdir is <path>/etc/scanbd, this is normally appropriate
		scriptdir = /etc/scanbd/scripts

      # Scripts to execute upon device insertion/removal.
      # It can be necessary to load firmware into the device when it is first
      # inserted. For example, scanbuttond backend does not know how to load 
      # scanner firmware, and it can be rectified by making a custom script.
      # A simple command like "scanimage -L" in an example insert.script 
      # invokes saned and it loads the appropriate firmware if necessary.
      # These scripts receive environmental variables named in the "environment" subsection:
      # SCANBD_DEVICE - device name (fixed string "dbus device" for dbus notification)
      # SCANBD_ACTION - "insert" or "remove", so one script can be used.
      # device_insert_script = "insert.script"
      # device_remove_script =
      # 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 at 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 xxxscan {
              filter = "^xxxscan.*"
              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 xxxpreview {
              filter = "^xxxpreview$"
              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(/etc/scanbd/scanner.d/epson.conf)


-- no debconf information


Reply to: