Magic Lantern Forum

Developing Magic Lantern => General Development Discussion => Topic started by: ayman on July 15, 2014, 05:09:58 AM

Title: How to Detect Physical Power Switch at Shutdown?
Post by: ayman on July 15, 2014, 05:09:58 AM
Hi everyone,

I'm trying to code in this suggestion in another thread into working for the Canon 6D:

Is it possible to set the power save to only come into effect when the camera is powered off using the main switch, rather than the camera's auto power off feature?

I see the ml_shutdown() function in tasks.c but I'm not sure how to detect if the shutdown is called by sleep or physical switch.  Is there a method to query the switch or an event to listen for?

-ayman
Title: Re: How to Detect Physical Power Switch at Shutdown?
Post by: a1ex on July 15, 2014, 07:01:54 AM
These should help: GMT_GUICMD_START_AS_CHECK, GMT_GUICMD_OPEN_SLOT_COVER, GMT_GUICMD_LOCK_OFF.

I didn't play much with them (they are Canon events sent at shutdown), but would be nice to have a core API that tells how the shutdown was done. The harder part is testing it on all models (it's not exactly something that can be automated, and is unlikely to be widely used, to get good testing coverage).
Title: Re: How to Detect Physical Power Switch at Shutdown?
Post by: ayman on July 21, 2014, 01:23:55 AM
Thanks a1ex - I'll give that a peek.  Selfishly I'm wanting this feature on my 6D.  :-)