Re: FILE_ADDED events getting lost

Dave Taylor <[email protected]> Tue, 6 Oct 2020 09:39:37 -0700
Newsgroups gmane.comp.multimedia.gphoto.user
Message-ID <CAL2tZyd9dWngGXaQs953BmR21UBFcc6Ofz_vq6z31H254GpG8g@mail.gmail.com>
On Mon, Oct 5, 2020 at 10:54 PM Marcus Meissner <[email protected]> wrote:
>
> Hi,
>
> - Is this libgphoto2 using libusb1 or libusb0?
>
>   If you are using libusb0, it is possible to lose USB interrupts if you are not
>   waiting for events actively.

Not sure how I would find out for the version that came with Debian
buster.  I did an ldd on my executable, and it doesn't appear to be
referencing libusb as a dynamically loaded library.  How would I tell
which version was compiled in?

> - just to check, you are polling with gp_camera_wait_for_event until GP_EVENT_TIMEOUT
>   is returned?
>
>   There might be multiple events buffered.

Yes.  I fetch all the buffered events, and the timeout is always below
10ms for each call, but the actual elapsed time for some reason can
vary widely.

> When did you see this change of reliability happen? When you passed
> longer times to gp_camera_wait_for_event?

I never pass more than 10ms as a timeout, but it gets really slow
sometimes, on the order of 100ms to 1s.  I haven't correlated why/when
it happens yet, but when it does, I'm definitely not going to get a
GP_EVENT_FILE_ADDED, but this isn't the only time it happens.  It can
respond in normal time and still not return FILE_ADDED.

Please let me know if there's anything I can do to help isolate the issue.

        =-ddt->

>
> Ciao, Marcus
>
> On Mon, Oct 05, 2020 at 07:06:17PM -0700, Dave Taylor wrote:
> > FYI, I just tried linking against a build from the master branch on
> > the libgphoto2 git repo today (as of commit 72c0ff69e1), and I'm
> > seeing the same GP_EVENT_UNKNOWN behaviour.
> >
> >         =-ddt->
> >
> >
> >
> > On Mon, Oct 5, 2020 at 2:48 PM Dave Taylor <[email protected]> wrote:
> > >
> > > I'm using a mix of Nikon D5300s and D5600s, and we're triggering the
> > > focus and shutter externally using hardware (through the MC-DC2 port),
> > > and then I'm using gp_camera_wait_for_event() to spot a
> > > GP_EVENT_FILE_ADDED event, so I can know when to grab it.
> > >
> > > I was using the timeout support in that call, but I wasn't seeing a
> > > correlation between real time and the stated milliseconds I was
> > > passing to gp_camera_wait_for_event(), so I tried passing 0ms, 1ms,
> > > and 10ms timeouts, and then I just polled that for 10 real seconds by
> > > checking clock_gettime(CLOCK_REALTIME) until I got 10 real seconds
> > > passed since the start of the loop.
> > >
> > > I'm not sure if it was that change or something else, but I am
> > > definitely no longer getting reliable GP_EVENT_FILE_ADDED events, even
> > > when I confirm that the file did show up on the internal SD card.
> > >
> > > For some reason, instead, I'll get three GP_EVENT_UNKNOWN's, and
> > > sometimes, oddly, the next time I restart my code using
> > > gp_camera_init() and friends, when I go through and discard any events
> > > that might have been queued up by initialization, I'll sometimes see a
> > > GP_EVENT_FILE_ADDED, but even more maddeningly, not always.
> > >
> > > Resetting the camera power will usually allow it to work for one shot
> > > with the GP_EVENT_FILE_ADDED event showing up properly, and then on
> > > subsequent shots, it'll get back in that state where it gives me those
> > > GP_EVENT_UNKNOWN's, never to return until the camera is power-cycled.
> > > Note that restarting my process using libgphoto2 has no bearing on
> > > recovering from this state.
> > >
> > > Also, does the fact that the timeouts don't seem to track real-time
> > > sound familiar to you?  Or am I a weirdo for seeing that?
> > >
> > > What I'm really hoping is that these symptoms sound familiar to you,
> > > and you suggest what I might next try to further isolate what's
> > > happening.
> > >
> > > I'm on the Debian package libgphoto2-dev 2.5.22-3 on a Raspberry Pi 3
> > > running Raspbian Buster.
> > >
> > > I'm kind of at my wit's end how to further isolate this.  If you could
> > > suggest any strategies to help track this down, I'd love suggestions!
> > > Thank you!
> > >
> > >        =-ddt->
> >
> >
> > _______________________________________________
> > Gphoto-user mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/gphoto-user
> >
>
> --
> Marcus Meissner,SUSE LINUX GmbH; Maxfeldstrasse 5; D-90409 Nuernberg; Zi. 3.1-33,+49-911-740 53-432,,serv=loki,mail=wotan,type=real <[email protected]>