From mboxrd@z Thu Jan 1 00:00:00 1970 From: Farkas Levente Date: Thu, 07 Jun 2007 08:38:40 +0000 Subject: Re: udev remove ATTR(S) not working Message-Id: <4667C410.1080903@bppiac.hu> List-Id: References: <46673B9D.3000205@bppiac.hu> In-Reply-To: <46673B9D.3000205@bppiac.hu> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org Andrey Borzenkov wrote: >> On 6/7/07, Farkas Levente wrote: >>> hi, >>> how can i write a RUN udev rules for remove event? i want to recognize >>> my usd pendrive's add and remove. the add is simple since i can use >>> rather specific rules like: >>> --------------------------------------- >>> ACTION="add", SUBSYSTEM="block", ATTR{size}="2880", >>> ATTRS{serial}="07530736300A", ATTRS{product}="USB DISK Pro", >>> RUN+="/xxx" --------------------------------------- >>> but the remove rule is much complicated, since (at least it seems for >>> me) udev don't send ATTR(S) in this case and don't know about anymore >>> the removed device parameters. > > If you absolutely need them on remove (could you explain why? What exactly are > you trying to do?), set environment vars on add and use (match) them on > remove. ok so what i really need to somehow properly identify my pen drive. my home partition is luks encrypted and the key on on my pen drive. when i pug in the pen, udev recognize it and mount (after luksopen) the encrypted volue as /home/lfarkas. when i finish my work, simple logout and remove the pen. udev recognize the remove and umount (and luksclose) the volume. what i want to avoid to confuse my pen with other usb device eg. camera, pda and other pen device. ps. anyway this has been working for years, but now as i upgrade to fedora 7 and have to rewrite the rules (because of the SYSFS<->ATTR changes) i'd also like to polish my scripts. -- Levente "Si vis pacem para bellum!" ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ 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