Canon EOS 400D and Linux – Expt1

March 30, 2008

I was all excited when my new Canon EOS 400D landed in my hands today. I think that it’s a great piece of equipment, although I haven’t yet played around with it enough.

I thought I needed to buy a separate cable to computer-control it, and the USB cable was only a data transfer cable. I casually asked about software for EOS 400D on Linux on ##astronomy on freenode, and I was excited when ‘peerce’ told me that I should’ve got the USB cable for computer-control along with the camera! I ran down and brought the cable and connected the camera to my brother’s system, running Debian (testing).

I didn’t find a good “HOWTO” for the Canon EOS 400D detailing the remote-controlled capture, although I expected that somebody would’ve written one. (I think I should write one when I fully explore it, if someone else hasn’t!)

File transfer was trivially easy:

sudo apt-get install gphoto2 gtkam

gtkam

Select the ‘Add Camera’ option from the ‘Camera’ menu and say ‘Detect’.  Then click ‘Ok’. If the camera doesn’t initialize, try restarting the camera :-D   (May not be the right way to do things). If gtkam doesn’t segfault or run into some trouble, you should see a list of thumbnails on the right half of the window, if you select the right thing (the only thing) in the tree on the left pane. Figure out, it’s quite intuitive, and it doesn’t work well :-P   Maybe there are better methods to do this – maybe the konqueror camera:/ kioslave (or whatever it’s called) works better – please let me know in that case.

Now, I want to control my camera. So I look around for documentation. I understand that it is just

gphoto –set-config capture=on

gphoto2 -F <# of frames> -I <interval> –capture-image

That didn’t seem to work. After much experimentation, I tend to think that the camera needs details of how you want to photograph – i.e. focusing, exposure settings etc. (or does it?). Besides, capture=on must be set in the same command as the –capture-image, or so it seems, probably because every gphoto2 command sends a whole bunch of other instructions to the camera as well (isn’t that inefficient???).

So, that means that if I put the camera on Auto Mode using the Mode dial, then I can get away with:

gphoto2 –set-config capture=on  -F 1 -I 1 –capture-image

For some reason, the command doesn’t terminate (and consequently, F > 1 doesn’t work) – probably because it wants us to accept the image and save it as well. I still need to figure this out.

One more thing that I see is that if I do a

gphoto2 –list-config

I get only three options:

 /main/settings/capturetarget
/main/settings/capture
/main/capturesettings/focuslock

This is expected (after reading the documentation), because the remaining settings that pertain to capture mode are exposed only after we enable capture mode. So do a

gphoto2 –set-config capture=on –list-config

and you get a whole bunch of configurable parameters:

 /main/settings/eos-time
/main/settings/capturetarget
/main/settings/capture
/main/imgsettings/eos-iso
/main/imgsettings/eos-whitebalance
/main/capturesettings/picturestyle
/main/capturesettings/eos-aperture
/main/capturesettings/eos-shutterspeed
/main/capturesettings/eos-meteringmode
/main/capturesettings/focuslock

Ahh… so there we go. So, if I wanted a (semi-)successful manual exposure, I should do:

gphoto2 –set-config capture=on –config -F <Nf> -I <Ti> –capture-image

I still need to figure out how to retrieve the file or somehow get the command to complete.

Earlier, my AF exposures would fail, because I was trying to shoot a blank wall, so AF would fail! It took me really really long to realize that!

The following documentation will prove to be sparingly helpful:

Entry Filed under: Canon EOS 400D, GNU/Linux/FOSS. Tags: , , , .

