Hello everybody. I have the 2001_04_24 release of the hotplug scripts. I figured it would be good to be able to automatically unload drivers too so I did some work on the subject. Unfortunately, it _wasn't_ as simple as implementing the "remove" event in the policy agents and so that makes it a _lot_ of work on the subject. :-) For properly unloading drivers there need to be some changes in the way the boot scripts, the agent scripts and the driver-specific scripts (well, that doesn't leave much else :-)) are organized. Here's what: My idea is to put the functonality of the ".rc" boot scripts in the ".agent" scripts and have a central subsystem which triggers all others (via devices of it) at startup and shutdown -- creating a hierarchy this way. This means adding "start" and "stop" events and getting rid of "/etc/hotplug/*.rc" scripts. An example is that a PCI device (the host controller) is what "enables" the USB subsystem (or a part of it in the case of multiple controlers). So it goes for all other cases as long as the hotplug scripts are dealing only with hardware devices. This way the subsystems will be "started" and "stopped" in an order which is more appropriate than the current lexical order. My suggestion is also to have driver-specific "*.agent" (instead of just "*" scripts:-)) scripts which will be called _in place_ of (and not in addition to) modprobe (of course, they will call modprobe themselves if necessary). - This makes it possible for scripts to do their stuff before and/or after "modprobe"ing. - It also eliminates the need for a blacklist (you (or a package) can simply add empty agents) - It completes the previous hierarchical design which I was talking about. "uhci.agent" for example can "start" the USB subsystem when "added" . - The driver-specific *.agent files can be enumerated very simply (with this glob). - The driver-specific policy agents can have their own homes and invite friends and relatives as well... :-) I mean that each driver-specific agent can have its own driver-specific subdirectory (just like each subsystem-specific agent can have its own subsystem-specific subdirectory). - Aside the previous, each driver (and this is the most useful part) can have its own .usbmap (or .pcimap or similar) in the subsystem-specific directory. This *.usbmap (as an example) file should be parsed as well by usbmodules. This makes usb.handmap, usb.usermap and similar files unnecessary. Another thing is that the individual policy agents should be separated from each other (/etc/hotplug/hotplug.functions is ugly :-)) and thus should have very few common parts. That's because future hotplug agents might not be only (or at all) for (un)loading kernel modules for hardware devices and they just can't ignore any common functions (like driver-loading functions or so) that are given to them. Now, that may sound bad since it means duplicating a couple of lines of script but I'm playing safe :-)... Here's a file layout: - Anything matching /etc/hotplug* is hotplug specific - Anything matching /etc/hotplug/xxx* is xxx-subsystem-specific. - Anything matching /etc/hotplug/xxx/yyy* is yyy-driver-specific. Here's a uniform naming scheme: - If * corresponds to nothing then it's a directory. - If * corresponds to ".agent" then it's a script that processes hotplug requests. - If * corresponds to ".conf" then it's sourced from the corresponding .agent script and related ones. So, my suggestion is also to create subsystem-specific .conf files (as well as a global one) that will be sourced from agent scripts and will define relevant variables and functions. The global /etc/hotplug.conf file will define the "msg" function ("mesg" is already used as a program name!!!) and a variable for the "central" subsystem (normally pci). It will also be sourced from /etc/init.d/hotplug . I must admit now that my fingers are getting tired... :-) I hope I covered everything I changed. All this work I did was mostly a rewrite and a clean-up of the scripts. Of course, I have attached a patch for the 2001_04_24 release. I have tested my changes on two machines with two USB devices and it seems to load/unload everything fine ("works for me") like the drivers for sound cards, UHCIs etc. . Yet it needs a few FIXMEs fixed to be 100% . Furthermore, I hope I did something positive here so please, anyone, do what you will to help. All yours(!), Stamatis