- 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
This commit is contained in:
Marcus Meissner
2009-07-22 07:46:01 +00:00
parent 2dc951878f
commit f69afb3cc5
2 changed files with 7 additions and 1 deletions

View File

@@ -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);

View File

@@ -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, &params->objects[i].oi);
if (!ob->oi.Filename) ob->oi.Filename=strdup("<none>");
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. */