[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-hotplug
Subject:    Trying to run a program on "remove" ACTION on a specific device
From:       jbd <jbdenis () dental-on-line ! fr>
Date:       2007-10-23 10:08:59
Message-ID: ffkh7a$fv9$1 () ger ! gmane ! org
[Download RAW message or body]

Hello,

I'm writing some udev rules and i've got some problem to run a program 
when a device is disconnected.

Here is my udev rules :

ACTION!="add", GOTO="remove_rules"
SUBSYSTEM!="usb_device", GOTO="end_rules"

SYSFS{idVendor}=="082b", SYSFS{idProduct}=="1002",  MODE="664", 
GROUP="scanner", SYMLINK+="rvg5",
RUN+="/bin/sh -c 'logger -t MYDEBUG /dev/rvg5 created'"

LABEL="remove_rules"
ACTION!="remove", GOTO="end_rules"
SUBSYSTEM!="usb_device", GOTO="end_rules"

ENV{DEVLINKS}=="/dev/rvg5", ACTION=="remove",
RUN+="/bin/sh -c 'logger -t MYDEBUG rvg5 removed'"

LABEL="end_rules"


The add action is correctly performed, but that is not the case of the 
remove action.

When i unplugged the device while watching udevmonitor --env, i can see :

UDEV  [1193133897.284138] remove@/class/usb_device/usbdev1.100
UDEV_LOG=3
ACTION=remove
DEVPATH=/class/usb_device/usbdev1.100
SUBSYSTEM=usb_device
SEQNUM=2709
MAJOR=189
MINOR=99
PHYSDEVPATH=/devices/pci0000:00/0000:00:1d.7/usb1/1-7/1-7.3
PHYSDEVBUS=usb
PHYSDEVDRIVER=usb
UDEVD_EVENT=1
DEVLINKS=/dev/rvg6
DEVNAME=/dev/bus/usb/001/100


So it seems ok here to check for ENV{DEVLINKS} in my rules.

Any advice ?

Many thanks in advance.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic