Linux Hotplug development
 help / color / mirror / Atom feed
* Re: [Libmtp-discuss] udev and libmtp: detect a new mtp device based
@ 2010-11-24 14:46 Dan Nicholson
  2010-11-24 15:05 ` [Libmtp-discuss] udev and libmtp: detect a new mtp device Marcus Meissner
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Dan Nicholson @ 2010-11-24 14:46 UTC (permalink / raw)
  To: linux-hotplug

On Wed, Nov 24, 2010 at 2:14 AM, Linus Walleij
<linus.ml.walleij@gmail.com> wrote:
> 2010/11/3  <lan.liu@nokia.com>:
>
>> 45-libmtp8.rules
>> PROGRAM="/home/mtp/test/wk43/a.sh /sys$env{DEVPATH} mtp"
>> SYMLINK+="libmtp-%k", MODE="666", GROUP="plugdev"
>
> This file - 45-libmtp8.rules is some distro file, what libmtp generates
> is libmtp.rules, which is autogenerated from a device database by the
> program found in examples/hotplug.c.
>
> Can you provide a patch to hotplug.c that adds this line to libmtp.rules?
>
> If you do that you will get this change into every distribution.

Every distribution does not have the plugdev group, though.
Furthermore, I don't see the point of making the mode 666 while also
setting the group to narrow the scope.

Might I suggest instead that the program be used not to set the
permissions, but to set the attributes consistently. E.g.,

PROGRAM="/home/mtp/test/wk43/a.sh /sys$env{DEVPATH} mtp", ENV{ID_MTP_DEVICE}="1"

If we know that all mtp devices have the environment variable
ID_MTP_DEVICE, then it's very easy to add a rule controlling the
permissions.

ENV{ID_MTP_DEVICE}="?*", MODE="666"

Even better, if we let the udev people know that there is some
attribute like ID_MTP_DEVICE that's set for all mtp devices, they can
add a rule for udev-acl, which dynamically updates the ACLs on all
distros. See how the gphoto2 devices are handled here:

http://git.kernel.org/?p=linux/hotplug/udev.git;a=blob;f=extras/udev-acl/70-acl.rules;hãff31c22e5c96af6478a715aa39928f7ba025bd;hb=HEAD

In fact, it seems they already have a rule to manage the ACLs on
PTP/MTP devices. What do you think?

--
Dan

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

end of thread, other threads:[~2010-11-28 22:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-24 14:46 [Libmtp-discuss] udev and libmtp: detect a new mtp device based Dan Nicholson
2010-11-24 15:05 ` [Libmtp-discuss] udev and libmtp: detect a new mtp device Marcus Meissner
2010-11-28 21:12 ` [Libmtp-discuss] udev and libmtp: detect a new mtp device based Linus Walleij
2010-11-28 21:25 ` Linus Walleij
2010-11-28 22:12 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox