[sane-devel] Response to systemd integration, sane-devel Digest, Vol 91, Issue 12
Michael Watson
mwatson33 at comcast.net
Fri Jan 11 13:38:06 UTC 2013
Louis,
Thank you.
When I posted the integration tweaks the service complained on startup as
simple with a dbus name. This was solved with changing the type to dbus. I
have since settled on type simple and no dbus name, and it's working fine
with no complaining.
FYI startup and shutdown:
/usr/lib/udev/rules.d/99-local.rules
ENV{ID_VENDOR_ID}=="04a9", ENV{ID_MODEL_ID}=="190a", ACTION=="add",
RUN+="/usr/bin/systemctl start scanbd"
ENV{SUBSYSTEM}=="usb", ENV{ID_PRODUCT_FROM_DATABASE}=="CanoScan LiDE 210",
ACTION=="remove", RUN+="/usr/bin/systemctl stop s$
Had to snoop the messages (udevadm monitor --property) for "remove" to sense
removal properly.
At the time I though scanbm.socket had to be enabled to listen. I was
wrong. I've since removed the install section and it works fine. When
working though this I found out xinetd was no longer necessary (see below
root vs saned). Archlinuxarm supports socket activation.
In summary,
scanbd.service startup and shutdown with udev rules (scanbd.service
not enabled)
scanbm.socket enabled
monitoring: saned Ssl /usr/local/sbin/scanbd -f
net scan: saned Ssl /usr/local/sbin/scanbd -f
root Ss /usr/local/sbin/scanbm
root Ss saned
scan by button: saned Ssl /usr/local/sbin/scanbd -f
root S /bin/bash
/usr/local/etc/scanbd/ccp2pdf.script
root S scanimage --device-name
genesys:libusb:001:008 --resolution ...
xinetd started (e.g. udev rule) and scanbm.socket disabled
monitoring: saned Ssl /usr/local/sbin/scanbd -f
root Ss /usr/sbin/xinetd -dontfork
net scan: saned Ssl /usr/local/sbin/scanbd -f
root Ss /usr/sbin/xinetd -dontfork
saned Ss scanbm
saned Ss saned
scan by button: saned Ssl /usr/local/sbin/scanbd -f
root Ss /usr/sbin/xinetd -dontfork
root S /bin/bash
/usr/local/etc/scanbd/ccp2pdf.script
root S scanimage --device-name
genesys:libusb:001:008 --resolution ...
With xinetd scanbm and saned run as user saned when scanning via network.
Any thoughts?
R/
Mike
-----Original Message-----
From: sane-devel-bounces+mwatson33=comcast.net at lists.alioth.debian.org
[mailto:sane-devel-bounces+mwatson33=comcast.net at lists.alioth.debian.org] On
Behalf Of sane-devel-request at lists.alioth.debian.org
Sent: Friday, January 11, 2013 7:00 AM
To: sane-devel at lists.alioth.debian.org
Subject: sane-devel Digest, Vol 91, Issue 12
Send sane-devel mailing list submissions to
sane-devel at lists.alioth.debian.org
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
or, via email, send a message with subject or body 'help' to
sane-devel-request at lists.alioth.debian.org
You can reach the person managing the list at
sane-devel-owner at lists.alioth.debian.org
When replying, please edit your Subject line so it is more specific than
"Re: Contents of sane-devel digest..."
Today's Topics:
1. using scanners unable to USB_AUTOSUSPEND (Wilhelm)
2. Re: using scanners unable to USB_AUTOSUSPEND (Johannes Meixner)
3. Re: Perfection 610: cannot scan in color (Evil Mr Henry)
4. Re: Perfection 610: cannot scan in color (Evil Mr Henry)
5. Re: Scanner Button Daemon [scanbd]: release 1.3 (Louis Lagendijk)
6. Re: using scanners unable to USB_AUTOSUSPEND (Wilhelm)
----------------------------------------------------------------------
Message: 1
Date: Thu, 10 Jan 2013 16:58:54 +0100
From: Wilhelm <wilhelm.meier at fh-kl.de>
To: <sane-devel at lists.alioth.debian.org>
Subject: [sane-devel] using scanners unable to USB_AUTOSUSPEND
Message-ID: <50EEE53E.5020002 at fh-kl.de>
Content-Type: text/plain; charset="ISO-8859-15"; format=flowed
Hi all,
recently I had problems with my old EPSON 1670 Scanner, because it
doesn't support usb autosuspend that most distros enable by default in
the linux kernel. That causes scanimage or other applications (e.g. like
scanner button daemon scanbd) to freeze or even reading wrong values.
If anyone is interested: I have put some hints in README.txt of scanbd. You
can find it at
http://scanbd.svn.sourceforge.net/viewvc/scanbd/trunk/doc/?sortby=rev
HTH,
--
Wilhelm
------------------------------
Message: 2
Date: Thu, 10 Jan 2013 17:29:54 +0100 (CET)
From: Johannes Meixner <jsmeix at suse.de>
To: sane-devel at lists.alioth.debian.org
Subject: Re: [sane-devel] using scanners unable to USB_AUTOSUSPEND
Message-ID: <alpine.LNX.2.00.1301101715290.12362 at nelson.suse.de>
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Hello,
On Jan 10 16:58 Wilhelm wrote (excerpt):
> recently I had problems with my old EPSON 1670 Scanner, because it
> doesn't
> support usb autosuspend that most distros enable by default in the linux
> kernel. That causes scanimage or other applications (e.g. like scanner
button
> daemon scanbd) to freeze or even reading wrong values.
If I remember correctly a longer time ago the "usb autosuspend" issue was
discussed on this list.
As a consequence the sane-backends libsane.rules file for udev (it is
/etc/udev/rules.d/55-libsane.rules at least in openSUSE) that is generated
by tools/sane-desc.c in the sane-backends sources
contains:
----------------------------------------------------------------------------
---
# Epson Perfection 1670
ATTR{idVendor}=="04b8", ATTR{idProduct}=="011f", ...
ENV{libsane_matched}="yes" ... # The following rule will disable USB
autosuspend for the device ENV{libsane_matched}=="yes", RUN+="/bin/sh -c
'if test -e /sys/$env{DEVPATH}/power/control;
then echo on > /sys/$env{DEVPATH}/power/control;
elif test -e /sys/$env{DEVPATH}/power/level;
then echo on > /sys/$env{DEVPATH}/power/level; fi'"
----------------------------------------------------------------------------
---
(the actual udev rules are single long lines - only wrapped here)
Accordingly - if your "EPSON 1670" matches the idVendor/idProduct - it
should get ENV{libsane_matched}="yes" and USB autosuspend should get
disabled for it.
Unfortunately things in udev/sysfs are unstable by design (udev/sysfs is
primarily meant as a helper tool to do kernel related stuff and not a tool
for application programs - sane-backends ia an application from the kernel
point of view) so that it depends on the kernel and udev version whether or
not udev rules actually work.
Kind Regards
Johannes Meixner
--
SUSE LINUX Products GmbH -- Maxfeldstrasse 5 -- 90409 Nuernberg -- Germany
HRB 16746 (AG Nuernberg) GF: Jeff Hawn, Jennifer Guild, Felix Imendoerffer
------------------------------
Message: 3
Date: Thu, 10 Jan 2013 08:43:53 -0800
From: Evil Mr Henry <evilmrhenry at emhsoft.com>
Cc: sane-devel at lists.alioth.debian.org
Subject: Re: [sane-devel] Perfection 610: cannot scan in color
Message-ID: <50EEEFC9.8050806 at emhsoft.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
The -y 297.18 (not --br-y) command works. Thanks for your help.
On 01/08/2013 11:19 PM, Olaf Meeuwissen wrote:
> Evil Mr Henry writes:
>
>> Basically, "scanimage -v -d epson2:libusb:003:005 --format png >
>> outfile.png" works, but "scanimage -v --mode color -d
>> epson2:libusb:003:005 --format png > outfile.png" throws the classic
>> "invalid argument"
>
> Shouldn't that be "--mode Color", with a capital C?
>
>> (It is, in fact, an Epson Perfection 610 USB scanner.)
>>
>> This is a new computer; the scanner worked on my old computer in much
>> the same setup.
>
> What version of sane backends and which backend did you use there?
>
>> Running Mint (Ubuntu) 64bit, Sane 1.0.22-7ubuntu1
>>
>> The following is the output after setting "export
>> SANE_DEBUG_EPSON2=255":
>>
>> scanimage -v --mode color -d epson2:libusb:003:005 --format png >
>> outfile.png
>
> I've gone through the log and it's clear from that that this is a bug
> in the epson2 backend. It fails to take into account the line
> distance when computing the maximum scan area, leading to a maximum
> that is too big. You can work around the issue by using "--br-y
> 297.18" (i.e. 11.7 inches).
>
> Hope this helps,
>
------------------------------
Message: 4
Date: Thu, 10 Jan 2013 08:48:53 -0800
From: Evil Mr Henry <evilmrhenry at emhsoft.com>
Cc: sane-devel at lists.alioth.debian.org
Subject: Re: [sane-devel] Perfection 610: cannot scan in color
Message-ID: <50EEF0F5.302 at emhsoft.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Also, for anyone else with this problem, this works in XSane when I set
the scan size to DIN A4 port.
On 01/08/2013 11:19 PM, Olaf Meeuwissen wrote:
> Evil Mr Henry writes:
>
>> Basically, "scanimage -v -d epson2:libusb:003:005 --format png >
>> outfile.png" works, but "scanimage -v --mode color -d
>> epson2:libusb:003:005 --format png > outfile.png" throws the classic
>> "invalid argument"
>
> Shouldn't that be "--mode Color", with a capital C?
>
>> (It is, in fact, an Epson Perfection 610 USB scanner.)
>>
>> This is a new computer; the scanner worked on my old computer in much
>> the same setup.
>
> What version of sane backends and which backend did you use there?
>
>> Running Mint (Ubuntu) 64bit, Sane 1.0.22-7ubuntu1
>>
>> The following is the output after setting "export
>> SANE_DEBUG_EPSON2=255":
>>
>> scanimage -v --mode color -d epson2:libusb:003:005 --format png >
>> outfile.png
>
> I've gone through the log and it's clear from that that this is a bug
> in the epson2 backend. It fails to take into account the line
> distance when computing the maximum scan area, leading to a maximum
> that is too big. You can work around the issue by using "--br-y
> 297.18" (i.e. 11.7 inches).
>
> Hope this helps,
>
------------------------------
Message: 5
Date: Thu, 10 Jan 2013 22:53:37 +0100
From: Louis Lagendijk <louis at fazant.net>
To: sane-devel at lists.alioth.debian.org
Subject: Re: [sane-devel] Scanner Button Daemon [scanbd]: release 1.3
Message-ID: <1357854817.1645.19.camel at travel.pheasant>
Content-Type: text/plain; charset="ISO-8859-15"
On Sun, 2013-01-06 at 15:25 -0500, Michael Watson wrote:
> Thank you.
>
> I have 1.3 working on archlinuxarm (systemd). Please find below
> "integration" tweaks:
>
> ------------------------------------------------------
> /usr/lib/systemd/system/scanbd.service
> #Type=simple
> # dbus
> Type=dbus
I would recommend against changing the Type to dbus. That will
result in scanbm triggering starting of scanbd. It is not required for
scanbm that scanb is running. In my own copy I have removed the
BusName line from scanbd.service instead. It is superfluous.
> ------------------------------------------------------
> /usr/lib/systemd/system/scanbm at .service
> # required for systemctl enable scanbm@
> [Install]
> WantedBy=multi-user.target
>
No this is wrong! scanbm.socket should be enabled and started and
that triggers scanbm at .service when you use the scanner using the
net backend from the client application.
Scanbm.service should NOT have an install section.
> #/etc/systemd/system/multi-user.target.wants/scanbm at .service ->
> /usr/lib/systemd/system/scanbm at .service
> ------------------------------------------------------
> /etc/xinetd.d/sane
> service sane-port
> {
> port = 6566
> socket_type = stream
> wait = no
> user = saned
> group = scanner
> server = /usr/local/sbin/scanbm
> #not sure if this is required
> server_args = scanbm
> # disabled by default!
> disable = no
> }
Using systemd with scanbm.socket should take care of handling the socket on
port 6566. I don't even have (x)inetd installed. scanbm.socket does the
above for you and tells systemd to start scanbm.service when you scan using
the net backend from your application.
The above of course assumes a complete systemd that does replace (x)inetd.
Does systemd on ArchLinux support socket activation? Kind regards, Louis
------------------------------
Message: 6
Date: Fri, 11 Jan 2013 08:42:51 +0100
From: Wilhelm <wilhelm.meier at fh-kl.de>
To: Johannes Meixner <jsmeix at suse.de>
Cc: sane-devel at lists.alioth.debian.org
Subject: Re: [sane-devel] using scanners unable to USB_AUTOSUSPEND
Message-ID: <50EFC27B.9020400 at fh-kl.de>
Content-Type: text/plain; charset="ISO-8859-1"; format=flowed
Am 10.01.2013 17:29, schrieb Johannes Meixner:
>
> Hello,
>
> On Jan 10 16:58 Wilhelm wrote (excerpt):
>> recently I had problems with my old EPSON 1670 Scanner, because it
>> doesn't support usb autosuspend that most distros enable by default
>> in the linux kernel. That causes scanimage or other applications
>> (e.g. like scanner button daemon scanbd) to freeze or even reading
>> wrong values.
>
> If I remember correctly a longer time ago the "usb autosuspend" issue
> was discussed on this list.
>
> As a consequence the sane-backends libsane.rules file for udev (it is
> /etc/udev/rules.d/55-libsane.rules at least in openSUSE) that is
> generated by tools/sane-desc.c in the sane-backends sources
> contains:
> ----------------------------------------------------------------------
> ---------
>
> # Epson Perfection 1670
> ATTR{idVendor}=="04b8", ATTR{idProduct}=="011f", ...
> ENV{libsane_matched}="yes" ...
> # The following rule will disable USB autosuspend for the device
> ENV{libsane_matched}=="yes", RUN+="/bin/sh -c
> 'if test -e /sys/$env{DEVPATH}/power/control;
> then echo on > /sys/$env{DEVPATH}/power/control;
> elif test -e /sys/$env{DEVPATH}/power/level;
> then echo on > /sys/$env{DEVPATH}/power/level; fi'"
>
----------------------------------------------------------------------------
---
>
> (the actual udev rules are single long lines - only wrapped here)
>
> Accordingly - if your "EPSON 1670" matches the idVendor/idProduct - it
> should get ENV{libsane_matched}="yes" and USB autosuspend should get
> disabled for it.
Thanks for the hint! Must have missed the entry ...
But: I'm on ubuntu 12.04 and here I have the effect that after plugging
in the scanner it remains for about 500ms in the state "on" and then
falls back to "auto". So I moved 40-libsane.rules to 99-libsane.rules
and it is ok. Well, now I have to figure out the offending rule(s) ...
>
> Unfortunately things in udev/sysfs are unstable by design (udev/sysfs
> is primarily meant as a helper tool to do kernel related stuff and not
> a tool for application programs - sane-backends ia an application from
> the kernel point of view) so that it depends on the kernel and udev
> version whether or not udev rules actually work.
>
>
> Kind Regards
> Johannes Meixner
--
Wilhelm
------------------------------
_______________________________________________
sane-devel mailing list
sane-devel at lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
End of sane-devel Digest, Vol 91, Issue 12
******************************************
More information about the sane-devel
mailing list