Skip to content

Commit

Permalink
In case on failure to wait for event, try up to 3 times before giving up
Browse files Browse the repository at this point in the history
  • Loading branch information
knro committed Dec 25, 2024
1 parent 1d22541 commit cb7b16e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions indi-gphoto/gphoto_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1390,6 +1390,7 @@ int gphoto_read_exposure_fd(gphoto_driver *gphoto, int fd)
struct timeval start_time;
gettimeofday(&start_time, nullptr);
DEBUGFDEVICE(device, INDI::Logger::DBG_DEBUG, "BULB Mode: Waiting for event for %d seconds (waitMS: %d).", gphoto->download_timeout, waitMS);
int no_event_retries = 3;

while (1)
{
Expand All @@ -1399,6 +1400,12 @@ int gphoto_read_exposure_fd(gphoto_driver *gphoto, int fd)
if (result != GP_OK)
{
DEBUGDEVICE(device, INDI::Logger::DBG_WARNING, "Could not wait for event.");
// Try up to 3 times before giving up
if (no_event_retries-- > 0)
{
usleep(250000);
break;
}
pthread_mutex_unlock(&gphoto->mutex);
return -1;
}
Expand Down

0 comments on commit cb7b16e

Please sign in to comment.