From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrey Borzenkov Date: Sun, 02 Apr 2006 16:47:34 +0000 Subject: Re: Why not picking up ENV variables? Message-Id: <200604022047.38586.arvidjaar@mail.ru> List-Id: References: <442FD482.5000707@bl.com> In-Reply-To: <442FD482.5000707@bl.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Sunday 02 April 2006 18:58, Moshe Yudkowsky wrote: > In another test, I've modified the rules: > > SUBSYSTEM="block" IMPORT{program}="path_id $devpath" > > SUBSYSTEM="block", ACTION="add", ENV{ID_VENDOR}="iriver", > ENV{ID_SERIAL}="iriver_MassStorage_Disc", SYMLINK+="iriver", > RUN+="/etc/hotplug/usb/iriver", ENV{REMOVE_CMD}="/etc/hotplug/usb/iriver > remove" > > SUBSYSTEM="block", ACTION="remove", ENV{ID_VENDOR}="iriver", > ENV{ID_SERIAL}="iriver_MassStorage_Disc", RUN+="/etc/hotplug/usb/iriver > remove" > > and I've also set them to run *after* the persistent.rules file. This > should make certain that ID_VENDOR and ID_PATH are in the ENV -- even > though I've certainly seen them in udevinfo printouts even without > adding path_id myself. > > While "add" works, the "remove" does not work. Unless I misread the code, stored environment is not available when matching device event; it is imported after that, immediately before RUN programs are going to be run. As most other callouts are run only on ACTION="add", it means environment is mostly not available for remove rules. > Furthermore, even thought > run.rules executes, the ENV{REMOVE_CMD} that I've set does not run. > If I am right, it does not run for the same reason - ENV{REMOVE_CMD} is not defined when rule runs. > Help? Could you try if this patch helps? diff --git a/udev_device.c b/udev_device.c index 5db2709..cd84a0a 100644 - --- a/udev_device.c +++ b/udev_device.c @@ -101,6 +101,7 @@ int udev_device_event(struct udev_rules if (major(udev->devt) != 0 && strcmp(udev->action, "remove") = 0) { struct name_entry *name_loop; + udev_db_get_device(udev, udev->dev->devpath); udev_rules_get_run(rules, udev); if (udev->ignore_device) { info("device event will be ignored"); - -andrey -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) iD8DBQFEMAAqR6LMutpd94wRAk1QAJ9MmBhGr/P5JS9uFjN+zZhLKFWhYwCgvXBq YRwPF2XwwnItbtgSYRE3P68=DzuD -----END PGP SIGNATURE----- ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642 _______________________________________________ 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