From: <mar...@us...> - 2009-01-18 22:42:55
|
Revision: 11725 http://gphoto.svn.sourceforge.net/gphoto/?rev=11725&view=rev Author: marcusmeissner Date: 2009-01-18 21:38:41 +0000 (Sun, 18 Jan 2009) Log Message: ----------- fixed canon capture to card mode. Modified Paths: -------------- trunk/libgphoto2/camlibs/ptp2/ChangeLog trunk/libgphoto2/camlibs/ptp2/config.c trunk/libgphoto2/camlibs/ptp2/library.c trunk/libgphoto2/camlibs/ptp2/ptp.h Modified: trunk/libgphoto2/camlibs/ptp2/ChangeLog =================================================================== --- trunk/libgphoto2/camlibs/ptp2/ChangeLog 2009-01-18 21:26:57 UTC (rev 11724) +++ trunk/libgphoto2/camlibs/ptp2/ChangeLog 2009-01-18 21:38:41 UTC (rev 11725) @@ -1,3 +1,11 @@ +2009-01-18 Marcus Meissner <ma...@je...> + + * library.c: Fixed stupid bug in "canon capture to card" mode. + + * ptp.c,ptp.h,config.c: PTP Nikon AfDrive (Nikon DSLR). (not doing much) + + * ptp.c, config.c: Various additions of missing config values. + 2009-01-15 Marcus Meissner <ma...@je...> * config.c: Enable viewfinder in enable capture for Powershots, Modified: trunk/libgphoto2/camlibs/ptp2/config.c =================================================================== --- trunk/libgphoto2/camlibs/ptp2/config.c 2009-01-18 21:26:57 UTC (rev 11724) +++ trunk/libgphoto2/camlibs/ptp2/config.c 2009-01-18 21:38:41 UTC (rev 11725) @@ -85,22 +85,22 @@ propval.u16=1; ret = ptp_setdevicepropvalue(params, PTP_DPC_CANON_EventEmulateMode, &propval, PTP_DTC_UINT16); ret = ptp_getdevicepropvalue(params, PTP_DPC_CANON_SizeOfOutputDataFromCamera, &propval, PTP_DTC_UINT32); - gp_log (GP_LOG_DEBUG, "ptp", "prop PTP_DPC_CANON_SizeOfOutputDataFromCamera value is 0x%8X, ret %d\n",propval.u32, ret); + gp_log (GP_LOG_DEBUG, "ptp", "prop PTP_DPC_CANON_SizeOfOutputDataFromCamera value is 0x%8X, ret 0x%x\n",propval.u32, ret); ret = ptp_getdevicepropvalue(params, PTP_DPC_CANON_SizeOfInputDataToCamera, &propval, PTP_DTC_UINT32); - gp_log (GP_LOG_DEBUG, "ptp", "prop PTP_DPC_CANON_SizeOfInputDataToCamera value is 0x%8X, ret %d\n",propval.u32, ret); + gp_log (GP_LOG_DEBUG, "ptp", "prop PTP_DPC_CANON_SizeOfInputDataToCamera value is 0x%8X, ret 0x%x\n",propval.u32, ret); ret = ptp_getdeviceinfo (params, ¶ms->deviceinfo); ret = ptp_getdeviceinfo (params, ¶ms->deviceinfo); fixup_cached_deviceinfo (camera, ¶ms->deviceinfo); ret = ptp_getdevicepropvalue(params, PTP_DPC_CANON_SizeOfOutputDataFromCamera, &propval, PTP_DTC_UINT32); - gp_log (GP_LOG_DEBUG, "ptp", "prop PTP_DPC_CANON_SizeOfOutputDataFromCamera value is 0x%8x, ret %d\n",propval.u32, ret); + gp_log (GP_LOG_DEBUG, "ptp", "prop PTP_DPC_CANON_SizeOfOutputDataFromCamera value is 0x%8x, ret 0x%x\n",propval.u32, ret); ret = ptp_getdevicepropvalue(params, PTP_DPC_CANON_SizeOfInputDataToCamera, &propval, PTP_DTC_UINT32); - gp_log (GP_LOG_DEBUG, "ptp", "prop PTP_DPC_CANON_SizeOfInputDataToCamera value is 0x%8X, ret %d\n",propval.u32,ret); + gp_log (GP_LOG_DEBUG, "ptp", "prop PTP_DPC_CANON_SizeOfInputDataToCamera value is 0x%8X, ret x0%x\n",propval.u32,ret); ret = ptp_getdeviceinfo (params, ¶ms->deviceinfo); fixup_cached_deviceinfo (camera, ¶ms->deviceinfo); ret = ptp_getdevicepropvalue(params, PTP_DPC_CANON_EventEmulateMode, &propval, PTP_DTC_UINT16); - gp_log (GP_LOG_DEBUG, "ptp","prop 0xd045 value is 0x%4x, ret %d\n",propval.u16,ret); + gp_log (GP_LOG_DEBUG, "ptp","prop 0xd045 value is 0x%4x, ret 0x%x\n",propval.u16,ret); gp_log (GP_LOG_DEBUG, "ptp","Magic code ends.\n"); Modified: trunk/libgphoto2/camlibs/ptp2/library.c =================================================================== --- trunk/libgphoto2/camlibs/ptp2/library.c 2009-01-18 21:26:57 UTC (rev 11724) +++ trunk/libgphoto2/camlibs/ptp2/library.c 2009-01-18 21:38:41 UTC (rev 11725) @@ -1570,7 +1570,7 @@ } static int -add_objectid_to_gphotofs(Camera *camera, CameraFilePath *path, GPContext *context, +add_objectid_and_upload (Camera *camera, CameraFilePath *path, GPContext *context, uint32_t newobject, PTPObjectInfo *oi) { int ret; PTPParams *params = &camera->pl->params; @@ -1585,19 +1585,19 @@ set_mimetype (camera, file, params->deviceinfo.VendorExtensionID, oi->ObjectFormat); CPR (context, ptp_getobject(params, newobject, &ximage)); - gp_log (GP_LOG_DEBUG, "ptp/add_objectid_to_gphotofs", "setting size"); + gp_log (GP_LOG_DEBUG, "ptp/add_objectid_and_upload", "setting size"); ret = gp_file_set_data_and_size(file, (char*)ximage, oi->ObjectCompressedSize); if (ret != GP_OK) { gp_file_free (file); return ret; } - gp_log (GP_LOG_DEBUG, "ptp/add_objectid_to_gphotofs", "append to fs"); + gp_log (GP_LOG_DEBUG, "ptp/add_objectid_and_upload", "append to fs"); ret = gp_filesystem_append(camera->fs, path->folder, path->name, context); if (ret != GP_OK) { gp_file_free (file); return ret; } - gp_log (GP_LOG_DEBUG, "ptp/add_objectid_to_gphotofs", "adding filedata to fs"); + gp_log (GP_LOG_DEBUG, "ptp/add_objectid_and_upload", "adding filedata to fs"); ret = gp_filesystem_set_file_noop(camera->fs, path->folder, file, context); if (ret != GP_OK) { gp_file_free (file); @@ -1622,7 +1622,7 @@ info.preview.width = oi->ThumbPixWidth; info.preview.height = oi->ThumbPixHeight; info.preview.size = oi->ThumbCompressedSize; - gp_log (GP_LOG_DEBUG, "ptp/add_objectid_to_gphotofs", "setting fileinfo in fs"); + gp_log (GP_LOG_DEBUG, "ptp/add_objectid_and_upload", "setting fileinfo in fs"); return gp_filesystem_set_info_noop(camera->fs, path->folder, info, context); } @@ -1728,7 +1728,7 @@ oi.StorageID = 0x00010001; sprintf (path->folder,"/"STORAGE_FOLDER_PREFIX"%08lx",(unsigned long)oi.StorageID); sprintf (path->name, "capt%04d.jpg", capcnt++); - ret = add_objectid_to_gphotofs(camera, path, context, newobject, &oi); + ret = add_objectid_and_upload (camera, path, context, newobject, &oi); if (ret != GP_OK) { fprintf (stderr, "failed to add object\n"); return ret; @@ -1969,14 +1969,14 @@ get_folder_from_handle (camera, oi.StorageID, oi.ParentObject, path->folder); /* delete last / or we get confused later. */ path->folder[ strlen(path->folder)-1 ] = '\0'; - return GP_OK; + return gp_filesystem_append (camera->fs, path->folder, path->name, context); } else { if (xmode == CANON_TRANSFER_CARD) { fprintf (stderr,"parentobject is 0, but not in memory mode?\n"); } sprintf (path->folder,"/"STORAGE_FOLDER_PREFIX"%08lx",(unsigned long)oi.StorageID); sprintf (path->name, "capt%04d.jpg", capcnt++); - return add_objectid_to_gphotofs(camera, path, context, newobject, &oi); + return add_objectid_and_upload (camera, path, context, newobject, &oi); } } @@ -1998,7 +1998,7 @@ if ( (params->deviceinfo.VendorExtensionID == PTP_VENDOR_NIKON) && ptp_operation_issupported(params, PTP_OC_NIKON_Capture) - ){ + ) { char buf[1024]; if ((GP_OK != gp_setting_get("ptp2","capturetarget",buf)) || !strcmp(buf,"sdram")) return camera_nikon_capture (camera, type, path, context); @@ -2141,8 +2141,7 @@ get_folder_from_handle (camera, obinfo->StorageID, obinfo->ParentObject, path->folder); /* delete last / or we get confused later. */ path->folder[ strlen(path->folder)-1 ] = '\0'; - CR (gp_filesystem_append (camera->fs, path->folder, - path->name, context)); + CR (gp_filesystem_append (camera->fs, path->folder, path->name, context)); break; } } Modified: trunk/libgphoto2/camlibs/ptp2/ptp.h =================================================================== --- trunk/libgphoto2/camlibs/ptp2/ptp.h 2009-01-18 21:26:57 UTC (rev 11724) +++ trunk/libgphoto2/camlibs/ptp2/ptp.h 2009-01-18 21:38:41 UTC (rev 11725) @@ -508,6 +508,9 @@ /* Nikon specific response codes */ #define PTP_RC_NIKON_AdvancedTransferCancel 0xA022 +/* Canon specific response codes */ +#define PTP_RC_CANON_A009 0xA009 + /* Microsoft/MTP specific codes */ #define PTP_RC_MTP_Undefined 0xA800 #define PTP_RC_MTP_Invalid_ObjectPropCode 0xA801 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |