Gphoto2, version 2.4.99 and the Canon 20D (January, 2009)

It is January of 2009, and I once again have found a bit of time to play with gphoto2 and USB control of my Canon 20D. I have just built the latest copy of gphoto2 and libgphoto2 from the SVN repository. At this time, 2.4.3 is the current official release (2.4.4 was announced the day after I wrote this), so I am running something beyond 2.4.3 (in particular the svn checkout described by the following:)

(/u1/archive/gphoto_svn) cholla $ svn info
Path: .
URL: https://gphoto.svn.sourceforge.net/svnroot/gphoto/trunk
Repository Root: https://gphoto.svn.sourceforge.net/svnroot/gphoto
Repository UUID: 21bdcb62-e50e-0410-80e4-ae60ad24c865
Revision: 11738
Node Kind: directory
Schedule: normal
Last Changed Author: marcusmeissner
Last Changed Rev: 11738
Last Changed Date: 2009-01-20 14:42:14 -0700 (Tue, 20 Jan 2009)

From my work with 2.4.0 I learned that my camera must be in "Normal" mode for remote control to work, so I start with it set up that way. When I plug the usb cable in, dmesg shows me:

dmesg
usb 1-7: new high speed USB device using ehci_hcd and address 22
usb 1-7: configuration #1 chosen from 1 choice
usb 1-7: New USB device found, idVendor=04a9, idProduct=30eb
usb 1-7: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 1-7: Product: Canon Digital Camera
usb 1-7: Manufacturer: Canon Inc.
No attempt by some software to pull in photos or any nonsense of that sort, which is nice. Now for gphoto: note the explicit path to get the freshly built version in /usr/local/bin:
/usr/local/bin/gphoto2 --version
 gphoto2 2.4.99.0

 Copyright (c) 2000-2008 Lutz Mueller and others

 gphoto2 comes with NO WARRANTY, to the extent permitted by law. You may
 redistribute copies of gphoto2 under the terms of the GNU General Public
 License. For more information about these matters, see the files named COPYING.

 This version of gphoto2 is using the following software versions and options:
 gphoto2         2.4.99.0       gcc, popt(m), exif, no cdk, no aa, jpeg, readline
 libgphoto2      2.4.99.0       all camlibs, gcc, ltdl, EXIF
 libgphoto2_port 0.9.0          gcc, ltdl, USB, serial baudboy locking
No memory card in my camera, so that is as far as it goes today. Back again, a day later, with a blank memory card:
(/u1/tom) cholla $ /usr/local/bin/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 OK)

Flash disk information:
  Drive A:
  2'039'545'856 bytes total
  2'039'480'320 bytes available

Time: 2009-01-22 11:23:21 (host time +0 seconds)
Hmmm, not nearly as much information as I used to get with 2.4.0. Let's try an image capture:
(/u1/tom) cholla $ /usr/local/bin/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') ***       

For debugging messages, please use the --debug option.
Debugging messages may help finding a solution to your problem.
If you intend to send any error or debug messages to the gphoto
developer mailing list , please run
gphoto2 as follows:

    env LANG=C gphoto2 --debug --debug-logfile=my-logfile.txt --capture-image

Please make sure there is sufficient quoting around the arguments.
In spite of the error message, the camera does click, and an image ends up on the flash card, just as if I had pressed the shutter button.
(/www/cholla/photography/gphoto2) cholla $ /usr/local/bin/gphoto2 --capture-preview
Detected a 'Canon:EOS 20D (normal mode)'.                                      

*** Error ***              
Error capturing image
*** Error (-114: 'OS error in camera communication') ***       

For debugging messages, please use the --debug option.
Debugging messages may help finding a solution to your problem.
If you intend to send any error or debug messages to the gphoto
developer mailing list , please run
gphoto2 as follows:

env LANG=C gphoto2 --debug --debug-logfile=my-logfile.txt --capture-preview

Please make sure there is sufficient quoting around the arguments.

This again makes the shutter go click, but no image is captured on the flash card. There is a zero length file now named: tmpfileupWh6V

So, I follow the instructions to do the debug-logfile thing, and it works!
I try it again without the debug switches, and it works!

