summaryrefslogtreecommitdiff
path: root/camlibs
diff options
context:
space:
mode:
authorMarcus Meissner <marcus@jet.franken.de>2021-10-04 13:52:47 +0200
committerMarcus Meissner <marcus@jet.franken.de>2021-10-04 13:52:47 +0200
commitbacd4128617e1dd613998c0268ded8304cef6f19 (patch)
tree54d2f51b3ddf54d7d03e533a8923f66a2106e65b /camlibs
parent12f59ff596e3b32af37e4455127df80d0f6b00b5 (diff)
downloadlibgphoto2-bacd4128617e1dd613998c0268ded8304cef6f19.tar.gz
emit only matching resetuilock if we did setuilock
Diffstat (limited to 'camlibs')
-rw-r--r--camlibs/ptp2/config.c29
-rw-r--r--camlibs/ptp2/library.c6
-rw-r--r--camlibs/ptp2/ptp.h1
3 files changed, 26 insertions, 10 deletions
diff --git a/camlibs/ptp2/config.c b/camlibs/ptp2/config.c
index 119978fa9..f89430279 100644
--- a/camlibs/ptp2/config.c
+++ b/camlibs/ptp2/config.c
@@ -350,6 +350,7 @@ camera_canon_eos_update_capture_target(Camera *camera, GPContext *context, int v
"setdevicepropvalue of capturetarget to 0x%x failed", ct_val.u32);
if (ct_val.u32 == PTP_CANON_EOS_CAPTUREDEST_HD) {
uint16_t ret;
+ int uilocked = params->uilocked;
/* if we want to download the image from the device, we need to tell the camera
* that we have enough space left. */
@@ -357,9 +358,11 @@ camera_canon_eos_update_capture_target(Camera *camera, GPContext *context, int v
ret = ptp_canon_eos_pchddcapacity(params, 0x7fffffff, 0x00001000, 0x00000001);
*/
- LOG_ON_PTP_E (ptp_canon_eos_setuilock (params));
+ if (!uilocked)
+ LOG_ON_PTP_E (ptp_canon_eos_setuilock (params));
ret = ptp_canon_eos_pchddcapacity(params, 0x0fffffff, 0x00001000, 0x00000001);
- LOG_ON_PTP_E (ptp_canon_eos_resetuilock (params));
+ if (!uilocked)
+ LOG_ON_PTP_E (ptp_canon_eos_resetuilock (params));
/* not so bad if its just busy, would also fail later. */
if (ret == PTP_RC_DeviceBusy) ret = PTP_RC_OK;
C_PTP (ret);
@@ -587,8 +590,12 @@ camera_unprepare_canon_eos_capture(Camera *camera, GPContext *context) {
/* then emits 911b and 911c ... not done yet ... */
CR (camera_canon_eos_update_capture_target(camera, context, 1));
- if (ptp_operation_issupported(&camera->pl->params, PTP_OC_CANON_EOS_ResetUILock))
- LOG_ON_PTP_E (ptp_canon_eos_resetuilock (params));
+ if (ptp_operation_issupported(&camera->pl->params, PTP_OC_CANON_EOS_ResetUILock)) {
+ if (params->uilocked) {
+ LOG_ON_PTP_E (ptp_canon_eos_resetuilock (params));
+ params->uilocked = 0;
+ }
+ }
/* Drain the rest set of the event data */
C_PTP (ptp_check_eos_events (params));
@@ -9233,10 +9240,16 @@ _put_Canon_EOS_UILock(CONFIG_PUT_ARGS)
GPContext *context = ((PTPData *) params->data)->context;
CR (gp_widget_get_value(widget, &val));
- if (val)
- C_PTP_REP (ptp_canon_eos_setuilock (params));
- else
- C_PTP_REP (ptp_canon_eos_resetuilock (params));
+
+ if (val) {
+ if (!params->uilocked)
+ C_PTP_REP (ptp_canon_eos_setuilock (params));
+ params->uilocked = 1;
+ } else {
+ if (params->uilocked)
+ C_PTP_REP (ptp_canon_eos_resetuilock (params));
+ params->uilocked = 0;
+ }
return GP_OK;
}
diff --git a/camlibs/ptp2/library.c b/camlibs/ptp2/library.c
index 770fb9d70..c271317e7 100644
--- a/camlibs/ptp2/library.c
+++ b/camlibs/ptp2/library.c
@@ -5857,9 +5857,11 @@ camera_trigger_canon_eos_capture (Camera *camera, GPContext *context)
C_PTP (ptp_canon_eos_getdevicepropdesc (params, PTP_DPC_CANON_EOS_AvailableShots, &dpd));
if (dpd.CurrentValue.u32 < 100) {
/* Tell the camera we have enough free space on the PC */
- ptp_canon_eos_setuilock(params);
+ if (!params->uilocked)
+ ptp_canon_eos_setuilock(params);
LOG_ON_PTP_E (ptp_canon_eos_pchddcapacity(params, 0x0fffffff, 0x00001000, 0x00000001));
- ptp_canon_eos_resetuilock(params);
+ if (!params->uilocked)
+ ptp_canon_eos_resetuilock(params);
}
}
}
diff --git a/camlibs/ptp2/ptp.h b/camlibs/ptp2/ptp.h
index 29f099065..3a15fb568 100644
--- a/camlibs/ptp2/ptp.h
+++ b/camlibs/ptp2/ptp.h
@@ -3784,6 +3784,7 @@ struct _PTPParams {
unsigned int nrofcanon_props;
int canon_viewfinder_on;
int canon_event_mode;
+ int uilocked;
/* PTP: Canon EOS event queue */
PTPCanon_changes_entry *backlogentries;