From mboxrd@z Thu Jan 1 00:00:00 1970 From: Moshe Yudkowsky Date: Wed, 30 Nov 2005 22:14:45 +0000 Subject: Does RUN work with "remove" events? Message-Id: <438E2455.5090702@bl.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org 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 > SEQNUM55 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_id865&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