Tuesday, December 11, 2012

Raspberry Pi, Canon EOS 1100D and Gphoto

I finally have it! RS Components delivered it last week. Now all my free time has gone tweaking RasPi. :)

Because I plan to use RasPi as a media center, I chose Raspbmc as the operating system. It's based on Raspbian, which is basically Debian on ARM with some Raspberry specific packages. I'm sure I can get anything on this.

Then came the problems. Gphoto can control DSLRs and after initial problems, I got it working with my EOS 1100D. On RasPi, however, there are some more problems. First run works properly, but after the first I get only:

*** Error ***
PTP I/O error

*** Error ***
An error occurred in the io-library ('Unspecified error'): No error description available

After googling a bit and asking on #gphoto at Freenode, I found out the problem is not with Gphoto, but with Raspberry Pi. Hardware or software, no one seems to know.

There is a workaround!

After taking a photo with 

gphoto2 --wait-event=2s --set-config eosremoterelease=Immediate --wait-event=180s --set-config eosremoterelease=Off --wait-event-and-download=5s

the usb connection has to be reset. I found a piece of code to do just that: http://marc.info/?l=linux-usb&m=121459435621262&w=2. I copypasted that into usbreset.c, compiled it with gcc usbreset.c -o usbreset, and now taking photos seems to work. I'm running a loop of taking a photo, resetting usb and deleting the photos. While I'm writing this, it has successfully taken over 50 photos in a row.

Next I'm going to write a script to take photos, renaming them and sending them directly to my NAS.

3 comments:

  1. You sir, are awesome.

    On the other hand, my 1100D seems to freeze after taking every photo... Removing USB doesn't seem to make a difference, doesn't matter if I'm on the laptop or Pi, even manually pressing buttons on the camera has no effect.

    Weird.

    But now I know there's an IRC channel so yay!

    ReplyDelete
  2. Glad to be of help.

    Did you try the command I described above and in http://mikkolaine.blogspot.fi/2012/08/controlling-canon-eos-1100d-with-linux.html, or did you use the "normal" way (which I seem to have forgotten...)? The other way doesn't seem to be working on newer Canons.

    ReplyDelete
  3. I opened this issue: https://github.com/raspberrypi/linux/issues/218

    ReplyDelete