Chris Guidry replied to the topic 'DSUSB' in the forum. 6 years ago

Thanks, Jasem. After some more experimentation, and reviewing the code, it turns out that it wasn't

gphoto->dsusb
being
nullptr
like I originally thought. There's a second place where the "remote serial shutter" message was coming from, and I made a couple of small adjustments:
diff --git a/3rdparty/indi-gphoto/gphoto_driver.cpp b/3rdparty/indi-gphoto/gphoto_driver.cpp
index 57471bd3..b43c400d 100644
--- a/3rdparty/indi-gphoto/gphoto_driver.cpp
+++ b/3rdparty/indi-gphoto/gphoto_driver.cpp
@@ -606,6 +606,10 @@ static void *stop_bulb(void *arg)
             {
                 //shut off bulb mode
                 DEBUGDEVICE(device, INDI::Logger::DBG_DEBUG, "Closing shutter");
+                if (gphoto->dsusb)
+                {
+                    gphoto->dsusb->closeShutter();
+                }
                 if (gphoto->bulb_widget)
                 {
                     DEBUGFDEVICE(device, INDI::Logger::DBG_DEBUG, "Using widget:%s", gphoto->bulb_widget->name);
@@ -619,10 +623,6 @@ static void *stop_bulb(void *arg)
                         gphoto_set_widget_num(gphoto, gphoto->bulb_widget, FALSE);
                     }
                 }
-                else if (gphoto->dsusb)
-                {
-                    gphoto->dsusb->closeShutter();
-                }
                 else
                 {
                     ioctl(gphoto->bulb_fd, TIOCMBIC, &RTS_flag);
@@ -1195,7 +1195,7 @@ int gphoto_start_exposure(gphoto_driver *gphoto, uint32_t exptime_usec, int mirr
         return -1;
 
     // If bulb port is specified, a serial shutter control is required to start the exposure. Treat this as a bulb exposure.
-    if (gphoto->bulb_port[0])
+    if (gphoto->bulb_port[0] && !gphoto->dsusb)
     {
         DEBUGFDEVICE(device, INDI::Logger::DBG_DEBUG, "Opening remote serial shutter port: %s ...", gphoto->bulb_port);
         gphoto->bulb_fd = open(gphoto->bulb_port, O_RDWR, O_NONBLOCK);

There were just two other cases where we were looking at
bulb_port
without checking if
dsusb
was set first. What are your thoughts on this diff? I could send you a PR but I'd like your opinion that I'm on the right track here.

Read More...