linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* /etc/hotplug or /etc/hotplug.d ?
@ 2005-02-12 16:35 martin f krafft
  2005-02-15  7:31 ` Greg KH
  2005-02-15  9:48 ` martin f krafft
  0 siblings, 2 replies; 3+ messages in thread
From: martin f krafft @ 2005-02-12 16:35 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 2140 bytes --]

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.

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.

/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.

What's your opinion? Which hook should I prefer?

Thanks,

-- 
martin;              (greetings from the heart of the sun.)
  \____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck
 
invalid/expired pgp subkeys? use subkeys.pgp.net as keyserver!
spamtraps: madduck.bogus@madduck.net
 
"zwei monologe, die sich gegenseitig
 immer und immer wieder störend unterbrechen,
 nennt man eine diskussion."
                                                    -- charles tschopp

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: /etc/hotplug or /etc/hotplug.d ?
  2005-02-12 16:35 /etc/hotplug or /etc/hotplug.d ? martin f krafft
@ 2005-02-15  7:31 ` Greg KH
  2005-02-15  9:48 ` martin f krafft
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2005-02-15  7:31 UTC (permalink / raw)
  To: linux-hotplug

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_id\x14396&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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: /etc/hotplug or /etc/hotplug.d ?
  2005-02-12 16:35 /etc/hotplug or /etc/hotplug.d ? martin f krafft
  2005-02-15  7:31 ` Greg KH
@ 2005-02-15  9:48 ` martin f krafft
  1 sibling, 0 replies; 3+ messages in thread
From: martin f krafft @ 2005-02-15  9:48 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 496 bytes --]

also sprach Greg KH <greg@kroah.com> [2005.02.15.0831 +0100]:
> True, stay away from this, people are working to get rid of the
> /etc/hotplug/ scripts :)

Thanks, this is the argument I was looking for.

-- 
martin;              (greetings from the heart of the sun.)
  \____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck
 
invalid/expired pgp subkeys? use subkeys.pgp.net as keyserver!
spamtraps: madduck.bogus@madduck.net
 
linux: because a pc is a terrible thing to waste

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-02-15  9:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-12 16:35 /etc/hotplug or /etc/hotplug.d ? martin f krafft
2005-02-15  7:31 ` Greg KH
2005-02-15  9:48 ` martin f krafft

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).