Bug 31641 - udev rules conflict with gphoto2
Summary: udev rules conflict with gphoto2
Status: RESOLVED NOTOURBUG
Alias: None
Product: media-player-info
Classification: Unclassified
Component: General (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Martin Pitt
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-15 15:58 UTC by Alex Merry
Modified: 2011-04-19 02:51 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Alex Merry 2010-11-15 15:58:21 UTC
This is really just to link with the bug I filed at gphoto2 (https://sourceforge.net/tracker/?func=detail&atid=108874&aid=3109848&group_id=8874).

The crux of the matter is that the rules that gphoto2's print-camera-list utility and the rules provided by media-player-info overlap in terms of devices (there are currently 14 devices matched by both sets of rules) and both sets of rules set ID_MEDIA_PLAYER, but to different values (gphoto2 always sets it to "1").

If the rules are run the right way around, this will actually work.  But it's very fragile.  Some decision really needs to be made about it, and that decision made public (in the README files at the very least).
Comment 1 Alex Merry 2010-11-16 07:04:25 UTC
Perhaps the media-player-info rules should use := to set
ID_MEDIA_PLAYER in such a way that it won't be overridden.
Comment 2 Martin Pitt 2010-11-18 08:54:00 UTC
Alex,

I just tried :=, but it does not actually work for me. Does it for you? Which udev version are you using?

I tested this by creating a file /lib/udev/rules.d/90-test.rules with

--------
ENV{DEVTYPE}=="usb_device", ATTRS{idVendor}=="0bb4" , ATTRS{idProduct}=="0c01|0c02" , ENV{ID_MEDIA_PLAYER}="1"
SUBSYSTEM=="block", ATTRS{idVendor}=="0bb4" , ATTRS{idProduct}=="0c01|0c02" , ENV{ID_MEDIA_PLAYER}="1"
---------

and now plugging in my G1 causes

$ udevadm info --export-db|grep MEDIA_PLAYER
E: ID_MEDIA_PLAYER=1
E: ID_MEDIA_PLAYER=1

even if I use := in /lib/udev/rules.d/40-usb-media-players.rules.
Comment 3 Martin Pitt 2011-04-19 02:50:27 UTC
I can't think of a way how to fix this in the m-p-i rules. A better fix for this would be to change the libgphoto2 rules to only set ID_MEDIA_PLAYER if it isn't set already; I realize that this is a bit fiddly, but it could e. g. set ID_MEDIA_PLAYER_MTP=1, and then have a rule like

ENV{ID_MEDIA_PLAYER_MTP}=="1", ENV{ID_MEDIA_PLAYER}=="", ENV{ID_MEDIA_PLAYER}="1"
Comment 4 Martin Pitt 2011-04-19 02:51:54 UTC
Sorry, I can't forward the comment to the sourceforge bug, it seems their recent password recovery broke my account.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.