On 7/30/09, Ben Beuchler <insyte@xxxxxxxxx> wrote: >> I don't know when REMOVE_CMD was added to the rules. If your rules are >> too old, you should be able implement it yourself. It is a really >> simple idea, you just need another rule to run the command on remove. >> >> ACTION=="remove", ENV{REMOVE_CMD}=="?*", RUN+="$env{REMOVE_CMD}" > > My udev is, indeed, too old (version 117), so I implemented a similar > technique: > > SUBSYSTEMS=="usb", ACTION=="add", SYSFS{idVendor}=="06e0", > SYSFS{idProduct}=="f111", ENV{REMOVE_CMD}="/usr/bin/logger GOODBYE" > > ACTION=="remove", ENV{REMOVE_CMD}!="", RUN+="$env{REMOVE_CMD}" > > That seems to be working. The problem I'm encountering now is that it > seems there are several "remove" actions called during initialization > of the device. If I swap in the "modprobe -r" command described in an > earlier email, it unloads the driver for the device before it even > finishes initializing. > > Below I've attached a sample syslog snippet showing the many "GOODBYE" > messages logged when I plug in the deivce. Also I've attached the > output of "udevmonitor --env". For good measure, I've also thrown the > output of "udevinfo -a -n /dev/ttyUSB0" at the end. > > Any idea how I can get my RUN command to only execute when I'm > actually unplugging the device? Sorry I don't understand the behaviour of this device. You sound stuck, I guess I can suggest a hack. Create a script to run in place of "modprobe -r". Start with "sleep 1" or so, to give the driver time to initialize. Check that the ttyUSB device node no longer exists. Only then let it do "modprobe -r". Alan -- To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html