From 3712a5f70a70f4aaecfe34eb764a615ff2a89af2 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Tue, 2 Mar 2010 23:01:53 +0000 Subject: [PATCH] moved eos bulb fixes from 2.4 branch to here git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@12726 67ed7778-7388-44ab-90cf-0a291f65f57c --- camlibs/ptp2/config.c | 4 ++-- camlibs/ptp2/ptp.c | 50 +++++++++++++++++++++++++++++++++++++++++++ camlibs/ptp2/ptp.h | 4 ++-- 3 files changed, 54 insertions(+), 4 deletions(-) diff --git a/camlibs/ptp2/config.c b/camlibs/ptp2/config.c index 41ef2532a..12f651782 100644 --- a/camlibs/ptp2/config.c +++ b/camlibs/ptp2/config.c @@ -3627,9 +3627,9 @@ _put_Canon_EOS_Bulb(CONFIG_PUT_ARGS) if (ret != GP_OK) return ret; if (val) - ret = ptp_canon_eos_bulbstart (params); + ret = ptp_canon_eos_bulbstart (params, 1); else - ret = ptp_canon_eos_bulbend (params); + ret = ptp_canon_eos_bulbend (params, 1); if (ret == PTP_RC_OK) return (GP_OK); if (val && (ret == PTP_RC_GeneralError)) diff --git a/camlibs/ptp2/ptp.c b/camlibs/ptp2/ptp.c index 4a4aa05d2..d951dc24f 100644 --- a/camlibs/ptp2/ptp.c +++ b/camlibs/ptp2/ptp.c @@ -711,6 +711,56 @@ ptp_getnumobjects (PTPParams* params, uint32_t storage, return ret; } +/** + * ptp_eos_bulbstart: + * params: PTPParams* + * val - uint16_t unknown argument (1) + * + * Starts EOS Bulb capture. + * + * Return values: Some PTP_RC_* code. + **/ +uint16_t +ptp_canon_eos_bulbstart (PTPParams* params, uint16_t val) +{ + uint16_t ret; + PTPContainer ptp; + + PTP_CNT_INIT(ptp); + ptp.Code = PTP_OC_CANON_EOS_BulbStart; + ptp.Nparam = 1; + ptp.Param1 = val; + ret = ptp_transaction(params, &ptp, PTP_DP_NODATA, 0, NULL, NULL); + if ((ret == PTP_RC_OK) && (ptp.Nparam >= 1) && ((ptp.Param1 & 0x7000) == 0x2000)) + ret = ptp.Param1; + return ret; +} + +/** + * ptp_canon_eos_bulbend: + * params: PTPParams* + * val - uint16_t unknown argument (1) + * + * Starts EOS Bulb capture. + * + * Return values: Some PTP_RC_* code. + **/ +uint16_t +ptp_canon_eos_bulbend (PTPParams* params, uint16_t val) +{ + uint16_t ret; + PTPContainer ptp; + + PTP_CNT_INIT(ptp); + ptp.Code = PTP_OC_CANON_EOS_BulbEnd; + ptp.Nparam = 1; + ptp.Param1 = val; + ret = ptp_transaction(params, &ptp, PTP_DP_NODATA, 0, NULL, NULL); + if ((ret == PTP_RC_OK) && (ptp.Nparam >= 1) && ((ptp.Param1 & 0x7000) == 0x2000)) + ret = ptp.Param1; + return ret; +} + /** * ptp_getobjectinfo: * params: PTPParams* diff --git a/camlibs/ptp2/ptp.h b/camlibs/ptp2/ptp.h index c79f1a1f8..63ac6968c 100644 --- a/camlibs/ptp2/ptp.h +++ b/camlibs/ptp2/ptp.h @@ -2417,8 +2417,8 @@ uint16_t ptp_canon_eos_setdevicepropvalueex (PTPParams* params, unsigned char* d #define ptp_canon_eos_transfercomplete(params,oid) ptp_generic_no_data(params,PTP_OC_CANON_EOS_TransferComplete,1,oid) /* inHDD = %d, inLength =%d, inReset = %d */ #define ptp_canon_eos_pchddcapacity(params,p1,p2,p3) ptp_generic_no_data(params,PTP_OC_CANON_EOS_PCHDDCapacity,3,p1,p2,p3) -#define ptp_canon_eos_bulbstart(params) ptp_generic_no_data(params,PTP_OC_CANON_EOS_BulbStart,1) -#define ptp_canon_eos_bulbend(params) ptp_generic_no_data(params,PTP_OC_CANON_EOS_BulbEnd,1) +uint16_t ptp_canon_eos_bulbstart (PTPParams* params, uint16_t val); +uint16_t ptp_canon_eos_bulbend (PTPParams* params, uint16_t val); uint16_t ptp_canon_eos_getdevicepropdesc (PTPParams* params, uint16_t propcode, PTPDevicePropDesc *devicepropertydesc); uint16_t ptp_canon_eos_setdevicepropvalue (PTPParams* params, uint16_t propcode,