[sane-devel] Scanbd and /etc/sane.d

2012-12-05 Thread Louis Lagendijk
hello dear Sane developers
I am in the process of packaging scanbd for Fedora. One thing that
bothers me is the fact that I need to copy all .conf files as
scanbd relies on the user using the net backend, while scanbd acts as a
saned proxy. But scanbd/saned requires a dll.conf that specifies the
used backends while the user dll.conf only uses the net backend. An
right now we can only have different dll.conf's inb different
directories as pointed out by SANE_CONFIG_DIR.

Alternative 1)
==
It would be nice if the calling binary could specify a dll.conf to be
used. The user not specifying anything would get the normal dll.conf,
while a binary like saned or scanbd would see its own dll.conf (e.g.
saned-dll.conf). Would it be acceptable to modify dll.c to set the conf
filename (and not SANE_CONFIG_DIR) to load the required dll.conf? I am
thinking of adding a SANE_DLL_PREFIX environment var that gets prepended
to the dll.conf string  (and dll.aliases) if defined. This way we do
ensure that we do not break compatibility. E.g. if SANE_DLL_PREFIX is
set to saned, we would load saned-dll.conf.

My saned-dll could then specify all backends, while dll.conf would only
have the net backend.

Alternative 2)
== 
As above, but: 
I consider changing / overwriting the default distributions dll.conf
undesirable. We could even prepend a user to dll.conf (user-dlll.conf)
even when no  if the new env. var SANE_DLL_PREFIX is not defined and use
that (if the file exists) but fallback to dll.conf if that does not
exist. 
In this case I could leave the default dll.conf intact, but add a
user-dll.conf that contains only the net backend from the scanbd package
in addition to the sane-dll.conf (or whatever). This avoids having a
file ownership issue with the standard dll.conf.

What do you developers think? Would this be ok? I would like to have
some feedback before I go and change the code in git.

Thanks in advance for your feedback

Louis




[sane-devel] scanbd with a Canon DR-2010C

2012-12-05 Thread Rien Broekstra
Op 12/5/12 11:21 AM, Wilhelm schreef:

>> Once the scanner is recognized by scanbd, do I need to do anything else
>> to make it at least detect button presses? It recognizes scanner options
>> but pressing a button doesnt yield much:
>
> please install an action for a button-option e.g. button-3

Hello Wilhelm,

Great work on scanbd! It was a little difficult to set up, since I was a 
complete sane-noob, but after a few hours my embedded linuxdevice 
executes scripts as a reaction on the scanner buttons, while sane can 
access it through net backend. Neat!

One small suggestion for improvement: The debian start script in 1.2.1 
hardcodes the SANE_CONFIG_DIR environment variable, resulting in scanbd 
not working if executed from the init script if the scanbd configuration 
is installed anywhere else than in the hardcoded location.

I'd suggest reading environment variables from /etc/default/scanbd, and 
(only) setting the default if none is set there.

Thanks for the support!

Cheers,
-- 
Rien Broekstra
Rename-it
T: +31 53 7503014
E: rien at rename-it.nl




[sane-devel] scanbd with a Canon DR-2010C

2012-12-05 Thread Wilhelm
Am 05.12.2012 11:01, schrieb Rien Broekstra:
> On Wed, 5 Dec 2012 10:20:51 +0100, Wilhelm  wrote:
>> Am 05.12.2012 09:37, schrieb Rien Broekstra:
>>> On Wed, 5 Dec 2012 06:31:11 +0100, Wilhelm 
>>> wrote:
 Hello,

 please test scanimage -L as user:group saned:lp, since you configured
 scanbd to drop privileges to these.

>>>
>>> Ah, debian uses scanner group instead of lp. That's all indeed. Thank
>>> you for your fast reply, and sorry for bothering
>>
>> np, you're welcome!
>
> One more thing.
>
> Once the scanner is recognized by scanbd, do I need to do anything else
> to make it at least detect button presses? It recognizes scanner options
> but pressing a button doesnt yield much:

please install an action for a button-option e.g. button-3

