All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrey Borzenkov <arvidjaar@mail.ru>
To: linux-hotplug@vger.kernel.org
Subject: Re: udev remove ATTR(S) not working
Date: Sat, 09 Jun 2007 15:37:40 +0000	[thread overview]
Message-ID: <200706091937.47555.arvidjaar@mail.ru> (raw)
In-Reply-To: <46673B9D.3000205@bppiac.hu>


[-- Attachment #1.1: Type: text/plain, Size: 1800 bytes --]

On Saturday 09 June 2007, Farkas Levente wrote:
> Andrey Borzenkov wrote:
> >> On 6/7/07, Farkas Levente <lfarkas@bppiac.hu> 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.
>
> how can i do so?

just like you did. ENV{foo}="bar" on add.

> eg i create a new link SYMLINK+="lfarkas" in the add action
> and in this case in remove actions env contains
> DEVLINKS='/dev/lfarkas /dev/...'
> BUT a rule like this:
> ACTION=="remove", SUBSYSTEM=="block", ENV{DEVLINKS}=="/dev/lfarkas*"
> never match, 

Because DEVLINKS does not come from persistent environment. Check with 
udevinfo --query=env.

> 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 
device attributes that you had set during device add event - you can either 
store them as environment variable or implement your own on-disk persistent 
store.

[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 286 bytes --]

-------------------------------------------------------------------------
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/

[-- Attachment #3: Type: text/plain, Size: 226 bytes --]

_______________________________________________
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

  parent reply	other threads:[~2007-06-09 15:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-06 22:56 udev remove ATTR(S) not working Farkas Levente
2007-06-06 23:08 ` Kay Sievers
2007-06-07  3:38 ` Andrey Borzenkov
2007-06-07  8:38 ` Farkas Levente
2007-06-07 16:30 ` Andrey Borzenkov
2007-06-07 21:13 ` Farkas Levente
2007-06-09 13:03 ` Farkas Levente
2007-06-09 15:37 ` Andrey Borzenkov [this message]
2007-06-09 15:40 ` Andrey Borzenkov
2007-06-09 17:54 ` Kay Sievers
2007-06-09 19:58 ` Farkas Levente
2007-06-09 20:16 ` Farkas Levente
2007-06-10  4:18 ` Andrey Borzenkov
2007-06-10 11:33 ` Farkas Levente
2007-06-10 11:38 ` Andrey Borzenkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200706091937.47555.arvidjaar@mail.ru \
    --to=arvidjaar@mail.ru \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.