From mboxrd@z Thu Jan 1 00:00:00 1970 From: Greg KH Date: Tue, 15 Feb 2005 07:31:39 +0000 Subject: Re: /etc/hotplug or /etc/hotplug.d ? Message-Id: <20050215073139.GA21766@kroah.com> List-Id: References: <20050212163524.GA21962@albatross.madduck.net> In-Reply-To: <20050212163524.GA21962@albatross.madduck.net> 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 05:35:24PM +0100, martin f krafft wrote: > Hi folks, > > I develop the user-space driver for a USB device (libphidgets). To > be able to make it as easy as possible to my users, I want to > register a hotplug hook that chmod's the /proc/bus/usb/*/* file to > 0660:root:phidgets upon connection, so that (only) members of the > phidgets group can use it. > > There seem to be two approaches. > > At first, I was using a simple script in /etc/hotplug/usb: > > http://cvs.ailab.ch/cgi-bin/viewcvs.cgi/external/libphidgets/hotplug/Attic/phidgets?rev=1.2&view=auto > > along with a user map entry to have the script called upon insertion > of a USB device with a certain ID pair: > > http://cvs.ailab.ch/cgi-bin/viewcvs.cgi/external/libphidgets/hotplug/Attic/phidgets.usermap?rev=1.2&view=auto > > Greg KH suggested to me not to bother with the usermaps and instead > provide a script in /etc/hotplug.d/usb instead. So I did: > > http://cvs.ailab.ch/cgi-bin/viewcvs.cgi/external/libphidgets/hotplug/phidgets.hotplug?rev=1.3&view=auto > > Both approaches work. However, now I am being told that it is > "better" to use /etc/hotplug (like I did in the first approach). > I was unable to squeeze any real arguments out of the person > asserting this. Who said to do it that way? > But it got me thinking, so I want to find the real answer now. > > Using /etc/hotplug.d/usb seems to have the advantage that it does > not need the usermap, but it's called for every USB device ever > inserted. True. But a simple check at the start of your script/program will handle that properly, right? > /etc/hotplug/usb is only called if the usermap line matches. It > requires the line to specify a script to be called. However, scripts > are also called upon loading of a module by the same name by > hotplug, so there is a potential source of conflict. True, stay away from this, people are working to get rid of the /etc/hotplug/ scripts :) > What's your opinion? Which hook should I prefer? Again, what's the problem with using /etc/hotplug.d/ ? thanks, greg k-h ------------------------------------------------------- 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