From cab80c4b1f22efbd55f8a24d7217bbb92be49bf6 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Mon, 31 Mar 2008 07:43:24 +0000 Subject: [PATCH] ptp_eos_getstorageids done correctly and used correctly git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@11060 67ed7778-7388-44ab-90cf-0a291f65f57c --- camlibs/ptp2/ChangeLog | 5 +++++ camlibs/ptp2/config.c | 23 ++++++++--------------- camlibs/ptp2/library.c | 1 + camlibs/ptp2/ptp.c | 13 +++++++------ camlibs/ptp2/ptp.h | 2 +- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/camlibs/ptp2/ChangeLog b/camlibs/ptp2/ChangeLog index 2cfe53ff9..f36a571f9 100644 --- a/camlibs/ptp2/ChangeLog +++ b/camlibs/ptp2/ChangeLog @@ -1,3 +1,8 @@ +2008-03-31 Marcus Meissner + + * ptp.c, ptp.h, config.c: Try to fix EOS capture preparation, + by doing a real ptp_eos_getstorageids. + 2008-03-15 Marcus Meissner * library.c: Adjust for GPPortInfo change. diff --git a/camlibs/ptp2/config.c b/camlibs/ptp2/config.c index e02098190..5701af35c 100644 --- a/camlibs/ptp2/config.c +++ b/camlibs/ptp2/config.c @@ -149,6 +149,7 @@ camera_prepare_canon_eos_capture(Camera *camera, GPContext *context) { PTPCanon_changes_entry *entries = NULL; int nrofentries = 0; unsigned char startup9110[12]; + PTPStorageIDs sids; ret = ptp_canon_eos_setremotemode(params, 1); if (ret != PTP_RC_OK) { @@ -191,25 +192,17 @@ camera_prepare_canon_eos_capture(Camera *camera, GPContext *context) { gp_log (GP_LOG_ERROR,"ptp2_prepare_eos_capture", "getdeviceinfo failed!"); return GP_ERROR; } - ret = ptp_canon_eos_getstorageids(params); + ret = ptp_canon_eos_getstorageids(params, &sids); if (ret != PTP_RC_OK) { gp_log (GP_LOG_ERROR,"ptp2_prepare_eos_capture", "9101 failed!"); return GP_ERROR; } - ret = ptp_canon_eos_getstorageinfo(params, 1); - if (ret != PTP_RC_OK) { - gp_log (GP_LOG_ERROR,"ptp2_prepare_eos_capture", "9102 failed!"); - return GP_ERROR; - } - ret = ptp_canon_eos_getstorageids(params); - if (ret != PTP_RC_OK) { - gp_log (GP_LOG_ERROR,"ptp2_prepare_eos_capture", "9101 failed!"); - return GP_ERROR; - } - ret = ptp_canon_eos_getstorageinfo(params, 1); - if (ret != PTP_RC_OK) { - gp_log (GP_LOG_ERROR,"ptp2_prepare_eos_capture", "9102 failed!"); - return GP_ERROR; + if (sids.n >= 1) { + ret = ptp_canon_eos_getstorageinfo(params, sids.Storage[0]); + if (ret != PTP_RC_OK) { + gp_log (GP_LOG_ERROR,"ptp2_prepare_eos_capture", "9102 failed!"); + return GP_ERROR; + } } /* just exchange the value to 4 */ startup9110[8] = 0x04; startup9110[9] = 0x00; startup9110[10] = 0x00; startup9110[11] = 0x00; diff --git a/camlibs/ptp2/library.c b/camlibs/ptp2/library.c index 26bebb68c..485a7bcd3 100644 --- a/camlibs/ptp2/library.c +++ b/camlibs/ptp2/library.c @@ -1424,6 +1424,7 @@ camera_canon_eos_capture (Camera *camera, CameraCaptureType type, CameraFilePath continue; } for (i=0;i