Hi, I'm looking to unload a userspace driver when a particular device is removed. My load rule is this: ACTION=="add",SUBSYSTEM=="usb_endpoint",ATTR{device/manufacturer}=="Crystalfontz", RUN+="/usr/bin/sv up lcdd" Now the problem was that when I disconnect the device there is no longer a "device/manufacturer" file, so I added an environment variable LCDD_DEVICE to the rule: ACTION=="add",SUBSYSTEM=="usb_endpoint",ATTR{device/manufacturer}=="Crystalfontz", ENV{LCDD_DEVICE}="%k", RUN+="/usr/bin/sv up lcdd" I had hoped to be able to match this LCDD_DEVICE variable when the kernel name appeared in the remove event. So I tried: ACTION=="remove", ENV{LCDD_DEVICE}=="%k", RUN+="... remove the driver ..." But this rule never triggered. I put in a debug line, and disconnected the device: ACTION=="remove", RUN+="/bin/sh -c 'logger B %k = $env{LCDD_DEVICE}'" Jan 1 00:41:21 user.notice root: B usbdev1.23_ep81 = Jan 1 00:41:21 user.notice root: B usbdev1.23_ep02 = Jan 1 00:41:21 user.notice root: B usbdev1.23_ep00 = usbdev1.23_ep00 <--- !!! Jan 1 00:41:21 user.notice root: B ttyUSB1 = Jan 1 00:41:21 user.notice root: B ttyUSB1 = Jan 1 00:41:21 user.notice root: B 1-1:1.0 = Jan 1 00:41:21 user.notice root: B 1-1 = So there is a situation where %k was equal to LCDD_DEVICE, but regardless the rule didn't trigger. Did I get the syntax wrong? Also, it appears that the scope of the environment variable LCDD_DEVICE only occurs when the actual device has caused the uevent. OK. So should I make my remove rule like this? ACTION=="remove", ENV{LCDD_DEVICE}!="", RUN+="... remove the driver ..." Aras ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ -- 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