Re: [sane-devel] Raspbian Jessie - scanbd scripting issue

2015-04-01 Thread Wilhelm
Am 31.03.2015 um 18:26 schrieb RainerF:
 Wilhelm,
 
 I wasn't sure what you meant with
 
 Wilhelm Meier-2 wrote
 So please change the bool-expression in this if() to true and test,
 please.
 
 So I commented the outer if statement
 
 // 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);
  }
 // }
 
 and recompiled. That's working now for all buttons.

Ok, thanks for testing!
I will make a new release in a few days.

 
 Thanks a lot for your efforts!
 
 Kind regards,
 Rainer
 
 View this message in context: Re: Raspbian Jessie - scanbd scripting
 issue
 http://sane.10972.n7.nabble.com/Raspbian-Jessie-scanbd-scripting-issue-tp19611p19625.html
 Sent from the SANE - Dev mailing list archive
 http://sane.10972.n7.nabble.com/SANE-Dev-f3.html at Nabble.com.
 
 


-- 
Wilhelm

-- 
sane-devel mailing list: sane-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
Unsubscribe: Send mail with subject unsubscribe your_password
 to sane-devel-requ...@lists.alioth.debian.org


Re: [sane-devel] Raspbian Jessie - scanbd scripting issue

2015-03-31 Thread Wilhelm
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

Re: [sane-devel] Raspbian Jessie - scanbd scripting issue

2015-03-31 Thread 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:respectiveThe message has been generated in file
scanbuttond_wrapper.c in line 519 (source version 1.4.2).Next follows this
if statement: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

button 3 pressed




--
View this message in context: 
http://sane.10972.n7.nabble.com/Raspbian-Jessie-scanbd-scripting-issue-tp19611p19620.html
Sent from the SANE - Dev mailing list archive at Nabble.com.-- 
sane-devel mailing list: sane-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
Unsubscribe: Send mail with subject unsubscribe your_password
 to sane-devel-requ...@lists.alioth.debian.org

Re: [sane-devel] Raspbian Jessie - scanbd scripting issue

2015-03-31 Thread RainerF
Wilhelm,

I wasn't sure what you meant with
Wilhelm Meier-2 wrote
 So please change the bool-expression in this if() to trueand test, please.

So I commented the outer if statementand recompiled. That's working now for
all buttons.

Thanks a lot for your efforts!

Kind regards,
Rainer



--
View this message in context: 
http://sane.10972.n7.nabble.com/Raspbian-Jessie-scanbd-scripting-issue-tp19611p19625.html
Sent from the SANE - Dev mailing list archive at Nabble.com.-- 
sane-devel mailing list: sane-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
Unsubscribe: Send mail with subject unsubscribe your_password
 to sane-devel-requ...@lists.alioth.debian.org

Re: [sane-devel] Raspbian Jessie - scanbd scripting issue

2015-03-31 Thread RainerF
this line is printed in the logging data. The backend seems to work properly
as well. Its just a guess: either there is no value change for button 1 and
4 or the values are not numerical. (?)
I assume the hardware is ok as well, because I used the old scanbuttend with
Debian Wheezy so far, and there scripts were executed for all buttons.

Anyway - thank you for your support. I think there will be no other way to
understand what's going on unless I've debugged the application.



--
View this message in context: 
http://sane.10972.n7.nabble.com/Raspbian-Jessie-scanbd-scripting-issue-tp19611p19622.html
Sent from the SANE - Dev mailing list archive at Nabble.com.

-- 
sane-devel mailing list: sane-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
Unsubscribe: Send mail with subject unsubscribe your_password
 to sane-devel-requ...@lists.alioth.debian.org


Re: [sane-devel] Raspbian Jessie - scanbd scripting issue

2015-03-30 Thread Wilhelm
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
 

[sane-devel] Raspbian Jessie - scanbd scripting issue

2015-03-30 Thread 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). I would like to use at least the scan
button (= button 4) as well. Within the syslog I can seethat also for button
1 and button 4 there is a reaction, just no script will be executed. In
scanbd.confI noticed two kind of checks for button pressed event handling,
one, where a string change is evaluated, the other, where an integer value
changes.

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

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.   
2) scanimage reports 'no scan device'
When I executeI always get the information that no scan device was
found. I would have expected something likewhich 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):
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):
syslog (excerpt):




--
View this message in context: 
http://sane.10972.n7.nabble.com/Raspbian-Jessie-scanbd-scripting-issue-tp19611.html
Sent from the SANE - Dev mailing list archive at Nabble.com.-- 
sane-devel mailing list: sane-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
Unsubscribe: Send mail with subject unsubscribe your_password
 to sane-devel-requ...@lists.alioth.debian.org