>
> ---8<--
> ...
> scanbd: Scanning for local-only devices
> scanbd: found device: canon_dr:libusb:001:004 CANON DR-2010C scanner
> scanbd: start_sane_threads
> scanbd: Starting poll thread for canon_dr:libusb:001:004
> scanbd: Thread started for device canon_dr:libusb:001:004
> scanbd: start dbus thread
> scanbd: udev init
> scanbd: get udev monitor
> scanbd: start udev thread
> scanbd: sane_poll
> scanbd: timeout: 500 ms
> scanbd: Iteration on dbus call
> scanbd: udev thread started
> scanbd: found 39 options for device canon_dr:libusb:001:004
> scanbd: sane_find_matching_options
> scanbd: found 5 actions in section (null)
> scanbd: checking action scan with filter: ^scan.*
> scanbd: found active option[2] source (type: 3) for device
> canon_dr:libusb:001:004
> scanbd: found active option[3] mode (type: 3) for device
> canon_dr:libusb:001:004
> scanbd: found active option[4] resolution (type: 1) for device
> canon_dr:libusb:001:004
> scanbd: found active option[6] tl-x (type: 2) for device
> canon_dr:libusb:001:004
> scanbd: found active option[7] tl-y (type: 2) for device
> canon_dr:libusb:001:004
> scanbd: found active option[8] br-x (type: 2) for device
> canon_dr:libusb:001:004
> scanbd: found active option[9] br-y (type: 2) for device
> canon_dr:libusb:001:004
> scanbd: found active option[10] page-width (type: 2) for device
> canon_dr:libusb:001:004
> scanbd: found active option[11] page-height (type: 2) for device
> canon_dr:libusb:001:004
> scanbd: found active option[13] brightness (type: 1) for device
> canon_dr:libusb:001:004
> scanbd: found active option[14] contrast (type: 1) for device
> canon_dr:libusb:001:004
> scanbd: found active option[20] df-thickness (type: 0) for device
> canon_dr:libusb:001:004
> scanbd: found active option[21] df-length (type: 0) for device
> canon_dr:libusb:001:004
> scanbd: found active option[22] rollerdeskew (type: 0) for device
> canon_dr:libusb:001:004
> scanbd: found active option[23] swdeskew (type: 0) for device
> canon_dr:libusb:001:004
> scanbd: found active option[24] swdespeck (type: 1) for device
> canon_dr:libusb:001:004
> scanbd: found active option[25] swcrop (type: 0) for device
> canon_dr:libusb:001:004
> scanbd: found active option[26] stapledetect (type: 0) for device
> canon_dr:libusb:001:004
> scanbd: found active option[27] dropout-front (type: 3) for device
> canon_dr:libusb:001:004
> scanbd: found active option[28] dropout-back (type: 3) for device
> canon_dr:libusb:001:004
> scanbd: found active option[29] buffermode (type: 0) for device
> canon_dr:libusb:001:004
> scanbd: found active option[30] side (type: 0) for device
> canon_dr:libusb:001:004
> scanbd: found active option[32] start (type: 0) for device
> canon_dr:libusb:001:004
> scanbd: found active option[33] stop (type: 0) for device
> canon_dr:libusb:001:004
> scanbd: found active option[34] button-3 (type: 0) for device
> canon_dr:libusb:001:004
> scanbd: found active option[35] newfile (type: 0) for device
> canon_dr:libusb:001:004
> scanbd: found active option[36] countonly (type: 0) for device
> canon_dr:libusb:001:004
> scanbd: found active option[37] bypassmode (type: 0) for device
> canon_dr:libusb:001:004
> scanbd: found active option[38] counter (type: 1) for device
> canon_dr:libusb:001:004
> scanbd: checking action email with filter: ^email$
> ...
> scanbd: found 4 local device sections
> scanbd: checking device section fujitsu with filter: ^fujitsu.*
> scanbd: checking device section snapscan with filter:
> (.*snapscan.*|.*Perfection.*)
> scanbd: checking device section hp with filter: ^hpaio.*
> scanbd: checking device section avision with filter: ^avision.*
> scanbd: timeout: 500 ms
> scanbd: Start the polling for device canon_dr:libusb:001:004
> scanbd: polling thread for canon_dr:libusb:001:004 cancellation point
> scanbd: polling device canon_dr:libusb:001:004
> scanbd: Iteration on dbus call
> scanbd: polling thread for canon_dr:libusb:001:004 cancellation point
> scanbd: polling device canon_dr:libusb:001:004
> scanbd: polling thread for canon_dr:libusb:001:004 cancellation point
> scanbd: polling device canon_dr:libusb:001:004
> scanbd: Iteration 

[sane-devel] scanbd with a Canon DR-2010C

2012-12-05 Thread Rien Broekstra
 On Wed, 5 Dec 2012 10:20:51 +0100, Wilhelm  
 wrote:
