Canon PowerShot s40 and Linux


A guide to using the Canon PowerShot S40 with the Linux operating system, in this document we discuss the complete process to setup Linux to work with the S40 digital camera. This document assumes that you know how to install packages and compile new code, including the Linux kernel.

Within this document we will cover:

Setting up the Linux Kernel:

    You will need to have USB support compiled into your kernel along with the usbdevfs filesystem. To do this open your .config file from the /usr/src/linux directory and check that the following lines are present within:
CONFIG_USB=y
CONFIG_USB_DEVICEFS=y

CONFIG_USB_UHCI=y
    OR
CONFIG_USB_UHCI_ALT=y
    OR
CONFIG_USB_OHCI=y
You can also select these from your favourite kernel configuration program.
Note: If you are using a modern Linux distribution you should not have to do the above, USB will probably already be available in your Kernel.

Configuration Files:

    The only configuration file you are probably going to need to edit at this poinf is /etc/fstab in order to ensure that the usbdevfs is mounted at boot time, make sure that /etc/fstab contains this line:

none /proc/bus/usb usbdevfs defaults 0 0

Installing the required Libraries:

 You will need to have libusb installed on your computer, a development RPM and a base RPM are needed.  Get  libusb-0.1.4-1.i386.rpm and libusb-devel-0.1.4-1.i386.rpm. If you need to install from source code it can be found on  Sourceforge.

Connecting the Canon Powershot S40 to the computer:

 Use the supplied USB cable from any free USB port. When you have plugged the camera in type dmesg in an xterm, you should see a message something like this:

USB new device connect on bus1/1/3, assigned device number 7
USB device 7 (vend/prod 0x4a9/0x3056) is not claimed by any active driver.

 Your S40 is now connected to your computer and can be accessed, well done. The hard part is coming up.

Software to download images and videos


Change: As of late Jan 2002, gphoto2 needs libexif, get this from sourceforge. You need the libexif and libexif-gtk packages. Get the most recent ones, unpack them and compile them before getting gphoto2.

 
 To download images and videos the only program available at the moment is gphoto2. You may have heard of this program, or of gphoto. gphoto2 is a re-implementation of gphoto without a GUI. There is a catch though, S40 support is very new and only available from the gphoto2 CVS tree, so you will have to download it, here's how:

 Now you need to configure, build and install the source code.

Downloading images and videos

 The Powershot S40 is autodetected by gphoto2, to download images from the camera just type: gphoto2 -P you will probably have to be root to do this, in which case the command is su -c 'gphoto2 -P'.


Change:  There is an application called gtkam included with the gphoto2 cvs though, and I suggest you use this as it provided a nice graphical interface. Go into the frontends/gtk-old/ directory in the gphoto2 directory and do a ./configure followed by a make and a make install, you should now have the gtkam applicaiton at your disposal.


Change: You can disregard the superceeded stuff at the end of this chapter if you use usb-hotplugging.  Read on if you are using a recent 2.4.x series kernel with hotplugging enabled.....

                    Ensure that usb.usermap contains this line:
        usbcam 0x0003 0x04a9 0x3056 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000

                    Put this file in /etc/hotplug/usb/usbcam

        #!/bin/bash
        # $Id: gphoto2.txt,v 1.3 2001/10/19 14:13:38 hun Exp $

        if [ "${ACTION}" = "add" ] && [ -f "${DEVICE}" ]
        then
            chgrp camera "${DEVICE}"
            chmod a+rw "${DEVICE}"
        fi




 
Superceeded by usb-hotplugging!!!
The needing to be root thing is a real pain, so here is a workaround (security fans, look away in horror now)
#!/bin/bash
gphoto2 -P
chmod 777 *
 You can now download pictures from your PowerShot S40 (hopefully, if not, re-read this howto).

Viewing the pictures

 You can use any image viewing program you want to view your pictures, I would suggest gqview for viewing and the Gimp for editing, i'm sure that you can find these yourself. Look on Freshmeat.

Viewing the videos

 The S40 uses a quicktime codec to display it's videos. Usually this is Windows only, but there is a Linux program that works. It's called Mplayer. Get the source code to the latest release and install it. It includes windows-only .dlls that enable you to view your movies.

Conclusion:

 So, that's it. Hopefully you can now download pictures from your S40 from Linux. I hope that this document has been of some use to you. If you can think of any imprevements please email me dan@dangray.org