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. */