From f69afb3cc5db73594a7de19e71cfa67cb721e863 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Wed, 22 Jul 2009 07:46:01 +0000 Subject: [PATCH] - if parent is linking back to us, set it to 0 to avoid recursion - read the / object ids to avoid "dcim wrong root" bugs git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@12248 67ed7778-7388-44ab-90cf-0a291f65f57c --- camlibs/ptp2/library.c | 2 ++ camlibs/ptp2/ptp.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/camlibs/ptp2/library.c b/camlibs/ptp2/library.c index a2b4413c8..04415e8d6 100644 --- a/camlibs/ptp2/library.c +++ b/camlibs/ptp2/library.c @@ -5063,6 +5063,8 @@ camera_init (Camera *camera, GPContext *context) default: break; } + /* read the root directory to avoid the "DCIM WRONG ROOT" bugs */ + ptp_list_folder (params, PTP_HANDLER_SPECIAL, 0); CR (gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera)); SET_CONTEXT(camera, NULL); return (GP_OK); diff --git a/camlibs/ptp2/ptp.c b/camlibs/ptp2/ptp.c index 0bdab0f58..6658145eb 100644 --- a/camlibs/ptp2/ptp.c +++ b/camlibs/ptp2/ptp.c @@ -4813,16 +4813,20 @@ ptp_object_want (PTPParams *params, uint32_t handle, int want, PTPObject **retob if ((want & X) && ((ob->flags & X) != X)) { uint32_t saveparent; + /* One EOS issue, where getobjecthandles(root) returns obs without root flag. */ if (ob->flags & PTPOBJECT_PARENTOBJECT_LOADED) saveparent = ob->oi.ParentObject; ret = ptp_getobjectinfo (params, handle, &ob->oi); if (ret != PTP_RC_OK) return ret; - //debug_objectinfo(params, handle, ¶ms->objects[i].oi); if (!ob->oi.Filename) ob->oi.Filename=strdup(""); if (ob->flags & PTPOBJECT_PARENTOBJECT_LOADED) ob->oi.ParentObject = saveparent; + + /* Second EOS issue, 0x20000000 has 0x20000000 as parent */ + if (ob->oi.ParentObject == handle) + ob->oi.ParentObject = 0; ob->flags |= X; /* EOS bug, DCIM links back to itself. */