13 Comments Add your own

  • 1. Akarsh Simha  |  March 30, 2008 at 4:17 am

    Expt 1.0.1
    I tried:

    ~/bin/gphoto2 –set-config capture=on -F 1 -I 1 –capture-image –new

    The command still doesn’t terminate.
    –new is supposed to get all pictures flagged as new.

    Reply
  • 2. Akarsh Simha  |  March 31, 2008 at 2:06 pm

    The problem of not terminating correctly is apparently because of some change with the proprietary (and consequently undocumented) Canon PTP (Picture Transfer Protocol or something like that) in the new firmware.
    Marcus Meissner has already started working on it and has produced (and commited?) a patch today (an hour ago or so).
    Will check if it works later today evening.

    Reply
  • 3. akarshsimha  |  April 6, 2008 at 11:11 am

    Ok… Marcus Meissner has fixed it and it works for other people. It’s been merged with the trunk. I now need to figure out how to compile gphoto2 from the trunk.

    Reply
  • 4. Nick Quinn  |  April 30, 2008 at 1:40 am

    After messing around with gPhoto and my 40D for several months, your blog provided me with the ‘hint’ I needed to finally understand how to set the shutter speed! However, if I fire the shutter either from gPhoto or by the camera’s shutter button, no image is stored on the CF card. Did you manage to get any further with your 400D and actually capture an image?

    Reply
  • 5. Akarsh Simha  |  May 13, 2008 at 1:43 am

    Glad that my blog proved useful. I haven’t got beyond this, because I haven’t found time to recompile gphoto2 from the trunk ever since :-D

    Regarding storing on CF card, you’ll have to set capturetarget to CF card. I don’t know what the exact value is, but you can look up the documentation for that.

    There’s also a neat ncurses based configuration screen, which you can use to set these parameteres.

    Reply
  • 6. Andrew Wyllie  |  June 27, 2008 at 4:36 pm

    Thanks for all the information on this. I got the latest version from SVN and it compiled with no problem and works really well.

    If you want to capture an image an download it right away, you need to use a command like:
    gphoto2 –set-config capture=on -F1 -I 1 –capture-image-and-download

    Even cooler is to use a hook-script which allows you to manipulate and or display the image as soon as it’s downloaded.

    Here’s my hook-script script which uses ‘display’ from ImageMagick to display the image one it has been downloaded (you could put any command you want there).

    #! /bin/bash

    self=`basename $0`

    case “$ACTION” in
    init)
    echo “$self: INIT”
    # exit 1 # non-null exit to make gphoto2 call fail
    ;;
    start)
    echo “$self: START”
    ;;
    download)
    echo “$self: DOWNLOAD to $ARGUMENT”
    display ${ARGUMENT} &
    ;;
    stop)
    echo “$self: STOP”
    ;;
    *)
    echo “$self: Unknown action: $ACTION”
    ;;
    esac

    exit 0

    Reply
  • 7. fred  |  August 2, 2008 at 1:00 pm

    Thanks for this useful info… you have put me on the right track. Maybe i can help you with a problem you have…

    Perhaps some of your commands haven’t been working because you weren’t typing the “–” correctly at the start?
    I cut and pasted some of the commands from this web page and they didn’t work for me. I changed the characters at the start of the arguments to “–” and then they worked.

    Eg gphoto2 –set-config capture=on -F 1 -I 1 –capture-image (from this page)
    didn’t work for me until i changed the -set to –set and -capture to –capture

    This may be of no use to you, perhaps the web page displays the double minus (–) as a single character for some reason

    Reply
  • 8. fred  |  August 2, 2008 at 1:03 pm

    After publishing my last comment, i now see that it is just the web software that runs together the double minus if it is typed with no space. Be aware if you cut and paste commands from here that look like this
    –config
    you need to manually edit them to look like this
    - -config (but with no space between the minus)
    Sorry this info is no use to the owner of this page but any others might be caught by this trap

    Reply
  • 9. Akarsh Simha  |  September 6, 2008 at 9:18 pm

    Yes, the – seems to be a problem with WordPress.

    I’ve still not been able to get gphoto2 from trunk to build and the latest release doesn’t seem to work for me.

    Reply
  • 10. jan  |  November 16, 2008 at 7:13 am

    Thanks to your article and helpful comments I have managed to get gphoto control my Canon 400D. Everything works with gphoto 2.4.3 and libgphoto 2.4.3 (even capture-tethered).

    Reply
  • 11. Akarsh Simha  |  February 1, 2009 at 6:53 pm

    I’m now doing astrophotography comfortably with my Canon EOS 400D and Debian laptop, thanks to Marcus Meissner and gphoto2.

    I’m using version 2.4.3 of both gphoto2 and libgphoto. This is what I do to get it working:

    gphoto2 –set-config capture=true -F -I –capture-image-and-download

    It still doesn’t seem to work with the mirror lock up / self timer. That’s something I need to figure out, because astrophotography really needs that!

    Reply
  • 12. Noah  |  July 18, 2009 at 12:37 pm

    Maybe there are better methods to [transfer photos] – maybe the konqueror camera:/ kioslave (or whatever it’s called) works better – please let me know in that case.

    I like the following;
    $ mkdir ./photo && cd ./photo
    $ gphoto2 -P

    That will suck all the photos off the camera into dir photo. Thanks for the remote control info.

    Noah

    Reply
  • 13. Damien Keffyn  |  August 1, 2009 at 7:56 pm

    I have tried with no real success to get my 400D to capture download and preview an image.

    is there a change that has relpaced the commands used above?

    Here is what I am trying
    gphoto2 –set-config capture=true -F -I –capture-image

    This returns –>

    value true, t 1
    New file is in location /capt0000.jpg on the camera

    this command fails –>
    gphoto2 –set-config capture=true -F -I –capture-image-and-download

    this command works –>

    gphoto2 –set-config capture=true -F -I –capture-image –get-all-files

    It returns the –>

    value true, t 1
    New file is in location /capt0000.jpg on the camera
    Saving file as capt0000.jpg

    The issue I have is I would like to be able to use the camera to take the image rather than instigate the capture from the command line.

    is this possible?

    Cheers,
    Damien K

    Reply

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


Pages

a

Archives

Tags

aKademy asteroid magnitudes astronomy Astrophotography AWK BASH Bugfix camera camstream Carnatic Flute Carnatic Music Carnatic Vocal Commit D-Bus DBus Debian diffraction FOSS.IN GNOKII GNU grunt GSoC Hackathon IIT IITM IIT Madras KDE KDE.IN kstars Linux mail merge Mass SMS mcabber Parallel Port Philips ToUcam Photography PlanetKDE procmail Saarang segfault streamer SVN The GIMP Violin Webcam

Recent Comments

Jaiswar Hemant H. on A summer at TIFR
Aditya shanker raghu… on A summer at TIFR
Aditya shanker raghu… on About Me
Aditya shanker raghu… on A summer at TIFR
Wolf16 on About Me