gphoto / libgphoto2

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

gphoto2 exiting after error with error code=0 #98

Open inquito opened 7 years ago

inquito commented 7 years ago

Hello again, Marcus. I'm having a problem with gphoto2, I'm using it in a arm machine with this version: gphoto2 2.5.10 gcc, popt(m), exif, no cdk, no aa, no jpeg, no readline libgphoto2 2.5.10 all camlibs, gcc, ltdl, EXIF libgphoto2_port 0.12.0 gcc, ltdl, USB, serial without locking

the problem consist in that when I attempt to take a photo and capturing fails the exit error code of gphoto2 is always 0 if I execute #!/bin/bash /usr/local/bin/gphoto2 --capture-image-and-download Error_gphoto=$? echo "-------error_gphoto = (" $Error_gphoto ")" `` I get .... . . . ERROR: Could not capture image. ERROR: Could not capture. * Error *
An error occurred in the io-library ('Could not lock the device'): Camera is already in use. -------error_gphoto = (0) or .... . . * Error *
An error occurred in the io-library ('Could not lock the device'): Camera is already in use. * Error (-60: 'Could not lock the device') *
-------error_gphoto(0)

am I doing something wrong ?. Any idea on how to detect when a error happens in gphoto2 by other method ? I have been using this method from long time ago and I think that is something new in 2.5.10, I'm not sure but I think that it was working fine until I upgraded. Best regards. Inco.

msmeissn commented 7 years ago

hmm, the capture method returns OK on this kind of error currently, but it probably should return a failure.

the gphoto2 exit code handling is not always consistent.

I will handle "camera in use"