[sane-devel] Calling a script after USB scanner is plugged

Rainer Dorsch rdorsch at web.de
Sat Apr 26 20:06:28 UTC 2008


Am Donnerstag, 24. April 2008 schrieb Julien BLACHE:
> Johannes Meixner <jsmeix at suse.de> wrote:
>
> Hi,
>
> >> > Be careful with the labels you use. Always use a unique label name, or
> >> > you're asking for troubles. (been there, done that, accidentally
> >> > rendered a number of systems unbootable due to that ...)
> >
> > Many thanks for this enlightening info!
> > Impressive: A thoroughly thought out fail-safe design!
>
> udev is an incredible piece of crap, but the good news is that this
> piece of crap is mostly stable those days. Which is a big step forward
> already.
>
> (and I'll refrain from saying anything at all about the genius who
> invented udev. I'll just mention that he's also the author of "stable
> API is a nonsense".)
>
> > I can only guess that what udev actually does is to
> > concatenate all udev rules files into one single set
> > of rules and then it is not surprising when arbitrary
> > nonsense happens depending on which individual udev rules
> > files exist on a particular system which depends on which
> > individual software packages are installed on this system.
>
> You got it.
>
> > Very nice to debug!
>
> deWHAT?
>
> >> I tried that before after I saw the z60_libsane.rules
> >>
> >> ACTION!="add", GOTO="post_lamp_off"
> >> SYSFS{idVendor}=="1606", SYSFS{idProduct}=="0010", MODE="0664",
> >> GROUP="scanner", NAME="umax%n", RUN+="/usr/local/bin/umax1220u start",
> >> ENV{lamp_off}="yes"
> >> LABEL="post_lamp_off"
> >>
> >> But given the events, it is obvious not surprising that this is not
> >> working.
> >>
> >> Is anybody aware of a more elegant solution for this problem?
>
> You need to copy a bit more than that from. See the top of the file,
> there's more to it than that, also the way to identify a USB device
> event changed starting with 2.6.22 and the rules are
> backward-compatible in this respect too.
>
> > You cannot have "udev" and "elegant" at the same time
>
> Actually, you can, but you need a bit of udev/uevent knowledge and
> some time on your hands.
>
> > and you cannot have "HAL" and "elegant" at the same time.
>
> It's all HALegant, pff.
>
>
> Welcome to udev-land, Johannes!
>

The script works now reasonably robust (for now) when I plug the USB scanner. 
My problem is though, that the script does not get called when I boot the 
system and the scanner is plugged already during bootup. Why is this?

I call the script using

blackbox:~# cat /etc/udev/rules.d/z_local.rules
ACTION=="add", SYSFS{idVendor}=="1606", SYSFS{idProduct}=="0010", MODE="0664", 
GROUP="scanner", NAME="umax%n", RUN+="/usr/local/bin/umax1220u start", 
ENV{lamp_off}="yes"
blackbox:~# 

/etc/init.d/udev restart does not call the script either.

Any ideas what I am missing are welcome...

Thanks,
Rainer

-- 
Rainer Dorsch
Lärchenstr. 6
D-72135 Dettenhausen
07157-734133
email: rdorsch at web.de
jabber: rdorsch at jabber.org
GPG Fingerprint: 5966 C54C 2B3C 42CC 1F4F  8F59 E3A8 C538 7519 141E
Full GPG key: http://pgp.mit.edu/



More information about the sane-devel mailing list