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

Julien BLACHE jb at jblache.org
Thu Apr 24 20:45:11 UTC 2008

Johannes Meixner <jsmeix at suse.de> wrote:


>> > 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

(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!


>> 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!


Julien BLACHE                                   <http://www.jblache.org> 
<jb at jblache.org>                                  GPG KeyID 0xF5D65169

More information about the sane-devel mailing list