> Am 05.12.2012 09:37, schrieb Rien Broekstra:
>> On Wed, 5 Dec 2012 06:31:11 +0100, Wilhelm  
>> wrote:
>>> Hello,
>>>
>>> please test scanimage -L as user:group saned:lp, since you 
>>> configured
>>> scanbd to drop privileges to these.
>>>
>>
>> Ah, debian uses scanner group instead of lp. That's all indeed. 
>> Thank
>> you for your fast reply, and sorry for bothering
>
> np, you're welcome!

 One more thing.

 Once the scanner is recognized by scanbd, do I need to do anything else 
 to make it at least detect button presses? It recognizes scanner options 
 but pressing a button doesnt yield much:

 ---8<--
 ...
 scanbd: Scanning for local-only devices
 scanbd: found device: canon_dr:libusb:001:004 CANON DR-2010C scanner
 scanbd: start_sane_threads
 scanbd: Starting poll thread for canon_dr:libusb:001:004
 scanbd: Thread started for device canon_dr:libusb:001:004
 scanbd: start dbus thread
 scanbd: udev init
 scanbd: get udev monitor
 scanbd: start udev thread
 scanbd: sane_poll
 scanbd: timeout: 500 ms
 scanbd: Iteration on dbus call
 scanbd: udev thread started
 scanbd: found 39 options for device canon_dr:libusb:001:004
 scanbd: sane_find_matching_options
 scanbd: found 5 actions in section (null)
 scanbd: checking action scan with filter: ^scan.*
 scanbd: found active option[2] source (type: 3) for device 
 canon_dr:libusb:001:004
 scanbd: found active option[3] mode (type: 3) for device 
 canon_dr:libusb:001:004
 scanbd: found active option[4] resolution (type: 1) for device 
 canon_dr:libusb:001:004
 scanbd: found active option[6] tl-x (type: 2) for device 
 canon_dr:libusb:001:004
 scanbd: found active option[7] tl-y (type: 2) for device 
 canon_dr:libusb:001:004
 scanbd: found active option[8] br-x (type: 2) for device 
 canon_dr:libusb:001:004
 scanbd: found active option[9] br-y (type: 2) for device 
 canon_dr:libusb:001:004
 scanbd: found active option[10] page-width (type: 2) for device 
 canon_dr:libusb:001:004
 scanbd: found active option[11] page-height (type: 2) for device 
 canon_dr:libusb:001:004
 scanbd: found active option[13] brightness (type: 1) for device 
 canon_dr:libusb:001:004
 scanbd: found active option[14] contrast (type: 1) for device 
 canon_dr:libusb:001:004
 scanbd: found active option[20] df-thickness (type: 0) for device 
 canon_dr:libusb:001:004
 scanbd: found active option[21] df-length (type: 0) for device 
 canon_dr:libusb:001:004
 scanbd: found active option[22] rollerdeskew (type: 0) for device 
 canon_dr:libusb:001:004
 scanbd: found active option[23] swdeskew (type: 0) for device 
 canon_dr:libusb:001:004
 scanbd: found active option[24] swdespeck (type: 1) for device 
 canon_dr:libusb:001:004
 scanbd: found active option[25] swcrop (type: 0) for device 
 canon_dr:libusb:001:004
 scanbd: found active option[26] stapledetect (type: 0) for device 
 canon_dr:libusb:001:004
 scanbd: found active option[27] dropout-front (type: 3) for device 
 canon_dr:libusb:001:004
 scanbd: found active option[28] dropout-back (type: 3) for device 
 canon_dr:libusb:001:004
 scanbd: found active option[29] buffermode (type: 0) for device 
 canon_dr:libusb:001:004
 scanbd: found active option[30] side (type: 0) for device 
 canon_dr:libusb:001:004
 scanbd: found active option[32] start (type: 0) for device 
 canon_dr:libusb:001:004
 scanbd: found active option[33] stop (type: 0) for device 
 canon_dr:libusb:001:004
 scanbd: found active option[34] button-3 (type: 0) for device 
 canon_dr:libusb:001:004
 scanbd: found active option[35] newfile (type: 0) for device 
 canon_dr:libusb:001:004
 scanbd: found active option[36] countonly (type: 0) for device 
 canon_dr:libusb:001:004
 scanbd: found active option[37] bypassmode (type: 0) for device 
 canon_dr:libusb:001:004
 scanbd: found active option[38] counter (type: 1) for device 
 canon_dr:libusb:001:004
 scanbd: checking action email with filter: ^email$
 ...
 scanbd: found 4 local device sections
 scanbd: checking device section fujitsu with filter: ^fujitsu.*
 scanbd: checking device section snapscan with filter: 
 (.*snapscan.*|.*Perfection.*)
 scanbd: checking device section hp with filter: ^hpaio.*
 scanbd: checking device section avision with filter: ^avision.*
 scanbd: timeout: 500 ms
 scanbd: Start the polling for device canon_dr:libusb:001:004
 scanbd: polling thread for canon_dr:libusb:001:004 cancellation point
 scanbd: polling device canon_dr:libusb:001:004
 scanbd: Iteration on dbus call
 scanbd: polling thread for canon_dr:libusb:001:004 cancellation point
 scanbd: polling device canon_dr:libusb:001:004
 scanbd: polling thread for canon_dr:libusb:001:004 cancellation point
 scanbd: polling device canon_dr:libusb:001:004
 scanbd: Iteration on dbus call
 scanbd: polling thread for canon_dr:libusb:001:004 cancellation point
 scanbd: polling device canon_dr:libusb:001:004
 scanbd: polling thread for canon_dr:libusb:00

