You know that any post about deactivating HAL will, at some point, link to a bucket of bolts singing “Daisy Bell”, so I’ll do it now and get it over with.
The past couple of days I’ve been removing from Shotwell the deprecated (and despised!) HAL. Shotwell’s reliance on HAL is minimal. Most hardware interaction is through gPhoto. What Shotwell needs is notification of devices being attached or detached (to run a gPhoto auto-detect) and a way of mapping USB ports to gPhoto camera objects (due to some legacy libusb port-naming stuff — see this and this). udev is the preferred replacement (although there’s still some information out there saying to use DeviceKit; don’t). Unfortunately, there’s no Vala bindings for gudev (a GObject-wrapper), so I had to build my own.
It turns out the Vala documentation for making bindings for GObject-based libraries has improved considerably, and I had a workable VAPI in just a couple of hours. (It’s here for those interested in its state.)
gudev has a signal for when devices are added, removed, changed, etc. That’s good. However, it doesn’t provide a way to get subsystem-specific device information (i.e. whether a USB device is a PTP camera). The solution was to walk the USB bus (via libusb) and match bus/device IDs with gPhoto’s auto-discovered port strings. And that’s all there was to it.
HAL offered everything we needed (signalling and USB-specific device type information), so I can’t say I’m on the good-riddance bandwagon. I’m not cheerleading for it either, though Like a casual acquaintance with whom you don’t have much in common, it’s easy to say sayonara to HAL.
Don’t know if it’s too late, I just noticed this post today (I don’t understand vala too much but it seems that you’re still using libusb).
As far as I can tell udev is already capable of detecting PTP cameras.
If all you need is to discriminate between ptp devices and simple usb ones you can look for udev properties like ID_GPHOTO and GPHOTO2_DRIVER with g_udev_device_get_property_* methods.
Here’s the output of “udevadm info –query=all –path=/foo/camera/path” for my dlsr: http://people.freedesktop.org/~fargiolas/d5000udevinfo.txt
And if that’s not enough you can still ping udev people at http://vger.kernel.org/vger-lists.html#linux-hotplug to get the missing features from HAL ported into udev.
Thanks for the info — I’ll check into it. It would be nice to not have to work with libusb and go through udev for everything.
— Jim