gphoto / libgphoto2

The libgphoto2 camera access and control library.
GNU Lesser General Public License v2.1
1.03k stars 324 forks source link

Not receiving `GP_EVENT_CAPTURE_COMPLETE` event when capturetarget = Memory Card #929

Open artyom-beilis opened 12 months ago

artyom-beilis commented 12 months ago

Describe the bug

When using trigger capture and waiting for events I receive FILE_ADDED but never receive GP_EVENT_CAPTURE_COMPLETE event when capturetarget = Memory Card, When capturetarget is set to internal memory I receive capture completed.

Note, I can't use only FILE Added since I don't know in advance how many are saved (jpeg, raw or jpeg & raw)

Name the camera Canon EOS 7D

libgphoto2 and gphoto2 version

gphoto2 2.5.15

Copyright (c) 2000-2017 Lutz Mueller and others

gphoto2 comes with NO WARRANTY, to the extent permitted by law. You may
redistribute copies of gphoto2 under the terms of the GNU General Public
License. For more information about these matters, see the files named COPYING.

This version of gphoto2 is using the following software versions and options:
gphoto2         2.5.15         gcc, popt(m), exif, cdk, aa, jpeg, readline
libgphoto2      2.5.16         all camlibs, gcc, ltdl, EXIF
libgphoto2_port 0.12.0         iolibs: disk ptpip serial usb1 usbdiskdirect usbscsi, gcc, ltdl, USB, serial without locking

To Reproduce

Since I use libgphoto2 basic sequence is just set save target to sd card and than catpture completed event is not fired.

I'm attaching libgphoto log (with some additions) for case when target is sdcard and internal memory

With internal memory there is an entry camera_wait_for_event:entry type 0004 it does not appear when target in SDCard.

ols_camera_strorage_memory.log ols_camera_storage_sdcard.log

artyom-beilis commented 12 months ago

Same with latest libgphoto2 2.5.30.1

artyom-beilis commented 11 months ago

Currently, I workaround it by requiring from user to save only a single type of file per trigger - either raw or jpeg but not both. So I can take action on "file added" event.

So now I implemented same requirement, limitation as Indi. But I'd rather prefer to use capture complete event as more correct and flexible one.

Sija commented 1 day ago

@axxel Is this sth that can be fixed with the newest changes?

axxel commented 1 day ago

There is nothing that I added that directly affects this issue. The EOS cameras simply don't emit the standard PTP_EC_CaptureComplete event, neither a canon-specific one with the same meaning. There is the EOS specific PTP_EC_CANON_EOS_CameraStatusChanged event comes with an int parameter. If this is 0, the CAPTURE_COMPLETE is triggered. That is obviously not a standard behavior of all EOS cameras in all configurations. The R5m2 is another one where this is not reliably triggered (#1028).

I would argue the best way to move forward is trying to find another "internal" event that can be used to trigger the CAPTURE_COMPLETE event.

My question to @artyom-beilis is: what is it that you are waiting for? There are at least 2 points in time that could be considered here 1) The camera is ready to take another picture. See my PR #1027. 2) The camera has successfully stored the image(s) somewhere, so you can now rip out the battery without data loss.

artyom-beilis commented 1 day ago

The camera is ready to take another picture.

Exactly. I download images in parallel to setting a new capture. However if there are more than one file, trigger will fail.

I use it for astrophotography automation and I need a reliable sequence of caputure/download - and batch the processing so I can capture a next image while downloading.

axxel commented 1 day ago

So you want to store the data on the memory card, take pictures back to back, as fast as possible and simultaneously download the images from the card to the PC?

What is the "frame rate" you achieved with your current setup? Astrophotography sounds like very long exposure times, so you are not really that much in a hurry, right?