There's so much to read in the CHDK Wiki and Forum that I've only just stumbled across this. It appears that not only can scripts detect when power is applied via the USB port, but there's a neat function, get_usb_power, that returns (in units of 10ms) how long
power was applied. Some cunning CHDKers have used this to implement multiple functions via a sort of Morse code. Thus a short burst of power does one thing (clicks the shutter), a longer burst does something else (e.g. takes a shot with the flash) etc.
It struck me that the microprogrammers among us here could tweak their KAP gizmos to give you control over e.g zooming as well as shutter control, all via the USB port. In other words a multi-function GentLED for cameras with no IR capability.
Here's a (updated) test script. If you've got a CHDK camera, you can try it out just by plugging the camera into a USB cable from your computer (which will apply power to the USB port of the camera).
When you run it it will wait until USB power is applied, then when power is removed display how long it was present (in 10ms units). If power was on for more than a second, it will zoom in and out. If not it will take a photo. Then it will go back to waiting until you press the Shutter to end the script.
@title test remote
a = get_usb_power
if a>0 then print a
if a < 100 then gosub "shootpic" else gosub "dozooms"
until is_key "set"
for n=1 to 3
for n=1 to 3