[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

coldplug udev issue



Hi Marco,

I am using a scanner which needs to have its lamp switched off when plugged 
into USB. I wrote a script for that, which is called by an udev rule. That 
works very well when I plug the scanner, the script is called and the lamp is 
switched off. Coldplug does not call the script though (scanner is plugged 
during boot). Not even /etc/init.d/udev restart helps in this case.

Any hint what I could do to debug this is very welcome.

I am using a lenny system with udev

rd@blackbox:~$ dpkg -s udev
Package: udev
Status: install ok installed
Priority: important
Section: admin
Installed-Size: 940
Maintainer: Marco d'Itri <md@linux.it>
Architecture: i386
Version: 0.114-2


My udev rule:

rd@blackbox:~$ cat /etc/udev/rules.d/z60_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"
rd@blackbox:~$ 

The script which switches off the lamp has some debug output which helps to 
find out if the script is called:

rd@blackbox:~$ cat /usr/local/bin/umax1220u
#!/bin/sh
set -vx
# example for a DEVICE: /proc/bus/usb/001/004

echo umax1220u $DEVICE $* >> /tmp/usb.log
export >> /tmp/usb.log
ACTION=$1

#if [ $MINOR != "19" ]; then exit 0; fi

if  echo $DEVPATH |grep ep00 > /dev/null ; then
  case $ACTION in
  start)
          echo "UMAX 1220u scanner added"
  #        DEV=umax1220u:libusb:`echo $DEVICE|cut -d / -f 5`:`echo $DEVICE|
cut -d / -f 6`
          DEV=`scanimage -L|cut -f 2 -d \\\`|cut -f1 -d \'`
          echo started: $DEV >> /tmp/usb.log
          # example for a DEV umax1220u:libusb:001:006
          (sleep 1 && /usr/bin/scanimage --lamp-off --device=$DEV --dont-scan) 
&
          ;;
  stop)
          echo "UMAX 1220u scanner removed"
          ;;
  esac
fi
rd@blackbox:~$


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


Reply to: