hal -> udev migration for libgphoto2

Martin Pitt martin.pitt at ubuntu.com
Wed Jun 3 03:39:12 PDT 2009

Hello Marcus, hello DeviceKitters,

one part of the "Halsectomy" [1] is the migration of the libgphoto
integration from hal.

Current system

(1) libgphoto2 creates fdi/preprobe/10osvendor/20-libgphoto2.fdi on
    installation (generated with print-camera-list). This FDI has all
    gphoto-supported cameras with access type and name.

(2) gvfs and KDE listen to hal and trigger a camera action for a device
    with the "camera" info.capabilities.

(3) /dev/bus/usb/ access is currently handled in various ways:

  * Ubuntu development release (and I guess the latest Fedora) use
    udev-extras to grant access to the current local foreground
    session user for PtP cameras [2]

  * Ubuntu stable releases and older Fedora/OpenSUSE use the hal
    automatic ACL management which does more or less the same as
    udev-extras' 70-acl.rules.
  * Debian uses print-camera-list to generate an udev .rules file
    which makes all camera USB devices 0770 root:plugdev. This is
    obsolete now, since Debian currently uses hal auto-ACLs.

At some point we need to rip out hal from this chain. Has there been
any discussion about this subject yet?


My initial thoughts:

MTP/PTP cameras
Extend the current udev-extras rule [2] to set a "type" flag such as




(or "MTP", if it's possible to tell them apart)

Proprietary protocol
Add a new mode to print-camera-list which generates an udev rules file
for all non-PTP/MTP cameras which looks roughly like:

  ATTR{idVendor}=="0553", ATTR{idProduct}=="0202", ENV{ID_CLASS}="camera", ENV{PROTOCOL}="gphoto2"

and extend udev-extras [2] with a rule to set ACL_MANAGE for "camera"
ID_CLASS. This needs to ensure that the libgphoto rules come before

FDI properties

  info.capabilities → ENV{ID_CLASS}="camera"
  camera.access_method → ENV{PROTOCOL}="gphoto2"/"PTP"
  camera.libgphoto2.name → from USB db (product name)
  camera.libgphoto2.support → ENV{PROTOCOL} == "gphoto" || "PTP" || "MTP"


Stop querying hal, use libudev to pick out devices with
ID_CLASS=="camera" (and perhaps check if ENV{PROTOCOL} is supported).

[1] my notes: https://wiki.ubuntu.com/Halsectomy
[2] SUBSYSTEM=="usb", ENV{ID_USB_INTERFACES}=="*:060101:*", ENV{ACL_MANAGE}="1"

Marcus, David, Kay, does this make sense?

Thanks in advance for any comment,

Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://lists.freedesktop.org/archives/devkit-devel/attachments/20090603/e8570e84/attachment.pgp 

More information about the devkit-devel mailing list