From mboxrd@z Thu Jan 1 00:00:00 1970 From: Roman Kagan Date: Sat, 12 Feb 2005 12:10:50 +0000 Subject: Re: [ANNOUNCE] hotplug-ng 001 release Message-Id: <20050212121050.GA2364@katya> List-Id: References: <20050211004033.GA26624@suse.de> In-Reply-To: <20050211004033.GA26624@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org On Sat, Feb 12, 2005 at 03:34:58AM +0300, Roman Kagan wrote: > Then why not just make the kernel (and coldplug) create an additional > environment variable with the fnmatch-able module name ready to use with > modprobe? Given that kernel (and coldplug) have all the IDs in the nice > integer form it would be a matter of a single add_hotplug_env_var() (or > sprintf()) call per each device type, and would be even tinier that the > hotplug-ng :) To illustrate this with an example, here's what could be done in place of hotplug-ng-001/module_usb.c: --- linux-2.6.10/drivers/usb/core/usb.c.orig 2004-12-25 00:34:46.000000000 +0300 +++ linux-2.6.10/drivers/usb/core/usb.c 2005-02-12 14:43:53.514389160 +0300 @@ -654,7 +654,34 @@ alt->desc.bInterfaceSubClass, alt->desc.bInterfaceProtocol)) return -ENOMEM; + + if (add_hotplug_env_var(envp, num_envp, &i, + buffer, buffer_size, &length, + "MODNAME=usb:v%04Xp%04Xdl%04Xdh%04Xdc%02Xdsc%02Xdp%02Xic%02Xisc%02Xip%02X", + usb_dev->descriptor.idVendor, + usb_dev->descriptor.idProduct, + usb_dev->descriptor.bcdDevice, + usb_dev->descriptor.bcdDevice, + usb_dev->descriptor.bDeviceClass, + usb_dev->descriptor.bDeviceSubClass, + usb_dev->descriptor.bDeviceProtocol, + alt->desc.bInterfaceClass, + alt->desc.bInterfaceSubClass, + alt->desc.bInterfaceProtocol)) + return -ENOMEM; } + else + if (add_hotplug_env_var(envp, num_envp, &i, + buffer, buffer_size, &length, + "MODNAME=usb:v%04Xp%04Xdl%04Xdh%04Xdc%02Xdsc%02Xdp%02Xic*isc*ip*", + usb_dev->descriptor.idVendor, + usb_dev->descriptor.idProduct, + usb_dev->descriptor.bcdDevice, + usb_dev->descriptor.bcdDevice, + usb_dev->descriptor.bDeviceClass, + usb_dev->descriptor.bDeviceSubClass, + usb_dev->descriptor.bDeviceProtocol)) + return -ENOMEM; envp[i] = NULL; Then only a generic $MODNAME (and $ACTION) handler would need to be present in hotplug (and could rather be added to modprobe). Given that module alias generation is already done in the kernel build process, and aliases are included in the modules, generating such an environment variable looks like a natural thing to do in-kernel too. Cheers, Roman. ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_ide95&alloc_id396&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