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:
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
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.0https://chdk.setepontos.com/index.php?topic=13214.0https://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.
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.
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.
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.