From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Williams Date: Mon, 21 May 2001 01:34:02 +0000 Subject: Hot*un*plug Message-Id: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org It looks like the hotplug remove action is not supported by usb.agent or pci.agent. OK Fine, I get to wonder now how to implement it. Basically, I have a hotplug add action that is called (by usb.agent) when a device appears. It creates a symbolic link is /var/run to the /proc/bus/usb/... file that is the device. Works fine. I need some hook to *remove* that link. I've considered a couple possibilities: 1) Make my add action stick around as a demon, and poll the device. When the device disappears, remove the link and exit. 2) Modify the usb.agent to call a configured program when the hotplug remove happens. This program will remove the link when it is executed. 3) Have my add program register with the hotplug scripts to watch the device for me. The add demon would write a little script into a magic file when it executes, and the usb.agent would be modified to look for this file when the remove event is executed. I personally like #3. I can write the file ``proc%bus%usb%004%002'' in /var/run/hotplug with a program or link that usb.agent can execute when it detects a remove. It can automatically remove the file after executing it. The advantage here is that it doesn't burden the system when the remove event doesn't matter for a device, the lookup should be very fast, and work for usb and pci, and it doesn't cost a demon polling for the device. Comments? -- Steve Williams "The woods are lovely, dark and deep. steve@icarus.com But I have promises to keep, steve@picturel.com and lines to code before I sleep, http://www.picturel.com And lines to code before I sleep." _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net http://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel