linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* ENV{DEVNAME} in remove rule?
@ 2007-07-03 17:16 Richard Michael
  2007-07-03 17:45 ` Andrey Borzenkov
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Richard Michael @ 2007-07-03 17:16 UTC (permalink / raw)
  To: linux-hotplug

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-07-03 19:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-03 17:16 ENV{DEVNAME} in remove rule? Richard Michael
2007-07-03 17:45 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).