First of all, I assume you are using the latest version of the script I posted : One Shot v3 ?
I am now!
If you disable the display blank option, do you see the message "USB cable detected" on the LCD after your two second startup delay completes?
Yes I do see that message
Please elaborate on what you mean by "the script halts". Does it seem to stay running but is stuck after the "USB cable detected" message is printed?
That's exactly what it does
What happens if you gently pull the USB cable out of the camera while it is "halted"? What about if you press any key or the zoom lever?
OK here's for the settings and functionality
SCENARIO ONEparameter
USB ACTIVE set to
EXIT, with no cable at the USB port
AND
parameter
SHUTDOWN ON EXITI get the desired super quick OneShot image and subsequent shutdown as required during the Arduino powerup loop
However, when I add the chdkptp cable with the above settings, the camera rear screen flickers momentarily with a script message saying cable detected and then it appears to shut down.
===========================================
SCENARIO TWOparameter
USB ACTIVE set to
WAIT, with no cable at the USB port
AND
parameter
SHUTDOWN ON EXITI also get the desired Arduino OneShot activation and shutdown
However, when I add the chdkptp cable with the above settings, the script shows the message
cable detected and halts, ie sits there still powered up apparently waiting for something. This is with the Raspberry Pi powered off.
===========================================
I tried your suggestion of gently pulling out the USB cable while it was 'waiting' but the camera screen went black and I couldn't tell if it had shutdown or simply switched off the screen.
I next tried disconnecting the Raspberry Pi's power cord but leaving the USB cable connected and this time the OneShot script didn't halt ie. it worked as if the cable were not connected. This seems a vital clue
I'm guessing you are still getting power from the Raspberry Pi's USB port even though the Pi is "off".
And I think you're right but it can't be the positive wire because it's disconnected by a relay so Pi is not switched on.. could there be a path to ground through the USB cable AND the power cable?
I had a problem like this a while back when I tried using a low side, N channel Mosfet instead of a relay.. The Mosfet would turn the camera on once but wouldn't go off again. Eventually I figured out that pulling the USB cable out shut the camera down.
I'm sure I can add a relay to disconnect the ground wire of the Pi as well as the positive wire, to work around this.
However, I just found another issue.. with the WAIT option enabled as in the second example above, the Pi can connect to the IXUS using chdkptp but after this, any command gets the following result:
root@piZero5:~# chdkptp/chdkptp.sh
___> connect
connected: Canon IXUS 160, max packet size 512
con> rec
ERROR: a script is already running
con>
Any suggestions?
Thanks in advance
Sdack