From ef9c24aef04aef3b566db8728dcd808ecf56a801 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Sun, 7 Dec 2014 15:13:38 +0000 Subject: [PATCH] follow the enumeration during setting values git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@15260 67ed7778-7388-44ab-90cf-0a291f65f57c --- camlibs/ptp2/config.c | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/camlibs/ptp2/config.c b/camlibs/ptp2/config.c index 67284a646..4f734000c 100644 --- a/camlibs/ptp2/config.c +++ b/camlibs/ptp2/config.c @@ -2290,14 +2290,35 @@ _set_sony_value_u32 (PTPParams*params, uint16_t prop, uint32_t value) { GP_LOG_D("setting 0x%04x to 0x%08x", prop, value); - /* FIXME: if it is a enum, go in direction of the enum order (ISO) */ C_PTP_REP (ptp_generic_getdevicepropdesc (params, prop, &dpd)); do { origval = dpd.CurrentValue.u32; - if (value > origval) - propval.u8 = 0x01; - else - propval.u8 = 0xff; + /* if it is a ENUM, the camera will walk through the ENUM */ + if (dpd.FormFlag & PTP_DPFF_Enumeration) { + int i, posorig = -1, posnew = -1; + + for (i=0;i posorig) + propval.u8 = 0x01; + else + propval.u8 = 0xff; + } else { + if (value > origval) + propval.u8 = 0x01; + else + propval.u8 = 0xff; + } C_PTP_REP (ptp_sony_setdevicecontrolvalueb (params, prop, &propval, PTP_DTC_UINT8 )); GP_LOG_D ("value is (0x%x vs target 0x%x)", origval, value);