diff options
author | Marcus Meissner <meissner@suse.de> | 2017-03-18 08:58:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-18 08:58:10 +0100 |
commit | 61b45c53f487626315733cdce640ca4e1d6c78fd (patch) | |
tree | c12ca1b7e052a2c3a0c4517ec92903a838df7b17 | |
parent | fa69f94596830a007e0d54436b877d5658058265 (diff) | |
parent | ae93b58d9c578c8e1507459cac73a3e65b1fb9b0 (diff) | |
download | libgphoto2-61b45c53f487626315733cdce640ca4e1d6c78fd.tar.gz |
Merge pull request #144 from Kev-J/master
Change PTP waif_for_event() timeout management for standard cameras
-rw-r--r-- | camlibs/ptp2/library.c | 21 | ||||
-rw-r--r-- | camlibs/ptp2/usb.c | 3 |
2 files changed, 14 insertions, 10 deletions
diff --git a/camlibs/ptp2/library.c b/camlibs/ptp2/library.c index cc3d75796..c4b10671b 100644 --- a/camlibs/ptp2/library.c +++ b/camlibs/ptp2/library.c @@ -4591,6 +4591,7 @@ camera_wait_for_event (Camera *camera, int timeout, (ptp_operation_issupported(params, PTP_OC_CANON_EOS_RemoteRelease) || ptp_operation_issupported(params, PTP_OC_CANON_EOS_RemoteReleaseOn)) ) { + if (!params->eos_captureenabled) camera_prepare_capture (camera, context); do { @@ -5004,16 +5005,18 @@ downloadnow: } sonyout: - C_PTP_REP (ptp_check_event(params)); - if (!ptp_get_one_event (params, &event)) { + do { + C_PTP_REP (ptp_check_event(params)); + /* FIXME: Might be another error, but usually is a timeout */ - GP_LOG_D ("no events received."); - *eventtype = GP_EVENT_TIMEOUT; - return GP_OK; - } - GP_LOG_D ("code=0x%04x, param1 0x%08x", - event.Code, event.Param1 - ); + if (ptp_get_one_event (params, &event)) { + goto handleregular; + } + + } while (waiting_for_timeout(&back_off_wait, event_start, timeout)); + + *eventtype = GP_EVENT_TIMEOUT; + return GP_OK; handleregular: if (params->deviceinfo.VendorExtensionID == PTP_VENDOR_SONY) { switch (event.Code) { diff --git a/camlibs/ptp2/usb.c b/camlibs/ptp2/usb.c index 4e1f704fd..56806164f 100644 --- a/camlibs/ptp2/usb.c +++ b/camlibs/ptp2/usb.c @@ -534,7 +534,8 @@ ptp_usb_event (PTPParams* params, PTPContainer* event, int wait) return PTP_ERROR_BADPARAM; } if (result < 0) { - GP_LOG_E ("Reading PTP event failed: %s (%d)", gp_port_result_as_string(result), result); + if ((result != GP_ERROR_TIMEOUT) || (wait != PTP_EVENT_CHECK_FAST)) + GP_LOG_E ("Reading PTP event failed: %s (%d)", gp_port_result_as_string(result), result); if (result == GP_ERROR_TIMEOUT) return PTP_ERROR_TIMEOUT; return PTP_ERROR_IO; |