[sane-devel] using scanners unable to USB_AUTOSUSPEND

2013-01-11 Thread Wilhelm
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] using scanners unable to USB_AUTOSUSPEND

2013-01-10 Thread Wilhelm
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




[sane-devel] using scanners unable to USB_AUTOSUSPEND

2013-01-10 Thread 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.

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