Turn Camera On When Battery Inserted - General Discussion and Assistance - CHDK Forum  

Turn Camera On When Battery Inserted

  • 2 Replies
  • 226 Views
Turn Camera On When Battery Inserted
« on: 06 / November / 2020, 16:38:57 »
Advertisements
Hi, is there a way to make a camera with CHDK (I'm using Canon SX530) to turn on when the battery is inserted?

Alternatively, can the camera be turned on by sending a signal through connected USB?

The closest thing I've seen is at: https://chdk.fandom.com/wiki/Adding_support_for_a_new_camera
Where it says: "To get CHDK to detect button presses (and USB remote triggers), one needs to specify the bits that represent these. These bits are located in the physw_status array"
But I can't find the file: platform/<camera>/kbd.c

Any help or creativity is appreciated!

*

Offline reyalp

  • ******
  • 13234
Re: Turn Camera On When Battery Inserted
« Reply #1 on: 06 / November / 2020, 17:10:49 »
Hi, is there a way to make a camera with CHDK (I'm using Canon SX530) to turn on when the battery is inserted?
The most common approach is to mechanically hold the power button down, or physically modify the switch.

The cameras generally run normally while the button is held down, but there are a few caveats:
To power off the camera, you should do a software shutdown first, for example with Lua script like:
Code: [Select]
post_levent_to_ui("PressPowerButton")
and then remove power after a short delay. If this is not done, camera settings will not be preserved.

Additionally, after startup, you should use
Code: [Select]
post_levent_to_ui("UnpressPowerButton")
To avoid some side effects of having the power button held down (one known one is that interfering with the Canon display off power saving feature.)

Some related threads:
https://chdk.setepontos.com/index.php?topic=11434.0
https://chdk.setepontos.com/index.php?topic=13214.0
https://chdk.setepontos.com/index.php?topic=13289.0

google with site:https://chdk.setepontos.com/index.php?topic=13289.0 and related terms like "power button" might find additional results.

Quote
But I can't find the file: platform/<camera>/kbd.c
The sources is available from https://app.assembla.com/spaces/chdk/subversion/source
However, this won't help your case, since the camera isn't running any code when it's powered off.

Quote
Alternatively, can the camera be turned on by sending a signal through connected USB?
Cameras that support charging over USB (generally, modern ones with micro-USB) will power on when USB is detected. Some very old models also power on when USB power is present. I'm pretty sure neither case applies to your SX530 though.

edit:
If you really mean "when the battery is inserted" rather than when external power is applied, there may be additional complication, because some cameras automatically shut down if the battery door is open. If this is a problem on your cam, it can probably be bypassed with a special build of CHDK. Or, you can could physically modify the switch that detects the door being open.
« Last Edit: 06 / November / 2020, 17:12:56 by reyalp »
Don't forget what the H stands for.

Re: Turn Camera On When Battery Inserted
« Reply #2 on: 06 / November / 2020, 18:05:03 »
Holding the power button down will work it seems.

That is exactly the simple, creative solution I needed.

Thank you so much for your detailed and quick response!

 

Related Topics