From: <mar...@us...> - 2010-01-28 09:26:28
|
Revision: 12661 http://gphoto.svn.sourceforge.net/gphoto/?rev=12661&view=rev Author: marcusmeissner Date: 2010-01-28 09:26:16 +0000 (Thu, 28 Jan 2010) Log Message: ----------- fixed eos preview timeout issues Modified Paths: -------------- trunk/libgphoto2/camlibs/ptp2/library.c Modified: trunk/libgphoto2/camlibs/ptp2/library.c =================================================================== --- trunk/libgphoto2/camlibs/ptp2/library.c 2010-01-28 08:42:42 UTC (rev 12660) +++ trunk/libgphoto2/camlibs/ptp2/library.c 2010-01-28 09:26:16 UTC (rev 12661) @@ -1454,19 +1454,25 @@ /* Canon EOS DSLR preview mode */ if (ptp_operation_issupported(&camera->pl->params, PTP_OC_CANON_EOS_GetViewFinderData)) { PTPPropertyValue val; - int tries = 20; + int tries = 20; + PTPDevicePropDesc dpd; SET_CONTEXT_P(params, context); if (!params->eos_captureenabled) camera_prepare_capture (camera, context); - /* 2 means PC, 1 means TFT */ - val.u32 = 2; - ret = ptp_canon_eos_setdevicepropvalue (params, PTP_DPC_CANON_EOS_EVFOutputDevice, &val, PTP_DTC_UINT32); - if (ret != PTP_RC_OK) { - gp_log (GP_LOG_ERROR,"ptp2_prepare_eos_preview", "setval of evf outputmode to 2 failed!"); - return GP_ERROR; + /* do not set it everytime, it will cause delays */ + ret = ptp_canon_eos_getdevicepropdesc (params, PTP_DPC_CANON_EOS_EVFOutputDevice, &dpd); + if ((ret != PTP_RC_OK) || (dpd.CurrentValue.u32 != 2)) { + /* 2 means PC, 1 means TFT */ + val.u32 = 2; + ret = ptp_canon_eos_setdevicepropvalue (params, PTP_DPC_CANON_EOS_EVFOutputDevice, &val, PTP_DTC_UINT32); + if (ret != PTP_RC_OK) { + gp_log (GP_LOG_ERROR,"ptp2_prepare_eos_preview", "setval of evf outputmode to 2 failed!"); + return GP_ERROR; + } } + while (tries--) { ret = ptp_canon_eos_get_viewfinder_image (params , &data, &size); if (ret == PTP_RC_OK) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |