gphoto / gphoto2

The gphoto2 commandline tool for accessing and controlling digital cameras.
GNU General Public License v2.0
707 stars 116 forks source link

Nikon D5300 hangs on `--trigger-capture` and `--capture-image` even with `--wait-event` set #393

Open BeebBenjamin opened 3 years ago

BeebBenjamin commented 3 years ago

Describe the bug:

When the battery is running low on a Nikon D5300 the --trigger-capture and --capture-image commands will sometimes hang forever, even if a--wait-event is specified. I understood that when you specify a --wait-event it will have a timeout set. Is that still the case?

Name the camera

Nikon DSC D5300

libgphoto2 and gphoto2 version

gphoto2 2.5.23.1 gcc, popt(m), exif, no cdk, no aa, no jpeg, no readline libgphoto2 2.5.26 standard camlibs (SKIPPING docupen lumix), gcc, ltdl, EXIF libgphoto2_port 0.12.0 iolibs: disk ptpip serial usb1 usbdiskdirect usbscsi, gcc, ltdl, EXIF, USB, serial without locking

To Reproduce

On Ubuntu 18.04, plug in camera with one bar left and keep attempting --trigger-capture from a command prompt until the battery sign flashes and gphoto2 hangs.

Output debug attached debug.log

msmeissn commented 3 years ago

The debug log shows the device reporting busy for 35 seconds... we currently would wait 1000 seconds before exiting the busy wait loop, as busy is also reported for running capture :/

msmeissn commented 3 years ago

the initial capture code has a busy wait logic (outside of wait event), thats why wiat-event currently wont help.

BeebBenjamin commented 3 years ago

I have a workaround, I added a custom timeout using subprocess which kills this after 30 seconds. Would be better to handle this in gphoto2 though. In other words being able to set this outer timeout to a different value would be good.