From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrey Borzenkov Date: Sat, 09 Jun 2007 15:37:40 +0000 Subject: Re: udev remove ATTR(S) not working Message-Id: <200706091937.47555.arvidjaar@mail.ru> MIME-Version: 1 Content-Type: multipart/mixed; boundary="===============1278893179==" List-Id: References: <46673B9D.3000205@bppiac.hu> In-Reply-To: <46673B9D.3000205@bppiac.hu> To: linux-hotplug@vger.kernel.org --===============1278893179== Content-Type: multipart/signed; boundary="nextPart3616976.71yyOU9maA"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit --nextPart3616976.71yyOU9maA Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Saturday 09 June 2007, Farkas Levente wrote: > 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=3D=3D"add", SUBSYSTEM=3D=3D"block", ATTR{size}=3D=3D"2880", > >>> ATTRS{serial}=3D=3D"07530736300A", ATTRS{product}=3D=3D"USB DISK Pro", > >>> RUN+=3D"/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. > > how can i do so? just like you did. ENV{foo}=3D"bar" on add. > eg i create a new link SYMLINK+=3D"lfarkas" in the add action > and in this case in remove actions env contains > DEVLINKS=3D'/dev/lfarkas /dev/...' > BUT a rule like this: > ACTION=3D=3D"remove", SUBSYSTEM=3D=3D"block", ENV{DEVLINKS}=3D=3D"/dev/lf= arkas*" > never match,=20 Because DEVLINKS does not come from persistent environment. Check with=20 udevinfo --query=3Denv. > so how can i match for DEVLINKS? well, again, are you sure you really need it? What do you try to do? > or what other methods exists for properly identify a removed device? Device is identified by DEVPATH. If you mean - you need to fetch special=20 device attributes that you had set during device add event - you can either= =20 store them as environment variable or implement your own on-disk persistent= =20 store. --nextPart3616976.71yyOU9maA Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQBGaslFR6LMutpd94wRAoHGAJ96n4SyQGkLJu1bXKcqqfliWjxSvQCgiPZK Z8no77VzlGfsrZsQL4NUJ9I= =CDAv -----END PGP SIGNATURE----- --nextPart3616976.71yyOU9maA-- --===============1278893179== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------- 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/ --===============1278893179== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --===============1278893179==--