Magic Lantern Forum

Developing Magic Lantern => Scripting Corner => Scripting Q&A => Topic started by: Paulo Pinhal on August 28, 2013, 02:02:30 PM

Title: Canon 600D controller
Post by: Paulo Pinhal on August 28, 2013, 02:02:30 PM
I like to control (especially zoom, focus and start/stop recording video) my canon 600D with ML firmware installed. Will be possible by using the Raspberry python (for example) make this kind of control? I have not found any conclusive information on the internet ...
Title: Re: Canon 600D controller
Post by: SDX on August 28, 2013, 02:48:54 PM
That is very simple. The keyword you need to search for is PTP. In the magiclantern wiki you'll find some information. You can control basically everything on camera.
Title: Re: Canon 600D controller
Post by: Paulo Pinhal on September 21, 2013, 03:22:34 AM
Thanks for the reply, but you could be a little more specific?
I've done several researches but they not resulted as I intended.
I think if I send LUA functions (such as "get_focus", "set_focus", "get_zoom", "set_zoom", for example), through "./ptpcam --chdk «LUA function»" (I work with Ubuntu) I can control the canon 600D. But this method does not work, perhaps because the ML does not accept LUA scripts.
Another method I tried was to libptp2, but didn't resulted maybe because I don't know the camera's properties.
Suggestions?
Thank you, once more.
Title: Re: Canon 600D controller
Post by: Paulo Pinhal on September 22, 2013, 01:44:06 PM
Any help, please.
Title: Re: Canon 600D controller
Post by: SDX on September 22, 2013, 05:29:13 PM
CHDK-ptp won't work.

You should check out http://www.gphoto.org/. The gphoto2 commandline frontend does fulfill all your needs.

http://www.gphoto.org/doc/remote/
Title: Re: Canon 600D controller
Post by: Paulo Pinhal on September 22, 2013, 09:01:52 PM
Thanks for your reply.
I tried gphoto2, but could not change the values ​​of focus and zoom (among others), while the camera is capturing movies.
In shell mode, the gphoto2 ("gphoto2 --shell"), I identified the various configurations ("list-config") and I got the following results:
/main/actions/uilock
/main/actions/syncdatetime
/main/actions/autofocusdrive
/main/actions/manualfocusdrive
/main/actions/eoszoom
/main/actions/eoszoomposition
/main/actions/eosviewfinder
/main/actions/eosremoterelease
/main/settings/datetime
/main/settings/reviewtime
/main/settings/output
/main/settings/movierecord
/main/settings/ownername
/main/settings/artist
/main/settings/copyright
/main/settings/capturetarget
/main/settings/capture
/main/status/model
/main/status/ptpversion
/main/status/batterylevel
/main/status/lensname
/main/status/serialnumber
/main/status/shuttercounter
/main/status/availableshots
/main/imgsettings/imageformat
/main/imgsettings/imageformatsd
/main/imgsettings/whitebalance
/main/imgsettings/whitebalancexa
/main/imgsettings/whitebalancexb
/main/capturesettings/exposurecompensation
/main/capturesettings/autoexposuremode
/main/capturesettings/picturestyle
/main/capturesettings/bracketmode
/main/other/d402
/main/other/d407
/main/other/d406
/main/other/d303
/main/other/5001

The command "get-config /main/actions/eoszoom" always gives the following result: "Label: Canon EOS Zoom \ Type: TEXT \ Current: 0." So how can I change the zoom value?
With results above, I do not see how to change focus value.
What am I doing wrong?
Title: Re: Canon 600D controller
Post by: PhilK on January 19, 2014, 11:24:43 PM
Hi Paulo,

I'm trying something similar to you with a Pi, but I'll probably be using another language (C in my case).

But, coming back to your question what you've posted looks slightly wrong - here's what I have from my 600D.

gphoto2: {...ern/libptp2-1.1.10/src} /> list-config
/main/actions/uilock
/main/actions/syncdatetime
/main/actions/autofocusdrive
/main/actions/manualfocusdrive
/main/actions/eoszoom
/main/actions/eoszoomposition
/main/actions/eosviewfinder
/main/actions/eosremoterelease
/main/settings/datetime
/main/settings/reviewtime
/main/settings/output
/main/settings/movierecord
/main/settings/evfmode
/main/settings/ownername
/main/settings/artist
/main/settings/copyright
/main/settings/customfuncex
/main/settings/capturetarget
/main/settings/capture
/main/status/model
/main/status/ptpversion
/main/status/batterylevel
/main/status/lensname
/main/status/serialnumber
/main/status/shuttercounter
/main/status/availableshots
/main/imgsettings/imageformat
/main/imgsettings/imageformatsd
/main/imgsettings/iso
/main/imgsettings/whitebalance
/main/imgsettings/whitebalanceadjusta
/main/imgsettings/whitebalanceadjustb
/main/imgsettings/whitebalancexa
/main/imgsettings/whitebalancexb
/main/imgsettings/colorspace
/main/capturesettings/focusmode
/main/capturesettings/autoexposuremode
/main/capturesettings/drivemode
/main/capturesettings/picturestyle
/main/capturesettings/aperture
/main/capturesettings/shutterspeed

/main/capturesettings/meteringmode
/main/capturesettings/bracketmode
/main/capturesettings/aeb
/main/other/d402
/main/other/d407
/main/other/d406
/main/other/d303
/main/other/5001

I couldn't see the two lines bolded above in your list-config output.  Assuming this is just a copy/paste issue here's the next steps.

Check what values you can set like so:

gphoto2: {...ern/libptp2-1.1.10/src} /> get-config /main/capturesettings/aperture
Label: Aperture
Type: RADIO
Current: 4.5
Choice: 0 4.5
Choice: 1 5
Choice: 2 5.6
Choice: 3 6.3
Choice: 4 7.1
Choice: 5 8
Choice: 6 9
Choice: 7 10
Choice: 8 11
Choice: 9 13
Choice: 10 14
Choice: 11 16
Choice: 12 18
Choice: 13 20
Choice: 14 22
Choice: 15 25
Choice: 16 29

So, here's how I set the aperture fully closed:

gphoto2: {...ern/libptp2-1.1.10/src} /> set-config-index /main/capturesettings/aperture=16

Or fully open:

gphoto2: {...ern/libptp2-1.1.10/src} /> set-config-index /main/capturesettings/aperture=0

You'll need to play around with the config params as some are only read-only.