All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Michael <rmichael-hotplug@edgeofthenet.org>
To: linux-hotplug@vger.kernel.org
Subject: ENV{DEVNAME} in remove rule?
Date: Tue, 03 Jul 2007 17:16:58 +0000	[thread overview]
Message-ID: <20070703171658.GB27375@server> (raw)

Hello,

I'm learning my way around udev, and have written these rules to add a
device:

KERNEL="sd*[!0-9]", ENV{ID_SERIAL}="", IMPORT{program}="/lib/udev/usb_id -x"
KERNEL="sd*[!0-9]", ENV{ID_TYPE}="?*", IMPORT{program}="/lib/udev/path_id %p"
KERNEL="sd*[!0-9]", ENV{ID_PATH}="*usb-0:6:1.0*", NAME="storage/raid-$env{ID_BUS}-%M-%m"

I want to run a command when it is removed, so I've written these rules:
(The first rule is a catch-all where I do "set >> /tmp/debug" to see
what's available in the environment..)

SUBSYSTEM="*", RUN+="/root/udev-catch-remove"
ENV{DEVNAME}="/dev/storage/raid-*", RUN+="/root/raid_management"

When the device is disconnected, "udevmonitor --env" shows me:
(DEVNAME appears just as I hoped..)

UDEV  [1183481937.246643] remove   /block/sdc (block)
UDEV_LOG=7
ACTION=remove
DEVPATH=/block/sdc
SUBSYSTEM=block
SEQNUM\x1266
MINOR2
MAJOR=8
PHYSDEVPATH=/devices/pci0000:00/0000:00:0b.1/usb2/2-6/2-6:1.0/host15/target15:0:0/15:0:0:0
PHYSDEVBUS=scsi
PHYSDEVDRIVER=sd
UDEVD_EVENT=1
ID_VENDOR=Maxtor_6
ID_MODELà40L0
ID_REVISION\b11
ID_SERIAL=Maxtor_6_E040L0
ID_TYPE=disk
ID_BUS=usb
ID_PATH=pci-0000:00:0b.1-usb-0:6:1.0-scsi-0:0:0:0
DEVLINKS=/dev/disk/by-id/usb-Maxtor_6_E040L0 /dev/disk/by-path/pci-0000:00:0b.1-usb-0:6:1.0-scsi-0:0:0:0
DEVNAME=/dev/storage/raid-usb-8-32


But, my command /root/raid_management is never run, as if udev isn't
matching ENV{DEVNAME}.

What have I misunderstood?

This is on Fedora 7 machine, using (slightly old) udev 106.
("rpm -q udev" =  udev-106-4.fc7)


Thanks,
Richard

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

             reply	other threads:[~2007-07-03 17:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-03 17:16 Richard Michael [this message]
2007-07-03 17:45 ` ENV{DEVNAME} in remove rule? Andrey Borzenkov
2007-07-03 17:52 ` Richard Michael
2007-07-03 18:06 ` Andrey Borzenkov
2007-07-03 18:17 ` Richard Michael
2007-07-03 19:44 ` 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=20070703171658.GB27375@server \
    --to=rmichael-hotplug@edgeofthenet.org \
    --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.