Thank you for this great idea! Based on the suggestion about the wait-event parameter I played a little round and found a solution with capture-tethered and the hook scripts. As a result I take a picture with the camera and the raspberry pi takes the other 4 pictures afterwards.
For anyone who is interested, I used the above setup and modified following scripts:
/etc/rc.local added the line
/usr/local/bin/HDR.sh &
The file /usr/local/bin/HDR.sh:
!/bin/sh
loop forever
cd /tmp
while [ true ]
do
Wait for camera to be turned on
by checking USB
DEVICE=$(gphoto2 --auto-detect | grep usb | cut -b 36-42 | sed 's/,/\//')
while [ -z ${DEVICE} ]
do
sleep 1
DEVICE=$(gphoto2 --auto-detect | grep usb | cut -b 36-42 | sed 's/,/\//')
done
loop for all photos to be taken until camera is switched off or so
until [ $? -ne 0 ]
do
wait for the first photo
gphoto2 --capture-tethered --hook-script /usr/local/bin/hook.sh
do the other photos
gphoto2 --set-config capturetarget=1 \
--set-config-value /main/capturesettings/exposurecompensation=-2000 \
--capture-image \
--set-config-value /main/capturesettings/exposurecompensation=-4000 \
--capture-image \
--set-config-value /main/capturesettings/exposurecompensation=2000 \
--capture-image \
--set-config-value /main/capturesettings/exposurecompensation=4000 \
--capture-image \
--set-config-value /main/capturesettings/exposurecompensation=0
done
done
and finally the file /usr/local/bin/hook.sh:
!/bin/sh
case "$ACTION" in
delete downloaded file and kill gphoto, so original script can continue
download)
rm $ARGUMENT
kill $(pidof gphoto2)
;;
*)
;;
esac
exit 0