Welcome, Guest
Username: Password: Remember me
25 Jul 2018
Glad to announce of release of INDI Library v1.7.4 on 2018-07-25. A few drivers were added in this release as we continue to improve & stabilize existing drivers.
Read More...

TOPIC: DSUSB

DSUSB 3 weeks 4 days ago #29089

Okay, after reading the code for gphoto_driver.cpp and dsusbriver.cpp (quite readable, nice work!) I'm puzzled by the output I'm seeing in my indi logs:

I've set the shutter release port to "DSUSB" after reading the code and realizing that you didn't need a device filename, you just need the string "DSUSB" in order to look for the USB device by its vendor IDs.

In the beginning, everything looks great:
[2018-08-30T20:44:30.539 EDT DEBG ][           org.kde.kstars.indi] - Nikon DSLR DSC D3200 0 : "[DEBUG] Model: D3200 "
[2018-08-30T20:44:30.539 EDT DEBG ][           org.kde.kstars.indi] - Nikon DSLR DSC D3200 0 : "[DEBUG] Finding DSUSB 0x134A, 0x9021 ... "
[2018-08-30T20:44:30.539 EDT DEBG ][           org.kde.kstars.indi] - Nikon DSLR DSC D3200 0 : "[DEBUG] Connected to DSUSB! "
[2018-08-30T20:44:30.539 EDT DEBG ][           org.kde.kstars.indi] - Nikon DSLR DSC D3200 0 : "[DEBUG] RC: 1 - Info Byte: 0X30 "
[2018-08-30T20:44:30.541 EDT INFO ][           org.kde.kstars.indi] - Nikon DSLR DSC D3200 0 :  "[INFO] Connected to DSUSB "
[2018-08-30T20:44:30.542 EDT DEBG ][           org.kde.kstars.indi] - Nikon DSLR DSC D3200 0 : "[DEBUG] GPhoto initialized. "
[2018-08-30T20:44:30.546 EDT DEBG ][           org.kde.kstars.indi] - Nikon DSLR DSC D3200 0 : "[DEBUG] Blub-stop thread enabled. "
[2018-08-30T20:44:30.547 EDT DEBG ][           org.kde.kstars.indi] - Nikon DSLR DSC D3200 0 : "[DEBUG] Capture target is SD Card. "
[2018-08-30T20:44:30.552 EDT INFO ][           org.kde.kstars.indi] - Nikon DSLR DSC D3200 0 :  "[INFO] Nikon DSLR DSC D3200 0 is online. "

That tells me that things went well in the constructor for
DSUSBDriver
and that the
gphoto->dsusb[code] field should be set.  When I try to take an exposure, these logs are puzzling:

[code]
[2018-08-30T20:45:04.278 EDT DEBG ][           org.kde.kstars.indi] - Nikon DSLR DSC D3200 0 : "[DEBUG] Opening remote serial shutter port: DSUSB ... "
[2018-08-30T20:45:04.278 EDT DEBG ][           org.kde.kstars.indi] - Nikon DSLR DSC D3200 0 : "[DEBUG] Failed to open serial port: DSUSB "
[2018-08-30T20:45:04.282 EDT INFO ][           org.kde.kstars.indi] - Nikon DSLR DSC D3200 0 :  "[ERROR] Error starting exposure "

Those messages are coming from code in
gphoto_driver.cpp
that it shouldn't go to if
gphoto->dsusb
is set:
        // If bulb port is specified, let's open it
        if (gphoto->dsusb)
        {
            DEBUGDEVICE(device, INDI::Logger::DBG_DEBUG, "Using DSUSB to open shutter...");
            gphoto->dsusb->openShutter();
        }
        else if (gphoto->bulb_port[0])
        {
            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);
            if (gphoto->bulb_fd < 0)
            {
                DEBUGFDEVICE(device, INDI::Logger::DBG_DEBUG, "Failed to open serial port: %s", gphoto->bulb_port);
                pthread_mutex_unlock(&gphoto->mutex);
                return -1;
            }
            ioctl(gphoto->bulb_fd, TIOCMBIS, &RTS_flag);
        }

I'm not super familiar with the code of indi and have only spent a little time here with it. I'm on version 1.7.4 from the PPA and I'm reading the code from the v.1.7.4 tag of the repo. Attaching my full log in case there's more info in there that would help.

Thanks for looking!
Attachments:

Please Log in or Create an account to join the conversation.

DSUSB 3 weeks 4 days ago #29128

I mapped the DSUSB to /dev/dsusb using a rule in in /etc/udev/rules.d. I named the file /etc/udev/rules.d/70-dsusb.rules and the contents are
ATTR{idVendor}=="134a" ATTR{idProduct}=="9021" GROUP="users", MODE="0666" SYMLINK+="dsusb"

I stopped using my DSLR some months ago and cannot recall what I put in the shutter release in EKOS. I didn't stop using the DSLR because of INDI. I stopped because I had some strange image artifacts with my D7000 which I couldn't seem to get out with calibration. I'm now working on getting and ASI 1600MM Pro plus filter wheel sorted out so I can image.
The following user(s) said Thank You: chrisguidry

Please Log in or Create an account to join the conversation.

DSUSB 3 weeks 4 days ago #29136

Chris, nice investigation skills you got there! It looks like that gphoto->dsusb is NULL for whatever user (since it gets skipped). Can you debug the code and verify this? If you're using Qt Creator, make sure to set GDB options as illustrated on the 2nd video in the development tutorial.

If you prefer to work from the command line, then you can do this:
gdb --eval-command="set follow-fork-mode child" --args indiserver -v indi_nikon_ccd
start
b gphoto_driver.cpp:1580
b gphoto_driver.cpp:1112

Then use the driver as usual, it should break at those lines. If for whatever reason 1580 is called more than one then it resets the dsusb variable to nullptr. Also check what happens at 1112 when it checks to see if dsusb is initialized.

Please Log in or Create an account to join the conversation.

Jasem Mutlaq
Support INDI & Ekos; Get StellarMate Astrophotography Gadget.
How to Submit Logs when you have problems?
Add your observatory info

DSUSB 3 weeks 1 day ago #29251

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.
The following user(s) said Thank You: knro, tseckler

Please Log in or Create an account to join the conversation.

Last Edit: by chrisguidry.

DSUSB 3 weeks 1 day ago #29253

Nice catch! Yes please submit a PR!

Please Log in or Create an account to join the conversation.

Jasem Mutlaq
Support INDI & Ekos; Get StellarMate Astrophotography Gadget.
How to Submit Logs when you have problems?
Add your observatory info

DSUSB 3 weeks 11 hours ago #29283

github.com/indilib/indi/pull/702

Thanks for being so welcoming!

Please Log in or Create an account to join the conversation.

Time to create page: 0.099 seconds

Login



3rd Party

Choose from the numerous 3rd party INDI drivers to suit your needs!

Got Problem?

Check out the FAQ, the forum, and the bug tracking system to resolve any issues you might have!
You can also subscribe to INDI newsletter and development mailing lists to get the latest updates on INDI!


Gallery

Replica

Why INDI

Replica