From 9ea2b89fde8bfdd7b4bd59875a57615cfd1ef734 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Thu, 31 Aug 2006 07:05:31 +0000 Subject: [PATCH] handle cases where we just have objects, but no root object or no DCIM directory. attach all those objects to / git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@9130 67ed7778-7388-44ab-90cf-0a291f65f57c --- camlibs/ptp2/ChangeLog | 5 +++++ camlibs/ptp2/library.c | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/camlibs/ptp2/ChangeLog b/camlibs/ptp2/ChangeLog index bbca87595..e59f925ec 100644 --- a/camlibs/ptp2/ChangeLog +++ b/camlibs/ptp2/ChangeLog @@ -1,3 +1,8 @@ +2006-08-31 Marcus Meissner + + * library.c: Handle cameras which just have files, but no + directory or root object. Kodak EasyShare C330 for instance. + 2006-08-30 Marcus Meissner * library.c: Added iRiver Clix. diff --git a/camlibs/ptp2/library.c b/camlibs/ptp2/library.c index b35575133..c46bbf5ef 100644 --- a/camlibs/ptp2/library.c +++ b/camlibs/ptp2/library.c @@ -3241,9 +3241,27 @@ fallback: GP_DEBUG("Changing DCIM ParentObject ID from 0x%x to 0", oi->ParentObject); oi->ParentObject = 0; + nroot++; } } } + /* Some cameras do not have a directory at all, just files or unattached + * directories. In this case associate all unattached to the 0 object. + */ + if (nroot == 0) { + /* look for entries with parentobjects that do not exist */ + for (i = 0; i < params->handles.n; i++) + { + int j; + PTPObjectInfo *oi = ¶ms->objectinfo[i]; + + for (j = 0;j < params->handles.n; j++) + if (oi->ParentObject == params->handles.Handler[j]) + break; + if (j == params->handles.n) + oi->ParentObject = 0; + } + } } #if 0 add_dir (camera, 0x00000000, 0xff000000, "DIR1");