Skip to contentSkip to conversation

Hot*un*plug

DISCUSSION Stephen Williams 1 participant 1 message May 21, 2001

lore
Share & tools
lore
#0 lore raw

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?

Signature · 11 lines
Steve Williams                "The woods are lovely, dark and deep.
[email protected]              But I have promises to keep,
[email protected]            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
[email protected]
http://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel