Skip to content

Commit

Permalink
If connecting via USB fails, just connect model. Add sleep in case ev…
Browse files Browse the repository at this point in the history
…ent not available
  • Loading branch information
knro committed Oct 23, 2024
1 parent 4f684f1 commit 705d1a9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion indi-gphoto/gphoto_ccd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -822,11 +822,17 @@ bool GPhotoCCD::Connect()

if (isSimulation() == false)
{
// Regular detect
// If no port is specified, connect to first camera detected on bus
if (port[0] == '\0')
gphotodrv = gphoto_open(camera, loader.context, nullptr, nullptr, shutter_release_port);
else
{
// Connect to specific model on specific USB device end point.
gphotodrv = gphoto_open(camera, loader.context, model, port, shutter_release_port);
// Otherwise, try to specify the model only without the USB device end point.
if (gphotodrv == nullptr)
gphotodrv = gphoto_open(camera, loader.context, model, nullptr, shutter_release_port);
}
if (gphotodrv == nullptr)
{
LOG_ERROR("Can not open camera: Power OK? If camera is auto-mounted as external disk "
Expand Down
2 changes: 2 additions & 0 deletions indi-gphoto/gphoto_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <unistd.h>
#include <sys/ioctl.h>
#include <cstdlib>
#include <thread>

#include <config.h>
#include <indilogger.h>
Expand Down Expand Up @@ -1401,6 +1402,7 @@ int gphoto_read_exposure_fd(gphoto_driver *gphoto, int fd)
return -1;
}

std::this_thread::sleep_for(std::chrono::seconds(1));
continue;
}

Expand Down

0 comments on commit 705d1a9

Please sign in to comment.