Author Topic: How to Detect Physical Power Switch at Shutdown?  (Read 2756 times)

ayman

  • New to the forum
  • *
  • Posts: 2
How to Detect Physical Power Switch at Shutdown?
« 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

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12280
  • Emergencies only
Re: How to Detect Physical Power Switch at Shutdown?
« Reply #1 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).

ayman

  • New to the forum
  • *
  • Posts: 2
Re: How to Detect Physical Power Switch at Shutdown?
« Reply #2 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.  :-)