[sane-devel] Raspbian Jessie - scanbd scripting issue

Wilhelm wilhelm.meier at fh-kl.de
Mon Mar 30 12:38:15 UTC 2015


Am 30.03.2015 um 12:17 schrieb RainerF:
> I tried to configure scanbd for an EPSON Perfection 1670 on a Raspbian
> Jessie system. First I installed scanbd form the Raspbian package
> repository, but this version seems to be compiled for sane backends
> support only, which don't recognise button pressed events on my scanner.
> Then I compiled scanbd from source
> <http://downloads.sourceforge.net/project/scanbd/releases/scanbd-1.4.2.tgz>
> with the old scanbutton backends support. That's working, but there are
> two issues:
> 
> 
>       1) only two buttons invoke script execution
> 
> The scanner has four buttons, but currently scripts are only executed
> for button 2 (copy) and button 3 (email). 

Please try to hold down the button a little bit longer ...

> I would like to use at least
> the scan button (= button 4) as well. Within the syslog I can see that
> also for button 1 and button 4 there is a reaction, just no script will
> be executed. In scanbd.conf I noticed two kind of checks for button
> pressed event handling, one, where a string change is evaluated, the
> other, where an integer value changes.

The scanbuttond backend can only check for presses, not for specific
values. So, you shouldn't have to define a trigger-value-change.



> 
> Might this be misconfigured?
> How can I check, which string has been send from the scanbuttond backend?

It must be in the logs (like the other button presses you receive ...).

> Remark: the button numbering seems to be in reverse order, for button 3
> is labeled with a printer icon, button 2 with a letter icon.

The backend places names on the button mumers: you can change it if you
want to since you are compiling from source:

const char* scanbtnd_button_name(const backend_t* backend, unsigned int
button) {
    slog(SLOG_INFO, "scanbtnd_button_name (%d)", button);
    assert(backend);
    const char* backend_name = backend->scanbtnd_get_backend_name();
    assert(backend_name);
    slog(SLOG_INFO, "scanbtnd_button_name, backend: %s", backend_name);

    if (strcmp("snapscan", backend_name)) {
        assert(button <= 5);
        switch(button) {
        case 0:
            return NULL;
            break;
        case 1:
            return "scan"; // "web";
            break;
        case 2:
            return "copy"; // "email";
            break;
        case 3:
            return "email"; // "copy";
            break;
        case 4:
            return "pdf"; // "send";
            break;
        case 5:
            return "stop";
            break;
        default:
            return NULL;
            break;
        }
    }
    return NULL;
}

But I would suggest to adapt the snapscan.conf.



> 
> 
>       2) scanimage reports 'no scan device'
> 
> When I execute
> 
>     scanimage -L		or
>     sudo scanimage -L	or
>     SANE_CONFIG_DIR=/usr/local/etc/scanbd/sane.d scanimage -L

Please read the ReadMe.txt: for the frontends don't use SANE_CONFIG_DIR,
thats only for saned.

Just use xsane or scanimage as usual, *but* adapt your
/etc/sane.d/dll.conf to include only the net-backend. And that must
point to the machine with scanbd/saned (e.g. localhost).

HTH,
 Wilhelm