(/www/cholla/photography/gphoto2) cholla $ env LANG=C /usr/local/bin/gphoto2 --debug --debug-logfile=my-logfile.txt --capture-image
Detected a 'Canon:EOS 20D (normal mode)'.                                      
New file is in location /DCIM/154CANON/_MG_5428.CR2 on the camera
(/www/cholla/photography/gphoto2) cholla $ env LANG=C /usr/local/bin/gphoto2 --debug --debug-logfile=my-logfile2.txt --capture-preview
Detected a 'Canon:EOS 20D (normal mode)'.                                      
Saving file as canon_preview.jpg                                               
(/www/cholla/photography/gphoto2) cholla $ /usr/local/bin/gphoto2 --capture-image
Detected a 'Canon:EOS 20D (normal mode)'.                                      
New file is in location /DCIM/154CANON/_MG_5429.CR2 on the camera
(/www/cholla/photography/gphoto2) cholla $ /usr/local/bin/gphoto2 --capture-preview
Detected a 'Canon:EOS 20D (normal mode)'.                                      
File canon_preview.jpg exists. Overwrite? [y|n] y                              
Saving file as canon_preview.jpg
(/www/cholla/photography/gphoto2) cholla $ /usr/local/bin/gphoto2 --capture-image
Detected a 'Canon:EOS 20D (normal mode)'.                                      
New file is in location /DCIM/154CANON/_MG_5430.CR2 on the camera
(/www/cholla/photography/gphoto2) cholla $ /usr/local/bin/gphoto2 --capture-image
Detected a 'Canon:EOS 20D (normal mode)'.                                      
New file is in location /DCIM/154CANON/_MG_5431.CR2 on the camera
(/www/cholla/photography/gphoto2) cholla $ /usr/local/bin/gphoto2 --capture-image
Detected a 'Canon:EOS 20D (normal mode)'.                                      
New file is in location /DCIM/154CANON/_MG_5432.CR2 on the camera
(/www/cholla/photography/gphoto2) cholla $ /usr/local/bin/gphoto2 --capture-preview
Detected a 'Canon:EOS 20D (normal mode)'.                                      
File canon_preview.jpg exists. Overwrite? [y|n] y                              
Saving file as canon_preview.jpg
The file canon_preview.jpg from --capture-preview is not what I would expect.
(The images captured via --capture-image on the flash card in the camera are just fine!)
(/www/cholla/photography/gphoto2) cholla $ file *.jpg
canon_preview.jpg: TIFF image data, little-endian
Although it has a .jpg extension, it seems to be a broken TIFF file of some kind. Gimp just spews out lots of messages and won't have anything to do with it. Using the image magick tools, I get the following messages (display just shows me an all black frame)
(/www/cholla/photography/gphoto2) cholla $ identify canon_preview.jpg 
canon_preview.jpg TIFF 1536x1024 1536x1024+0+0 DirectClass 8-bit 450.369kb 
identify: incorrect count for field "BitsPerSample" (3, expecting 1); tag trimmed. `canon_preview.jpg'.
identify: Sorry, requested compression method is not configured. `canon_preview.jpg'.
identify: canon_preview.jpg: unknown field with tag 513 (0x201) encountered. `TIFFReadDirectory'.
identify: canon_preview.jpg: invalid TIFF directory; tags are not sorted in ascending order. `TIFFReadDirectory'.
identify: canon_preview.jpg: unknown field with tag 514 (0x202) encountered. `TIFFReadDirectory'.
identify: canon_preview.jpg: TIFF directory is missing required "ImageLength" field. `MissingRequired'.

(/www/cholla/photography/gphoto2) cholla $ display canon_preview.jpg 
display: incorrect count for field "BitsPerSample" (3, expecting 1); tag trimmed. `canon_preview.jpg'.
display: Sorry, requested compression method is not configured. `canon_preview.jpg'.
display: canon_preview.jpg: unknown field with tag 513 (0x201) encountered. `TIFFReadDirectory'.
display: canon_preview.jpg: invalid TIFF directory; tags are not sorted in ascending order. `TIFFReadDirectory'.
display: canon_preview.jpg: unknown field with tag 514 (0x202) encountered. `TIFFReadDirectory'.
display: canon_preview.jpg: TIFF directory is missing required "ImageLength" field. `MissingRequired'.

Just for the record, here are some of the files if anyone wants to jump in and give me advice troubleshooting:


Feedback? Questions? Drop me a line!

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