I believe that when /etc/hotplug/usb/libgphoto2 script is run by udevd
instead of hotplug (as with recent udev versions, and with hotplug
purged), the environment is somewhat different from what
the script expects.  in particular if I add

    echo "=====" >> /tmp/script-output
    printenv >> /tmp/script-output
    echo "=====" >> /tmp/script-output

to /etc/hotplug/usb/ligphoto2,
the output file contains the following after I plug in my camera:
======
SUBSYSTEM=usb
DEVPATH=/devices/pci0000:00/0000:00:03.0/usb1/1-2
ACTION=add
PWD=/
UDEV_LOG=3
UDEVD_EVENT=1
SHLVL=1
PHYSDEVDRIVER=usb
PHYSDEVBUS=usb
SEQNUM=993
_=/usr/bin/printenv
======
======
SUBSYSTEM=usb
DEVPATH=/devices/pci0000:00/0000:00:03.0/usb1/1-2/1-2:1.0
ACTION=add
MODALIAS=usb:v04A9p3070d0001dcFFdscFFdpFFic*isc*ip*
PWD=/
UDEV_LOG=3
UDEVD_EVENT=1
SHLVL=1
DEVICE=/proc/bus/usb/001/010
PRODUCT=4a9/3070/1
TYPE=255/255/255
PHYSDEVBUS=usb
SEQNUM=994
_=/usr/bin/printenv
======
======
PHYSDEVPATH=/devices/pci0000:00/0000:00:03.0/usb1/1-2
SUBSYSTEM=usb_device
DEVPATH=/class/usb_device/usbdev1.10
MINOR=9
ACTION=add
PWD=/
UDEV_LOG=3
MAJOR=189
UDEVD_EVENT=1
DEVNAME=/dev/bus/usb/1/10
SHLVL=1
PHYSDEVDRIVER=usb
PHYSDEVBUS=usb
SEQNUM=995
_=/usr/bin/printenv
======

so as far as i can tell, the libgphoto2 script should replace
references to $DEVICE
with $DEVNAME, and moreover, the device is a character device not a
regular file.
so instead of -f, the test should be -c.

with those changes done to my local copy, I am able to plug in a
camera and import
photos as a non-root user (one that is a member of the camera group, obviously).

Cheers,
Aleksey Kliger

Reply via email to