Gphoto2, version 2.4.0 and the Canon 20D (2008)

I have a Canon EOS 20D and exclusively run Linux. I want to begin doing macro photography with my 20D in a variety of setups, and what would be really nice would be able to connect a USB cable to thecamera and control the camera from the computer, and in addition get a quick look at the images I take on a large screen. This is my goal, let's see how easy it is to get there.

I first played with gphoto back in 2005 (that was version 2.1.6), shortly after I got my 20D, but ran into some problems that I don't remember the details of, and didn't have the energy to work through at the time.

One thing I was told back then was that the camera needed to be in PTP mode to have a chance of working. I find now that this is true depending on your definition of working. The camera will NOT do remote capture in PTP mode. PTP will work for downloading images. You must be in normal mode to do remote camera control.

Let's see how this goes in 2008 with version 2.4.0.

I am running Fedora Core 8 (circa February, 2008), and find that I have both Gphoto2 as well as libgphoto2on my machine.

I hear mention of a package called gtkam (which is actually a project on the gphoto page). This is not available as a yum package and does not seem to be on my system, they suggest it as a reference implementation for a graphical libgphoto2 client, which hints that it is not intended to be a real working graphical application.

I notice that I have both gphoto2.x86_64 and gphoto2.i386 on my 64 bit system, and thinking it wise to avoid confusion I start to do a yum erase gphoto2.i386, but it wants to take the whole wine package with it due to dependencies, so I think better of it.

(~) cholla $ gphoto2 --version
gphoto2 2.4.0
This version of gphoto2 is using the following software versions and options:
gphoto2         2.4.0          gcc, popt(m), exif, no cdk, no aa, jpeg, readline
libgphoto2      2.4.0          gcc, ltdl, EXIF
libgphoto2_port 0.8.0          gcc, ltdl, USB, se

I use the menus in my camera to put it into PTP mode, then connect a USB cable. A dialog box comes up telling me that I have a camera connected. (This is promising!) and asks me if I want to download photos from it (I decline this opportunity). Now I follow the gphoto2 quick start guide and do the following:

gphoto2 --auto-detect
[tom@cholla tom]# gphoto2 --auto-detect
Model                          Port                                            
----------------------------------------------------------
Canon EOS 20D (PTP mode)       usb:            

[tom@cholla tom]# gphoto2 --summary
Camera summary:                                                                
Model: Canon EOS 20D
  device version: 03.0001
  serial number:  (null)
Vendor extension ID: 0x0000000b
Vendor extension description: (null)

Capture Formats: JPEG
Display Formats: Script, DPOF, MS AVI, MS Wave, JPEG, CRW

Device Capabilities:
        File Download, File Deletion, File Upload
        No Image Capture, No Open Capture, No vendor specific capture

Storage Devices Summary:
store_00000001:
        StorageDescription: None
        VolumeLabel: None
        Storage Type: Removable RAM (memory card)
        Filesystemtype: Digital Camera Layout (DCIM)
        Access Capability: Read-Write
        Maximum Capability: 0 (0 MB)
        Free Space (Bytes): 0 (0 MB)
        Free Space (Images): -1

Device Property Summary:
Event Emulate Mode(0xd045):(readwrite) (type=0x4) Enumeration [1,2,3,4,5,6,7] value: 2
Property 0xd04a:(readwrite) (type=0x2) Enumeration [0,1,2,3] value: 0
My camera will go to sleep, and give messages like:
(~) cholla $ gphoto2 --list-files
                                                                               
*** Error ***              
Could not detect any camera
*** Error (-105: 'Unknown model') ***       
A touch on the shutter button will gently wake it up. Then I get:
(~) cholla $ gphoto2 --list-files
There is no file in folder '/'.                                                
There is no file in folder '/store_00000001'.
There is no file in folder '/store_00000001/DCIM'.
There are 57 files in folder '/store_00000001/DCIM/143CANON'.
#1     IMG_4333.JPG                 2657 KB 3504x2336 image/jpeg
#2     IMG_4334.JPG                 2597 KB 3504x2336 image/jpeg
#3     IMG_4335.JPG                 2541 KB 3504x2336 image/jpeg
#4     IMG_4336.JPG                 2556 KB 3504x2336 image/jpeg
.....
Now, let's try the big test:
$ gphoto2 --capture-image
*** Error ***              
Sorry, your camera does not support generic capture

$ gphoto2 --capture-preview
*** Error ***              
Sorry, your Canon camera does not support Canon Viewfinder mode
*** Error (-6: 'Unsupported operation') ***       

Some homework yields the information that in PTP mode, the camera is nicely supported for access of images and their retrieval, but shuts down as far as any camera functions (the LCD screen flashes "Busy" and none of the camera buttons work). The "normal" mode, which is a Canon proprietary protocol, must be used to do remote capture, and this has been an experimental project within gphoto2. Back in 2006, the advice was to go to the gphoto2-devel list and track down the Walmsley patches. Then there was advice to build gphoto2 with the "TRUNK" option. There is hope that now with version 2.4.0 it will just work.

I use the camera menus to switch from PTP to Normal mode, and plug in the USB cable. I get the usual dialog asking if I want to import photos, which I dismiss. The camera is now fully functional. I can focus, change aperture and settings, even take pictures. Now I try:

(~) cholla $ gphoto2 --summary
Detected a 'Canon:EOS 20D (normal mode)'.                                      
Camera summary:

Camera identification:
  Model: Canon:EOS 20D (normal mode)
  Owner: unknown

Power status: on battery (power bad)

Flash disk information:
  Drive A:
  1'011'400'704 bytes total
  1'011'367'936 bytes available

Time: 2008-02-20 19:20:41 (host time +0 seconds)
And now I go for broke:
(~) cholla $ gphoto2 --capture-image
Detected a 'Canon:EOS 20D (normal mode)'.                                      

*** Error ***              
Error capturing image
ERROR: Could not capture.
*** Error (-114: 'OS error in camera communication') ***       
In spite of the above messages, the camera made it's loud click, and did take a picture, which I can now view on the LCD screen.
Now I try:
(~) cholla $ gphoto2 --set-config capture=on
Detected a 'Canon:EOS 20D (normal mode)'.                                      

*** Error ***              
The capture widget is not configurable.
*** Error (-2: 'Bad parameters') ***       

And now I try the following, which again takes a photo, but gives me errors:

(~) cholla $ gphoto2 --set-config "Capture size class"="Full Image" --capture-preview
Detected a 'Canon:EOS 20D (normal mode)'.                                      
Capture size class changed

*** Error ***              
Error capturing image
*** Error (-114: 'OS error in camera communication') ***       
All this is progress of a sort. It isn't clear if I still need the "TRUNK" build of gphoto2, or if there is some other trick I need to figure out.
Feedback? Questions? Drop me a line!

Tom's Digital Photography Info / tom@mmto.org