[sane-devel] scanbd with a Canon DR-2010C

2012-12-05 Thread Wilhelm
Am 05.12.2012 09:37, schrieb Rien Broekstra:
> On Wed, 5 Dec 2012 06:31:11 +0100, Wilhelm  wrote:
>> Hello,
>>
>> please test scanimage -L as user:group saned:lp, since you configured
>> scanbd to drop privileges to these.
>>
>
> Ah, debian uses scanner group instead of lp. That's all indeed. Thank
> you for your fast reply, and sorry for bothering

np, you're welcome!


-- 
Wilhelm




[sane-devel] scanbd with a Canon DR-2010C

2012-12-05 Thread Rien Broekstra
Hello everyone,

I was directed to this list from the sane irc channel. My apologies if 
this message is off topic:

I'm not getting scanbd 1.2.1 to work with a canon dr-2010c scanner, 
connected to an alix 6f2 board running debian squeeze. Here's what I 
have done so far:

I built scanbd (on a different machine) according to the INSTALL file with
   $ USE_SANE=yes make -e clean all

I copied the resulting binary to the target system in /usr/sbin and the 
configuration file to /etc/scanbd;

...copied scanbd_dbus.conf to /etc/dbus-1/system.d/ and restarted dbus

...installed the libconfuse0, libusb-0.1-4, libusb-1.0-0, libsane and 
libudev0 packages (not the -dev packages, since there is no space on the 
target system for the compiler that is installed as a dependency);

...copied canon_dr.conf, saned.conf and dll.conf from the sane 
configuration directory to /etc/scanbd. Added a netmask to 
/etc/scanbd/saned.conf and commented out the net backend in 
/etc/scanbd/dll.conf, and checked that the canon_dr backend was not 
commented out.

Modified scanbd.conf to set SANE_CONFIG_DIR to /etc/scanbd (instead of 
/usr/local/etc/scanbd)

The scanner is recognized by the kernel and by sane:

--8<--
dmesg:
[  630.948077] usb 1-3: new high speed USB device using ehci_hcd and 
address 5
[  631.089822] usb 1-3: New USB device found, idVendor=1083, idProduct=161b
[  631.096584] usb 1-3: New USB device strings: Mfr=1, Product=2, 
SerialNumber=0
[  631.103808] usb 1-3: Product: CANON   DR-2010C
[  631.109015] usb 1-3: Manufacturer: CANON

root at vpnbox-f2-emmastr:/etc/scanbd# scanimage -L
device `canon_dr:libusb:001:005' is a CANON DR-2010C scanner
--8<--

However, scanbd won't find the scanner:

--8<--
root at vpnbox-f2-emmastr:/etc/dbus-1/system.d# /usr/sbin/scanbd -df -c 
/etc/scanbd/scanbd.conf
/usr/sbin/scanbd: debug on: level: 7
/usr/sbin/scanbd: dropping privs to uid saned
/usr/sbin/scanbd: dropping privs to gid lp
/usr/sbin/scanbd: drop privileges to gid: 7
/usr/sbin/scanbd: Running as effective gid 7
/usr/sbin/scanbd: drop privileges to uid: 111
/usr/sbin/scanbd: Running as effective uid 111
/usr/sbin/scanbd: dbus_init
/usr/sbin/scanbd: dbus match 
type='signal',interface='org.freedesktop.Hal.Manager'
/usr/sbin/scanbd: sane version 1.0
/usr/sbin/scanbd: Scanning for local-only devices
/usr/sbin/scanbd: start_sane_threads
/usr/sbin/scanbd: start dbus thread
/usr/sbin/scanbd: udev init
/usr/sbin/scanbd: get udev monitor
/usr/sbin/scanbd: start udev thread
/usr/sbin/scanbd: timeout: 500 ms
/usr/sbin/scanbd: Iteration on dbus call
/usr/sbin/scanbd: udev thread started
/usr/sbin/scanbd: Iteration on dbus call
/usr/sbin/scanbd: Iteration on dbus call
/usr/sbin/scanbd: Iteration on dbus call
^C/usr/sbin/scanbd: sig_term/int_handler called with signal 2
/usr/sbin/scanbd: stop_sane_threads
/usr/sbin/scanbd: stop dbus thread
/usr/sbin/scanbd: join dbus thread
/usr/sbin/scanbd: stop udev thread
/usr/sbin/scanbd: join udev thread
/usr/sbin/scanbd: cleanup device handler
/usr/sbin/scanbd: close udev monitor
/usr/sbin/scanbd: close udev
/usr/sbin/scanbd: exiting scanbd
--8<--

Any ideas what I might do next to make it find the scanner?

Thanks in advance!
--
Rien