[sane-devel] Raspbian Jessie - scanbd scripting issue

Wilhelm wilhelm.meier at fh-kl.de
Tue Mar 31 15:29:51 UTC 2015


Am 31.03.2015 um 15:43 schrieb RainerF:
> Wilhelm,
> 
> thank you for taking the time to look into these issues. Following your
> advise I had a look into the source code and tried to understand, what
> happens in case, when e.g. button 3 is pressed and compared the logs
> with the information by pressing e.g. button 4 (log file excerpt - see
> below).
> 
> The last common action for both button events is this logging information:
> 
>    scanbd: button 4 has been pressed.
> 
> respective
> 
>    scanbd: button 3 has been pressed.
> 
> The message has been generated in file scanbuttond_wrapper.c in line 519
> (source version 1.4.2). Next follows this if statement:

Ok, re-looking at these lines I would say its a bug!


As I said before with the scanbuttond-backends there is no change for
the button values from from_value to to_value. Its only pressed/not-pressed.

So please change the bool-expression in this if() to true
and test, please.

> if ((st->opts[si].from_value.num_value == st->opts[si].value.num_value) &&
>       (st->opts[si].to_value.num_value == value)) {
>     slog(SLOG_DEBUG, "value trigger: numerical");
>     st->triggered = true;
>     st->triggered_option = si;
>     // we need to trigger all waiting threads
>     if (pthread_cond_broadcast(&st->cv) < 0) {
>         slog(SLOG_ERROR, "pthread_cond_broadcats: this shouln't happen");
>     }
> }
> 
> Within the if statement the next logging message is generated and a new
> thread, where further action for script execution seems to be taken. The
> logging information is only printed for button 3! Obviously the if
> condition is false for button 4. I will try to debug this (I have no
> experience with debugging multi-threaded code), hoping to get closer to
> the problem, why no script is executed for button 1 and 4 - or do you
> already have an idea, what might be wrong?
> 
> Kind regards,
> Rainer.
> 
> 
>     syslog excerpt
> 
> 
>       button 4 pressed
> 
> scanbd: polling thread for Perfection 1670 cancellation point
> scanbd: polling device Perfection 1670
> scanbd: ################ button 4 pressed ################
> scanbd: option: 1
> scanbd: scanbtnd_button_name (1)
> scanbd: scanbtnd_button_name, backend: Snapscan USB
> scanbd: checking option scan number 1 (0) for device Perfection 1670
> scanbd: option: 3
> scanbd: scanbtnd_button_name (3)
> scanbd: scanbtnd_button_name, backend: Snapscan USB
> scanbd: checking option email number 3 (1) for device Perfection 1670
> scanbd: option: 2
> scanbd: scanbtnd_button_name (2)
> scanbd: scanbtnd_button_name, backend: Snapscan USB
> scanbd: checking option copy number 2 (2) for device Perfection 1670
> scanbd: option: 4
> scanbd: scanbtnd_button_name (4)
> scanbd: scanbtnd_button_name, backend: Snapscan USB
> scanbd: checking option pdf number 4 (3) for device Perfection 1670
> scanbd: button 4 has been pressed.
> scanbd: Iteration on dbus call
> scanbd: polling thread for Perfection 1670 cancellation point
> scanbd: polling device Perfection 1670
> ...
> 
> 
>       button 3 pressed
> 
> scanbd: polling thread for Perfection 1670 cancellation point
> scanbd: polling device Perfection 1670
> scanbd: ################ button 3 pressed ################
> scanbd: option: 1
> scanbd: scanbtnd_button_name (1)
> scanbd: scanbtnd_button_name, backend: Snapscan USB
> scanbd: checking option scan number 1 (0) for device Perfection 1670
> scanbd: option: 3
> scanbd: scanbtnd_button_name (3)
> scanbd: scanbtnd_button_name, backend: Snapscan USB
> scanbd: checking option email number 3 (1) for device Perfection 1670
> scanbd: button 3 has been pressed.
> scanbd: value trigger: numerical
> scanbd: trigger action for device Perfection 1670 with script scan.script
> scanbd: setting env: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
> scanbd: No PWD, setting env: PWD=/home/pi
> scanbd: setting env: USER=root
> scanbd: setting env: HOME=/root
> scanbd: setting env: SCANBD_DEVICE=snapscan:libusb:001:004
> scanbd: setting env: SCANBD_ACTION=email
> scanbd: append string Perfection 1670 to signal scan_begin
> scanbd: now sending signal scan_begin
> scanbd: Iteration on dbus call
> scanbd: append string PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin to signal trigger
> scanbd: append string PWD=/home/pi to signal trigger
> scanbd: append string USER=root to signal trigger
> scanbd: append string HOME=/root to signal trigger
> scanbd: append string SCANBD_DEVICE=snapscan:libusb:001:004 to signal trigger
> scanbd: append string SCANBD_ACTION=email to signal trigger
> scanbd: now sending signal trigger
> scanbd: now flushing the dbus
> scanbd: unref the signal
> scanbd: using relative script path: scan.script, expanded to: /usr/local/etc/scanbd/scan.script
> scanbd: waiting for child: /usr/local/etc/scanbd/scan.script
> scanbd: exec for /usr/local/etc/scanbd/scan.script
> scanbd: Iteration on dbus call
> scanbd: Iteration on dbus call
> scanbd: Iteration on dbus call
> scanbd: Iteration on dbus call
> scanbd: Iteration on dbus call
> scanbd: Iteration on dbus call
> scanbd: Iteration on dbus call
> scanbd: Iteration on dbus call
> scanbd: Iteration on dbus call
> scanbd: Iteration on dbus call
> scanbd: Iteration on dbus call
> scanbd: Iteration on dbus call
> scanbd: Iteration on dbus call
> scanbd: Iteration on dbus call
> scanbd: Iteration on dbus call
> scanbd: child /usr/local/etc/scanbd/scan.script exited with status: 0
> scanbd: Iteration on dbus call
> scanbd: append string Perfection 1670 to signal scan_end
> scanbd: now sending signal scan_end
> scanbd: reopen device Perfection 1670
> scanbd: option: 2
> scanbd: scanbtnd_button_name (2)
> scanbd: scanbtnd_button_name, backend: Snapscan USB
> scanbd: checking option copy number 2 (2) for device Perfection 1670
> scanbd: option: 4
> scanbd: scanbtnd_button_name (4)
> scanbd: scanbtnd_button_name, backend: Snapscan USB
> scanbd: checking option pdf number 4 (3) for device Perfection 1670
> scanbd: polling thread for Perfection 1670 cancellation point
> scanbd: polling device Perfection 1670
> ...
> 
> 
> ------------------------------------------------------------------------
> View this message in context: Re: Raspbian Jessie - scanbd scripting
> issue
> <http://sane.10972.n7.nabble.com/Raspbian-Jessie-scanbd-scripting-issue-tp19611p19620.html>
> Sent from the SANE - Dev mailing list archive
> <http://sane.10972.n7.nabble.com/SANE-Dev-f3.html> at Nabble.com.
> 
> 


-- 
Wilhelm



More information about the sane-devel mailing list