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

Johannes Meixner jsmeix at suse.de
Wed Apr 23 06:49:04 UTC 2008


On Apr 22 22:18 Rainer Dorsch wrote (shortened):
> I want to call a script after I plugged my USB scanner. I use udev for this by 
> adding a rule
> SYSFS{idVendor}=="1606", SYSFS{idProduct}=="0010", MODE="0664", 
> GROUP="scanner", NAME="umax%n", RUN+="/usr/local/bin/umax1220u start", 
> When I plug my scanner with this config, it seems an infinite number of 
> umax1220u scripts are started in a sequence (i.e. not in parallel, when one 
> is completed the next one starts).

It seems you need a test if ACTION!="add", i.e. a rule like

ACTION!="add", GOTO="end"
SYSFS{idVendor}=="1606", SYSFS{idProduct}=="0010", ... RUN+="..."

I had a similar issue but I got it run only about 5 times
with a rule like

ACTION!="add", GOTO="end"
SYSFS{idVendor}=="04b8", SYSFS{idProduct}=="010b", RUN+="..."

Fortunately in my case what is run is idempotent so that
it doesn't matter when it is run about 5 times.
I don't know the root cause, I guess it is the usual udev crap.

Welcome in the hell of udev, HAL and whatever else sophisticated
stuff which is required to make users happy or so they say...

Kind Regards
Johannes Meixner
SUSE LINUX Products GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany
AG Nuernberg, HRB 16746, GF: Markus Rex

More information about the sane-devel mailing list