linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Moshe Yudkowsky <msha5_17@bl.com>
To: linux-hotplug@vger.kernel.org
Subject: Does RUN work with "remove" events?
Date: Wed, 30 Nov 2005 22:14:45 +0000	[thread overview]
Message-ID: <438E2455.5090702@bl.com> (raw)

I've written a udev rule to add a UMS flash drive with device name /dev/ums:

SYSFS{product}="Flash Disk", NAME="ums", RUN+="/etc/hotplug/usb/ums"

I've used "product" in the hope that the rule will be more general, and 
I won't have to change it for each new USB flash drive.

I selected "Flash Drive based on the following stansa that I saw in 
udevinfo:

>   looking at the device chain at '/sys/devices/pci0000:00/0000:00:10.3/usb4/4-2':
>     BUS="usb"
>     ID="4-2"
>     DRIVER="usb"
>     SYSFS{bConfigurationValue}="1"
>     SYSFS{bDeviceClass}="00"
>     SYSFS{bDeviceProtocol}="00"
>     SYSFS{bDeviceSubClass}="00"
>     SYSFS{bMaxPower}="200mA"
>     SYSFS{bNumConfigurations}="1"
>     SYSFS{bNumInterfaces}=" 1"
>     SYSFS{bcdDevice}="0200"
>     SYSFS{bmAttributes}="80"
>     SYSFS{configuration}=""
>     SYSFS{devnum}="18"
>     SYSFS{idProduct}="2168"
>     SYSFS{idVendor}="0ea0"
>     SYSFS{manufacturer}="USB     "
>     SYSFS{maxchild}="0"
>     SYSFS{product}="Flash Disk      "
>     SYSFS{serial}="255A07F4403C2C06"
>     SYSFS{speed}="480"
>     SYSFS{version}=" 2.00"
> 


When I plug  in the flash drive, I get the expected result: the RUN 
script runs (as well as the scsi_generic script), and I get a /dev/ums 
device.

> run_program: '/etc/hotplug/usb/ums' 'block'

and

> run_program '/etc/hotplug/usb/ums' 'scsi_generic'

as well because I used RUN+= instead of RUN=.

The problem is on remove. The file /dev/hotplug.log shows that I in fact 
do get a hotplug event of "remove":

> HOTPLUG_TIME='Wed Nov 30 15:40:04 CST 2005'
> SUBSYSTEM=usb
> OLDPWD=/
> DEVPATH=/devices/pci0000:00/0000:00:10.3/usb4/4-2
> ACTION=remove
> UDEV_LOG=3
> UDEVD_EVENT=1
> PHYSDEVBUS=usb
> SEQNUM\x1255

and I can see from udevmonitor:

> UDEV  [1133386804.167444] remove@/devices/pci0000:00/0000:00:10.3/usb4/4-2

and I get events from udev such as

> udev_event_run: seq 1277 forked, pid [4221], 'remove' 'scsi_generic', 0 seconds old


But the script in RUN never runs -- and I can see this in the udev 
output log, which I won't attach here.

So, here's the questions:

(a) Is udev supposed to work this way?
(b) If it is supposed to work this way, what's the recommended method to 
get RUN to work on ACTIONs of "remove"?
(c) If it isn't supposed to work this way, does anyone have any 
debugging suggestions or ideas of what to try next?

Regards,
  Moshe Yudkowsky
  (work) http://www.Disaggregate.com
  (book) http://www.PebbleAndAvalanche.com




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id\x16865&op=click
_______________________________________________
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:[~2005-11-30 22:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-30 22:14 Moshe Yudkowsky [this message]
2005-11-30 23:21 ` Does RUN work with "remove" events? Kay Sievers
2005-12-01  4:19 ` Moshe Yudkowsky

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=438E2455.5090702@bl.com \
    --to=msha5_17@bl.com \
    --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 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).