On a570 play->rec->play switching works from mweerden's PTP interface if I do this:
1) boot up cam to play mode without USB cable
2) call DisableNotificationPTP() from a script (I set it to autostart). Without this call the camera would on USB cable attach go to a mode where it powers off the LCD, retracts the lens if it's open and prevent switching to REC mode until powered off.
3) attach USB cable
4) <conn> lua PB2Rec()
and we're in REC mode.
'lua Rec2PB()' then works too for REC->PLAY switching, and 'lua shoot()' works as well.
It's not a good idea to call PB2Rec() while in REC mode (cam crashes, need to wait for watchdog or remove batteries). Calling Rec2PB in PLAY mode does not seem to be that bad, but should be prevented as well of course -- doing that from an autorun script in PLAY mode I did manage to get the cam to a mode where it and CHDK seem to work, but power button and rec switch have no effect.
The a570 100e stubs I used:
NHSTUB(DisableNotificationPTP, 0xffd8df04)
NHSTUB(PB2Rec, 0xffc119b8)
NHSTUB(Rec2PB, 0xffc119f8)
Further, looks like it's also possible to do this stuff without having to touch the USB cable:
1) boot up cam to REC mode with USB cable already attached.
2) run script that calls DisableNotificationPTP() and Rec2PB() -- maybe for this one the event stuff would work in place of Rec2PB since PTP isn't active until we're in PLAY mode...but I didn't try it.
3) from PTP interface, we can now call stuff like 'lua PB2Rec(); sleep(1000); shoot()'
This way the PLAY/REC switch is physically in correct position for REC mode and probably shouldn't confuse CHDK quite as much for shooting related stuff as when booting to PLAY mode (basically we need to go to PLAY mode once while the USB cable is plugged in to get Canon FW to fire up all its PTP stuff...maybe it's would be possible to make that happen without PLAY mode too, but I suppose that's not necessary).
If that little script is set autostart, things work pretty smoothly (as long as you never want to boot to PLAY mode). It may even be possible to fully remote control the cam with the mechanically-prevent-power-button-from-getting-unpressed-and-then-switch-power-with-external-PSU hack (the controlling PC will of course need some simple custom electronics to switch the external PSU at will).
I gave this a quick try and I think it works as long as the camera is shut down cleanly with lua post_levent_to_ui("PressPowerButton")... I first tried just switching to play mode and then disconnecting the PSU, but after that the autostart script failed to switch to PLAY mode and thus PTP stuff never started. My finger got tired pressing the power button before I could test it ehough
.