From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stamatis Mitrofanis Date: Sat, 05 Jan 2002 18:42:24 +0000 Subject: Re: A cleaner load_drivers function. Message-Id: List-Id: References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org Stamatis Mitrofanis wrote: > To put it more clearly: just load the module _unless_ there exists > /etc/hotplug/TYPE/DRIVER.agent to delegate to. > > Note the `.agent' extension! > > IMO, this driver-agent interface is much more forward-looking and > uniform. You just can't exclude the possibility that a driver may want > to do something device-specific in user-space _before_ `modprobe'ing. The driver-specific agents can do some _additional filtering_ this way. (I forgot that -- why do I keep forgetting to mention things? :-( ) The input subsystem can be an example. It has many bitmasks, some more than 32 bits. ACTION ... add|remove PRODUCT ... idbus/idvendor/idproduct/idversion NAME ... Device name from device descriptor. PHYS ... pci00:07.2/usb0:2.3/input0 (device physical address ID). EV ... Bitmask (32 bits) for the kinds of events this device supports. KEY ... 511 bits for the keys&buttons the device has. REL ... 15 bits for relative axes (x/y/z, mouse-wheel etc.) it provides. ABS ... 31 bits for absolute axes (x/y/z, throttle, pressure etc.). LED ... 15 bits for the LEDs on the device (num/caps-lock etc.). SND ... 7 bits for the characteristic sounds the device can make (beep!). FF ... 127 bits for supported force-feedback effects! MSC ... 7 more bits for the rest. It would be great if the input-driver-specific agents could do some extra filtering as appropriate. /****/ Here is a _tiny_ patch that will make load_drivers delegate (full backward compatibility): diff -r linux-hotplug/etc/hotplug/hotplug.functions linux-hotplug2/etc/hotplug/hotplug.functions 123a124,130 > # Available driver-specific agent? > if [ -f "/etc/hotplug/$TYPE/$MODULE.agent" -a \ > -x "/etc/hotplug/$TYPE/$MODULE.agent" ]; then > "/etc/hotplug/$TYPE/$MODULE.agent" > continue > fi > Now, the driver-specific agent (if available) can handle `add' events for devices it most likely handles. It can forget about devices it doesn't really handle. It would be a good idea to extend the `load_drivers' interface so that it handles `remove' events as well. _______________________________________________ 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