> 
> I always get the information that no scan device was found. I would have
> expected something like
> 
>     device `net:localhost:snapscan:libusb:001:004' is a EPSON …
> 
> which was the output, when scanbd was installed from the Raspbian
> package repository. I thought, scanimage would request a scan via sane
> port 6566, observed by scanbm, which would then forward the request to
> the 'real' saned.
> Am I wrong with this assumption?
> 
> I attached my configuration and a part of the syslog file.
> 
> Thanks in advance for any kind of assistance, which might help to solve
> the above mentined issues.
> 
> Cheers, Rainer.
> 
> -------------------------------------------------------
> 
> 
>       configuration files
> 
> 
>       /usr/local/etc/scanbd/scanbd.conf (only changes from default):
> 
> 	saned_env = { ”SANE_CONFIG_DIR=/usr/local/etc/scanbd/sane.d” }
> 	
> 	scriptdir = /usr/local/etc/scanbd
> 	device_insert_script = ”insert.script”
> 	
> 	#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)
> 
> 
>       sudo cp scanbd_dbus.conf /etc/dbus-1/system.d/
> 
> this file is copied "as is" from the integration folder
> 
> 
>       sudo nano /lib/systemd/system/scanbd.service (only changes from
>       default):
> 
> 	[Service]
> 	ExecStart=/usr/local/sbin/scanbd –f –c /usr/local/etc/scanbd/scanbd.conf
> 	Environment=SANE_CONFIG_DIR=/usr/local/etc/scanbd/sane.d
> 
> 
>       syslog (excerpt):
> 
> ...
> Mar 29 16:33:50 PING scanbd: /usr/local/sbin/scanbd: Iteration on dbus call
> Mar 29 16:33:51 PING scanbd: /usr/local/sbin/scanbd: polling thread for Perfection 1670 cancellation point
> Mar 29 16:33:51 PING scanbd: /usr/local/sbin/scanbd: polling device Perfection 1670
> Mar 29 16:33:51 PING scanbd: /usr/local/sbin/scanbd: ################ button 4 pressed ################
> Mar 29 16:33:51 PING scanbd: /usr/local/sbin/scanbd: option: 1
> Mar 29 16:33:51 PING scanbd: /usr/local/sbin/scanbd: scanbtnd_button_name (1)
> Mar 29 16:33:51 PING scanbd: /usr/local/sbin/scanbd: scanbtnd_button_name, backend: Snapscan USB
> Mar 29 16:33:51 PING scanbd: /usr/local/sbin/scanbd: checking option scan number 1 (0) for device Perfection 1670
> Mar 29 16:33:51 PING scanbd: /usr/local/sbin/scanbd: option: 3
> Mar 29 16:33:51 PING scanbd: /usr/local/sbin/scanbd: scanbtnd_button_name (3)
> Mar 29 16:33:51 PING scanbd: /usr/local/sbin/scanbd: scanbtnd_button_name, backend: Snapscan USB
> Mar 29 16:33:51 PING scanbd: /usr/local/sbin/scanbd: checking option email number 3 (1) for device Perfection 1670
> Mar 29 16:33:51 PING scanbd: /usr/local/sbin/scanbd: option: 2
> Mar 29 16:33:51 PING scanbd: /usr/local/sbin/scanbd: scanbtnd_button_name (2)
> Mar 29 16:33:51 PING scanbd: /usr/local/sbin/scanbd: scanbtnd_button_name, backend: Snapscan USB
> Mar 29 16:33:51 PING scanbd: /usr/local/sbin/scanbd: checking option copy number 2 (2) for device Perfection 1670
> Mar 29 16:33:51 PING scanbd: /usr/local/sbin/scanbd: polling thread for Perfection 1670 cancellation point
> Mar 29 16:33:51 PING scanbd: /usr/local/sbin/scanbd: polling device Perfection 1670
> Mar 29 16:33:51 PING scanbd: /usr/local/sbin/scanbd: button 0
> Mar 29 16:33:51 PING scanbd: /usr/local/sbin/scanbd: option: 1
> ...
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: option: 3
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: scanbtnd_button_name (3)
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: scanbtnd_button_name, backend: Snapscan USB
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: checking option email number 3 (1) for device Perfection 1670
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: option: 2
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: scanbtnd_button_name (2)
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: scanbtnd_button_name, backend: Snapscan USB
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: checking option copy number 2 (2) for device Perfection 1670
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: polling thread for Perfection 1670 cancellation point
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: polling device Perfection 1670
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: ################ button 3 pressed ################
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: option: 1
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: scanbtnd_button_name (1)
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: scanbtnd_button_name, backend: Snapscan USB
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: checking option scan number 1 (0) for device Perfection 1670
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: option: 3
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: scanbtnd_button_name (3)
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: scanbtnd_button_name, backend: Snapscan USB
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: checking option email number 3 (1) for device Perfection 1670
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: button 3 has been pressed.
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: value trigger: numerical
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: trigger action for device Perfection 1670 with script test.script
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: setting env: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: No PWD, setting env: PWD=/
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: No USER, setting env: USER=saned
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: No HOME, setting env: HOME=/var/lib/saned
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: setting env: SCANBD_DEVICE=snapscan:libusb:001:004
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: setting env: SCANBD_ACTION=email
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: append string Perfection 1670 to signal scan_begin
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: now sending signal scan_begin
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: Iteration on dbus call
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: append string PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin to signal trigger
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: append string PWD=/ to signal trigger
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: append string USER=saned to signal trigger
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: append string HOME=/var/lib/saned to signal trigger
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: append string SCANBD_DEVICE=snapscan:libusb:001:004 to signal trigger
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: append string SCANBD_ACTION=email to signal trigger
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: now sending signal trigger
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: now flushing the dbus
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: unref the signal
> Mar 29 16:33:54 PING scanbd: /usr/local/sbin/scanbd: using relative script path: test.script, expanded to: /usr/local/etc/scanbd/test.script
> Mar 29 16:33:54 PING scanbd[354]: /usr/local/sbin/scanbd: scanbtnd_button_name, backend: Snapscan USB
> Mar 29 16:33:54 PING scanbd[354]: /usr/local/sbin/scanbd: checking option scan number 1 (0) for device Perfection 1670
> Mar 29 16:33:54 PING scanbd[354]: /usr/local/sbin/scanbd: button 1 has been pressed.
> Mar 29 16:33:54 PING scanbd[354]: /usr/local/sbin/scanbd: option: 3
> Mar 29 16:33:54 PING scanbd[354]: /usr/local/sbin/scanbd: scanbtnd_button_name (3)
> Mar 29 16:33:54 PING scanbd[354]: /usr/local/sbin/scanbd: scanbtnd_button_name, backend: Snapscan USB
> ...
> 
> 
> ------------------------------------------------------------------------
> View this message in context: Raspbian Jessie - scanbd scripting issue
> <http://sane.10972.n7.nabble.com/Raspbian-Jessie-scanbd-scripting-issue-tp19611.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