Table of Contents
Canon Powershot S2 IS
The PowerShot S2 is not a mass storage device so you can't just mount it to get the pictures. Instead it uses the Picture Transfer Protocol (PTP). A userspace tool which speaks this protocol is gphoto2. The PowerShot S2 is supported since version 2.1.6.
gphoto2 Setup on Debian
with hotplug
The 2.1.6 release is only available in the unstable branch:
#> apt-get -t unstable install gphoto2
or under Gentoo (the rest of the directions here work just fine under gentoo (thanks to original poster)).
{~} $ emerge gphoto2
To make it work for non-root users do the following to let hotplug set up the correct permissions for you:
#> /usr/lib/libgphoto2/print-usb-usermap |sed -e 's/^usbcam/libgphoto2/' > /etc/hotplug/usb/libgphoto2.usermap
The above step makes sure all cams supported by libgphoto2 are known to the hotplug daemon. Debian uses a different script than the default install thus the sed. The rest needed should be set up by the debian package already. If not refer to the gphoto2 manual. The only thing left is to add the users which are allowed to access the cam to the group camera
.
Connecting the camera should print the following in the syslog:
Jul 30 16:47:09 rumpel kernel: usb 1-4: new high speed USB device using address 12 Jul 30 16:47:09 rumpel usb.agent[23381]: libgphoto2: loaded successfully
Try your luck with the autodetection and you should see this:
$> gphoto2 --auto-detect Model Port ---------------------------------------------------------- Canon PowerShot S2 IS (PTP mode) usb: Canon PowerShot S2 IS (PTP mode) usb:001,012
with udev 084
The hotplug method mentioned above doesn't work anymore with a recent kernel and a matching udev version (udev replaces hotplug). I had to use the following rule placed in /etc/udev/rules.d/10-local.rules
:
BUS="usb", SYSFS{idVendor}="04a9", SYSFS{idProduct}="30f0", GROUP="camera", MODE="0660", \ PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", \ NAME="%c", RUN="/bin/sh -c 'chgrp camera /proc/%c && chmod 0660 /proc/%c'"
The rest is the same, add your user to the camera
group and use gphoto2 –auto-detect –list-files
to test.
Getting images from the Camera
You could of course use some GUI like the gtkam utility but I prefer a little script to do what I want. It fetches all available images to the current directory, autorotates them lossless using exiftran and deletes all images from the camera.
#!/bin/sh #The cameras image folder. use '--list-files' to get the name of the image folder FOLDER='/store_00010001/' echo "fetching all files..." gphoto2 --auto-detect --get-all-files --folder $FOLDER echo "Autorotating images..." exiftran -ai *.JPG echo echo "Deleting images from camera (Abort now if not wanted)" echo -n "Hit enter to continue " read foo gphoto2 --auto-detect --delete-all-files --recurse --folder $FOLDER
lsusb -v Output
Bus 001 Device 007: ID 04a9:30f0 Canon, Inc. Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 idVendor 0x04a9 Canon, Inc. idProduct 0x30f0 bcdDevice 0.02 iManufacturer 1 Canon Inc. iProduct 2 Canon Digital Camera iSerial 0 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 39 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 0 bmAttributes 0xc0 Self Powered MaxPower 2mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 3 bInterfaceClass 6 Imaging bInterfaceSubClass 1 Still Image Capture bInterfaceProtocol 1 Picture Transfer Protocol (PIMA 15470) iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x02 EP 2 OUT bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x83 EP 3 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0008 1x 8 bytes bInterval 10 Device Qualifier (for other device speed): bLength 10 bDescriptorType 6 bcdUSB 2.00 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 bNumConfigurations 1