From: <mar...@us...> - 2014-11-15 22:32:13
|
Revision: 15246 http://sourceforge.net/p/gphoto/code/15246 Author: marcusmeissner Date: 2014-11-15 22:32:04 +0000 (Sat, 15 Nov 2014) Log Message: ----------- enhance fnumber setting to check for results Modified Paths: -------------- trunk/libgphoto2/camlibs/ptp2/config.c Modified: trunk/libgphoto2/camlibs/ptp2/config.c =================================================================== --- trunk/libgphoto2/camlibs/ptp2/config.c 2014-11-15 15:19:05 UTC (rev 15245) +++ trunk/libgphoto2/camlibs/ptp2/config.c 2014-11-15 22:32:04 UTC (rev 15246) @@ -2463,6 +2463,7 @@ _put_Sony_FNumber(CONFIG_PUT_ARGS) { float fvalue; + time_t start,end; uint16_t origval; PTPPropertyValue value; PTPParams *params = &(camera->pl->params); @@ -2478,9 +2479,21 @@ else value.u8 = 0xff; C_PTP_REP (ptp_sony_setdevicecontrolvalueb (params, PTP_DPC_FNumber, &value, PTP_DTC_UINT8 )); - /* FIXME: value does not change inbetween here for some reason */ - C_PTP_REP (ptp_sony_getalldevicepropdesc (params)); - C_PTP_REP (ptp_generic_getdevicepropdesc (params, PTP_DPC_FNumber, dpd)); + time(&start); + do { + C_PTP_REP (ptp_sony_getalldevicepropdesc (params)); + C_PTP_REP (ptp_generic_getdevicepropdesc (params, PTP_DPC_FNumber, dpd)); + if (dpd->CurrentValue.u16 == fvalue*100) { + GP_LOG_D ("Value matched"); + break; + } + if (dpd->CurrentValue.u16 != origval) { + GP_LOG_D ("value changed (%d vs target %d), proceeding", origval, (int)(fvalue*100)); + break; + } + usleep(200*1000); + time(&end); + } while (end-start <= 3); if (dpd->CurrentValue.u16 == fvalue*100) { GP_LOG_D ("Value matched"); break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |