From cff2889eb2ff4b658b82c4e2516f609b289fb279 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Sun, 24 May 2020 09:04:20 +0200 Subject: refetch storage ids after switching olympus to pc mode... lets see if this helps the filesystem presence --- camlibs/ptp2/library.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/camlibs/ptp2/library.c b/camlibs/ptp2/library.c index 635ce26af..8ff3d0952 100644 --- a/camlibs/ptp2/library.c +++ b/camlibs/ptp2/library.c @@ -8938,9 +8938,27 @@ camera_init (Camera *camera, GPContext *context) } /* moved down here in case the filesystem needs to first be initialized as the Olympus app does */ if (params->deviceinfo.VendorExtensionID == PTP_VENDOR_GP_OLYMPUS_OMD) { + unsigned int k; + GP_LOG_D ("Initializing Olympus ... "); ptp_olympus_init_pc_mode(params); + /* try to refetch the storage ids, set before only has 0x00000001 */ + if (params->storageids.n) { + free (params->storageids.Storage); + params->storageids.Storage = NULL; + params->storageids.n = 0; + } + + C_PTP (ptp_getstorageids(params, ¶ms->storageids)); + + /* refetch root */ + for (k=0;kstorageids.n;k++) { + if (!(params->storageids.Storage[k] & 0xffff)) continue; + if (params->storageids.Storage[k] == 0x80000001) continue; + ptp_list_folder (params, params->storageids.Storage[k], PTP_HANDLER_SPECIAL); + } + /* if(params->storageids.n > 0) { // Olympus app gets storage info for first item, so emulating here PTPStorageInfo storageinfo; @@ -8964,9 +8982,6 @@ camera_init (Camera *camera, GPContext *context) } */ } - - - SET_CONTEXT(camera, NULL); return GP_OK; } -- cgit v1.2.1