summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Meissner <marcus@jet.franken.de>2014-03-22 18:53:18 +0000
committerMarcus Meissner <marcus@jet.franken.de>2014-03-22 18:53:18 +0000
commitbbe310673812295937185ebd95ab98527970f260 (patch)
treeabdddea1b17de3f8a1df8ac30a2a00bb14d76100
parent068a1c871bf96a93dd920d17828803e7873e9253 (diff)
downloadlibgphoto2-bbe310673812295937185ebd95ab98527970f260.tar.gz
EOS camerastatus switching to 0 can be interpreted as "capture complete"
try not to enter endless loops git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@14841 67ed7778-7388-44ab-90cf-0a291f65f57c
-rw-r--r--camlibs/ptp2/config.c1
-rw-r--r--camlibs/ptp2/library.c12
2 files changed, 12 insertions, 1 deletions
diff --git a/camlibs/ptp2/config.c b/camlibs/ptp2/config.c
index b69afe1b7..a2dd6ac70 100644
--- a/camlibs/ptp2/config.c
+++ b/camlibs/ptp2/config.c
@@ -271,6 +271,7 @@ camera_prepare_canon_eos_capture(Camera *camera, GPContext *context) {
gp_log (GP_LOG_ERROR,"ptp2_prepare_eos_capture", "seteventmode 1 failed!");
return translate_ptp_result (ret);
}
+ params->eos_camerastatus = -1; /* aka unknown */
/* Get the initial bulk set of event data */
ret = ptp_check_eos_events (params);
diff --git a/camlibs/ptp2/library.c b/camlibs/ptp2/library.c
index a596c2bef..ff7febb2e 100644
--- a/camlibs/ptp2/library.c
+++ b/camlibs/ptp2/library.c
@@ -3562,6 +3562,7 @@ camera_trigger_capture (Camera *camera, GPContext *context)
if ((params->deviceinfo.VendorExtensionID == PTP_VENDOR_CANON) &&
ptp_operation_issupported(params, PTP_OC_CANON_EOS_RemoteRelease)) {
uint32_t result;
+ int tries = 10;
if (!params->eos_captureenabled)
camera_prepare_capture (camera, context);
@@ -3604,7 +3605,9 @@ camera_trigger_capture (Camera *camera, GPContext *context)
ret = ptp_check_eos_events (params);
if (ret != PTP_RC_OK)
break;
- } while (params->eos_camerastatus == 0);
+ usleep(2000);
+ gp_log (GP_LOG_DEBUG, "ptp2/eos_trigger", "eos_camerastatus is %d", params->eos_camerastatus);
+ } while (tries-- && (params->eos_camerastatus != 1));
return GP_OK;
}
@@ -3835,6 +3838,13 @@ camera_wait_for_event (Camera *camera, int timeout,
}
case PTP_CANON_EOS_CHANGES_TYPE_CAMERASTATUS: {
char *x;
+
+ /* if we do capture stuff, camerastatus will turn to 0 when done */
+ if (!entry.u.status) {
+ *eventtype = GP_EVENT_CAPTURE_COMPLETE;
+ *eventdata = NULL;
+ return;
+ }
x = malloc(strlen("Camera Status 123456789012345")+1);
if (x) {
sprintf (x, "Camera Status %d", entry.u.status);