Re: Error when downloading image directly from memory card
Peter Sonander <[email protected]> Wed, 24 Nov 2021 14:18:46 +0100
| Newsgroups | gmane.comp.multimedia.gphoto.user |
|---|---|
| Organization | S-Bilder |
| Message-ID | <[email protected]> |
Update! When the error code is 107 there is a 0 byte file created with
the file name of the original file.
/Peter
On 2021-11-21 11:04, Peter Sonander wrote:
> Thanks Marcus for digging into this. These are my findings so far
>
> If I do not initialize the camera file system my self it behaves like
> this:
>
> Before capturing a new photo:
> gp_camera_file_get_info returns 0 for .info.fields
> File is downloaded but returns this 'gp_filesystem_get_file
> (camera->fs, folder, file, type, camera_file, context)' failed: -107
>
> After a photo has been captured:
> gp_camera_file_get_info returns 165 for .info.fields
> File is downloaded with no errors
> When the capture is done you notice there is a full scan of the
> memory card done.
>
>
> If I instead run the code below right after gp_camera_init but before
> setting applicationmode to 1 it works almost all the time. I found
> some cases where if I abort (Ctrl-C) the program and restart where it
> doesn't work, but it always works if I capture a new photo :)
>
> static void init_fs(Camera *camera, GPContext *context, char *path) {
> CameraList *list;
> int i, retval, folderCount;
> const char *value;
>
>
> retval = gp_list_new( &list );
> retval = gp_filesystem_list_folders( camera->fs, path, list,
> context);
> folderCount = gp_list_count( list );
> for (i=0; i<folderCount; i++) {
> gp_list_get_name( list, i, &value );
> char newPath[strlen(path) + strlen(value)];
> strcpy(newPath, path);
> if (strcmp(path, "/")!=0) {
> strcat(newPath, "/");
> }
> strcat(newPath, value);
> init_fs(camera, context, newPath);
> }
> }
>
> called like this: init_fs(camera, context, "/");
>
> All tries to download a photo is done from the GP_EVENT_FILE_CHANGED
> event.
>
> Thanks
> Peter
>
> On 2021-11-20 16:03, Marcus Meissner wrote:
>> Hi,
>>
>> It is actually a more interesting problem...
>>
>> If we switch the camera to application mode, it no longer returns a
>> filesystem.
>>
>> $ gphoto2 --set-config applicationmode=1 --wait-event=1s -L
>> Waiting for 1 seconds for events from camera. Press Ctrl-C to abort.
>> UNKNOWN PTP StoreRemoved, Param1 00010001
>> There is no file in folder '/'.
>> $
>>
>> The storage is "semi visible", e.g. if we access the filehandle from
>> the "changed" event, it can be accessed.
>>
>> But as the filesystem does not see the storage in the storageids
>> index, it cannot find the right path.
>>
>>
>> I need to think a bit on how to handle this... :/
>>
>>
>> (A workaround would be on receipt of "file changed" to switch off
>> application mode, wait for the StoreAdded event, get the file, switch
>> on application mode, and go back to polling.)
>>
>> Ciao, Marcus
>>
>> On Tue, Nov 16, 2021 at 06:40:13PM +0100, Marcus Meissner wrote:
>>> Hi,
>>>
>>> There probably is a bug in the dynamic fileyystem ifc this shows up,
>>> I
>>> am currently travelling, perhaps I can reproduce and take a look at
>>> this
>>> on Thursday.
>>>
>>> Ciao, Marcus
>>> On Sun, Nov 14, 2021 at 05:16:03PM +0100, Peter Sonander wrote:
>>> > Hi
>>> >
>>> > I have created a small C program which is waiting for the file changed event
>>> > and if the file has been write protected it is download to my computer. This
>>> > works if I first take a new photo by pressing the shutter button, but not if
>>> > I start the program and directly protects an image.
>>> >
>>> > When I take the first photo with the program started it looks like there is
>>> > a file system built as a part of the file added event, but this does not
>>> > happen when the file changed event is happening. How can I make the
>>> > filesystem build to happen either on connection established or when I want
>>> > to download a photo?
>>> >
>>> > This is the debug trace when trying to download a photo without first have
>>> > captured an image during the session
>>> >
>>> > nikon eventex 0: code 0x4007, params 1
>>> > event.Code is 4007 / param 921076e
>>> > Sending PTP_OC 0x1008 (Get object info) (0x921076e) request...
>>> > Reading PTP_OC 0x1008 (Get object info) data...
>>> > Reading PTP_OC 0x1008 (Get object info) response...
>>> > (10001,11210000,/store_00010001/)
>>> > Sending PTP_OC 0x1008 (Get object info) (0x11210000) request...
>>> > Reading PTP_OC 0x1008 (Get object info) data...
>>> > Reading PTP_OC 0x1008 (Get object info) response...
>>> > (10001,11004000,/store_00010001/)
>>> > Sending PTP_OC 0x1008 (Get object info) (0x11004000) request...
>>> > Reading PTP_OC 0x1008 (Get object info) data...
>>> > Reading PTP_OC 0x1008 (Get object info) response...
>>> > (10001,0,/store_00010001/)
>>> > resetting filesystem
>>> > Clearing fscache LRU list...
>>> > fscache LRU list already empty
>>> > Internally deleting all folders from '/'...
>>> > Lookup folder '/'...
>>> > Found! / is 0x1f08468
>>> > Recurse delete folder 0x1f08468//
>>> > Delete all files in folder 0x1f08468//
>>> > Lookup folder /store_00010001/DCIM/132ND500 file D50_1902.NEF
>>> > Lookup folder '/store_00010001/DCIM/132ND500'...
>>> > Folder / is dirty. Listing folders in there to make folder clean...
>>> > Listing folders in /
>>> > Lookup folder '/'...
>>> > Found! / is 0x1f08468
>>> > ... is dirty, getting from camera
>>> > folder_list_func(/)
>>> > Internally deleting all folders from '/'...
>>> > Lookup folder '/'...
>>> > Found! / is 0x1f08468
>>> > Recurse delete folder 0x1f08468//
>>> > Folder / contains 0 subfolders.
>>> > Done making folder / clean...
>>> > File changed on camera: /store_00010001/DCIM/132ND500 / D50_1902.NEF
>>> > Getting file info for 'D50_1902.NEF' in '/store_00010001/DCIM/132ND500'...
>>> > Getting information about 'D50_1902.NEF' in
>>> > '/store_00010001/DCIM/132ND500'...
>>> > Lookup folder /store_00010001/DCIM/132ND500 file D50_1902.NEF
>>> > Lookup folder '/store_00010001/DCIM/132ND500'...
>>> > Downloading ./images/D50_1902.NEF
>>> > Getting file 'D50_1902.NEF' in folder '/store_00010001/DCIM/132ND500'...
>>> > Getting file 'D50_1902.NEF' from folder '/store_00010001/DCIM/132ND500'
>>> > (type 1)...
>>> > Lookup folder /store_00010001/DCIM/132ND500 file D50_1902.NEF
>>> > Lookup folder '/store_00010001/DCIM/132ND500'...
>>> > Download of 'D50_1902.NEF' from '/store_00010001/DCIM/132ND500' (type 1)
>>> > failed. Reason: 'Directory not found'
>>> > 'gp_filesystem_get_file (camera->fs, folder, file, type, camera_file,
>>> > context)' failed: -107
>>> > Failed to download ./images/D50_1902.NEF
>>> >
>>> > Thanks for the support
>>> >
>>> > --
>>> > Med vänlig hälsning
>>> > Peter Sonander
>>> > S-Bilder
>>> > [email protected]
>>> >
>>> > http://s-bilder.se
>>> > Facebook: https://fb.me/sbilder.se/
>>> > Instagram: @FotografPeterSonander
>>>
>>>
>>> > _______________________________________________
>>> > Gphoto-user mailing list
>>> > [email protected]
>>> > https://lists.sourceforge.net/lists/listinfo/gphoto-user
>>>
>>>
>>>
>>> _______________________________________________
>>> Gphoto-user mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/gphoto-user
>
>
> _______________________________________________
> Gphoto-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/gphoto-user
_______________________________________________
Gphoto-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gphoto-user