summaryrefslogtreecommitdiff
path: root/camlibs
diff options
context:
space:
mode:
authorMarcus Meissner <marcus@jet.franken.de>2023-01-17 15:33:49 +0100
committerMarcus Meissner <marcus@jet.franken.de>2023-01-17 15:33:49 +0100
commit3249cf6e65dd33da1559c5a0319e63993ea2e2a0 (patch)
tree808c55bd86f13d63d0a389e731a23a6284fd84ba /camlibs
parent0a393415623ce65f2d01440059a99cd5a952d048 (diff)
downloadlibgphoto2-3249cf6e65dd33da1559c5a0319e63993ea2e2a0.tar.gz
canon eos: if half press succeeds, and full press fails, roll back half-press again
might help https://github.com/gphoto/gphoto2/issues/538
Diffstat (limited to 'camlibs')
-rw-r--r--camlibs/ptp2/library.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/camlibs/ptp2/library.c b/camlibs/ptp2/library.c
index 4d4307f82..8e17aa85b 100644
--- a/camlibs/ptp2/library.c
+++ b/camlibs/ptp2/library.c
@@ -5915,7 +5915,8 @@ camera_trigger_canon_eos_capture (Camera *camera, GPContext *context)
if (ptp_operation_issupported(params, PTP_OC_CANON_EOS_RemoteReleaseOn)) {
if (!is_canon_eos_m (params)) {
/* Regular EOS */
- int manualfocus = 0, foundfocusinfo = 0;
+ uint16_t res;
+ int manualfocus = 0, foundfocusinfo = 0;
/* are we in manual focus mode ... value would be 3 */
if (PTP_RC_OK == ptp_canon_eos_getdevicepropdesc (params, PTP_DPC_CANON_EOS_FocusMode, &dpd)) {
@@ -5976,7 +5977,16 @@ camera_trigger_canon_eos_capture (Camera *camera, GPContext *context)
}
/* full press now */
- C_PTP_REP_MSG (ptp_canon_eos_remotereleaseon (params, 2, 0), _("Canon EOS Full-Press failed"));
+ res = LOG_ON_PTP_E (ptp_canon_eos_remotereleaseon (params, 2, 0));
+ if (res != PTP_RC_OK) {
+ /* if the Full Press failed, try to roll back the release and do not exit Half-Pressed. */
+ ptp_check_eos_events (params);
+ C_PTP_REP_MSG (ptp_canon_eos_remotereleaseoff (params, 1), _("Canon EOS Half-Release failed"));
+ ptp_check_eos_events (params);
+ C_PTP_REP_MSG (res, _("Canon EOS Full-Press failed"));
+ /* safety, should not arrive here */
+ return GP_ERROR;
+ }
/* no event check between */
/* full release now */
C_PTP_REP_MSG (ptp_canon_eos_remotereleaseoff (params, 2), _("Canon EOS Full-Release failed"));