×

INDI Library v2.0.7 is Released (01 Apr 2024)

Bi-monthly release with minor bug fixes and improvements

Nikon bulb cable | SOLVED

  • Posts: 94
  • Thank you received: 38

Replied by max on topic Nikon bulb cable

here is the gdb log :
(gdb) bt
#0  __GI_strcmp (p1=<optimized out>, p2=<optimized out>) at strcmp.c:38
#1  0x0001454e in gphoto_read_widget ()
#2  0x000159c8 in gphoto_get_widget_info ()
#3  0x00012b24 in GPhotoCCD::ShowExtendedOptions() ()
#4  0x00010582 in GPhotoCCD::updateProperties() ()
#5  0x4005b2e2 in INDI::DefaultDevice::ISNewSwitch(char const*, char const*, ISState*, char**, int) () from /usr/lib/libindidriver.so.0
#6  0x40060766 in INDI::CCD::ISNewSwitch(char const*, char const*, ISState*, char**, int) () from /usr/lib/libindidriver.so.0
#7  0x00010f2e in GPhotoCCD::ISNewSwitch(char const*, char const*, ISState*, char**, int) ()
#8  0x0000fc12 in ISNewSwitch ()
#9  0x40053240 in dispatch () from /usr/lib/libindidriver.so.0
#10 0x40052cd2 in clientMsgCB () from /usr/lib/libindidriver.so.0
#11 0x40056514 in callCallback () from /usr/lib/libindidriver.so.0
#12 0x40056828 in oneLoop () from /usr/lib/libindidriver.so.0
#13 0x40055d80 in eventLoop () from /usr/lib/libindidriver.so.0
#14 0x40055cb4 in main () from /usr/lib/libindidriver.so.0
#15 0x4043b632 in __libc_start_main (main=0xf1a8 <main>, argc=1, 
    argv=0xbefff8a4, init=<optimized out>, fini=0x17019 <__libc_csu_fini+1>, 
    rtld_fini=0x4000b4a9 <_dl_fini>, stack_end=0xbefff8a4) at libc-start.c:287
#16 0x0000f9b8 in _start ()
(gdb)

indi_gphoto_ccd crash when I click connect button in indi control panel.I had compiled the lateast code.
The following user(s) said Thank You: Joshua
9 years 9 months ago #1432

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

Replied by Jasem Mutlaq on topic Nikon bulb cable

Hi Max,

Thank you for your patience and testing. I added yet more checks to indi-gphoto driver. Please update libindi as well and install it before updating and installing indi-gphoto. If this doesn't resolve the crash I don't know what will, someone might need to dig the code to find out. At any rate, please test one more time and let us know. Btw, I just tested my Canon 600d with the driver and everything worked flawlessly! including bulb exposures!
The following user(s) said Thank You: Joshua
9 years 9 months ago #1434

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

  • Posts: 94
  • Thank you received: 38

Replied by max on topic Nikon bulb cable

Hi Knro

I tried the new code,but it still crash.
I will try to borrow a nikon camera to find out what happen.
9 years 9 months ago #1446

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

Replied by Jasem Mutlaq on topic Nikon bulb cable

Furthermore, are you compiling this on a PC or RPI? If either case, make sure you are linking against the updated libindi. If you installed libindi via a package manager, then most likely the driver is getting linked against that version. You can know what the driver is linked against:
ldd /usr/bin/indi_gphoto_ccd

I get
        linux-vdso.so.1 =>  (0x00007fff26d7e000)
        libindidriver.so.0 => /usr/lib/libindidriver.so.0 (0x00007f4744fb7000)
        libcfitsio.so.3 => /usr/lib/x86_64-linux-gnu/libcfitsio.so.3 (0x00007f4744bff000)
        libgphoto2.so.6 => /usr/lib/x86_64-linux-gnu/libgphoto2.so.6 (0x00007f474497e000)
        libgphoto2_port.so.10 => /usr/lib/x86_64-linux-gnu/libgphoto2_port.so.10 (0x00007f4744774000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f4744556000)

You will note it is linked against libindi in /usr/lib. If it was linked against libindi under /usr/lib/x86_64-linux-gnu then that means it was linked as the package manager installed libindi. Therefore, it is better to completely remove libindi:
sudo apt-get remove libindi0

and compile the latest version yourself.
9 years 9 months ago #1448

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

  • Posts: 94
  • Thank you received: 38

Replied by max on topic Nikon bulb cable

Hi Knro

I do all the update code, compiling and installation in my ARM mini pc.And ldd output I think is just fine.
astro@tinyastro:~$ ldd /usr/bin/indi_gphoto_ccd
        libindidriver.so.0 => /usr/lib/libindidriver.so.0 (0x4026c000)
        libcfitsio.so.3 => /usr/lib/arm-linux-gnueabihf/libcfitsio.so.3 (0x402dc000)
        libgphoto2.so.6 => /usr/lib/arm-linux-gnueabihf/libgphoto2.so.6 (0x400e3000)
        libgphoto2_port.so.10 => /usr/lib/arm-linux-gnueabihf/libgphoto2_port.so.10 (0x400cb000)
        libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0x4015f000)
        libjpeg.so.8 => /usr/lib/arm-linux-gnueabihf/libjpeg.so.8 (0x4017a000)
        libz.so.1 => /lib/arm-linux-gnueabihf/libz.so.1 (0x401b6000)
        libstdc++.so.6 => /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 (0x4042c000)
        libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0x40006000)
        libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0x401cf000)
        libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0x404db000)
        libusb-1.0.so.0 => /lib/arm-linux-gnueabihf/libusb-1.0.so.0 (0x401f0000)
        libnova-0.14.so.0 => /usr/lib/arm-linux-gnueabihf/libnova-0.14.so.0 (0x405c2000)
        /lib/ld-linux-armhf.so.3 (0x40094000)
        libltdl.so.7 => /usr/lib/arm-linux-gnueabihf/libltdl.so.7 (0x400b5000)
        libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0x40073000)
        libexif.so.12 => /usr/lib/arm-linux-gnueabihf/libexif.so.12 (0x40208000)
        libudev.so.1 => /lib/arm-linux-gnueabihf/libudev.so.1 (0x4023e000)
        librt.so.1 => /lib/arm-linux-gnueabihf/librt.so.1 (0x4007e000)
astro@tinyastro:~$
9 years 9 months ago #1457

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

  • Posts: 94
  • Thank you received: 38

Replied by max on topic Nikon bulb cable

Hi Knro,

I tried another time and found something .I compiled gphoto_driver.c as a standalone and it work as expected .
The problem may in gphoto_ccd.cpp, after attach gdb to the indi_gphoto_ccd,connect camera in ekos, indi_gphoto_ccd crash and I got the bt log:
(gdb) bt
#0  __strncpy_sse2_unaligned ()
    at ../sysdeps/x86_64/multiarch/strcpy-sse2-unaligned.S:296
#1  0x000000000040cf56 in GPhotoCCD::create_switch (this=0xbdf2c0, 
    basestr=0xc30804 "whitebiaspresetno", options=0xc89c60, max_opts=1, 
    setidx=0) at /home/max/prj/indi/3rdparty/indi-gphoto/gphoto_ccd.cpp:821
#2  0x000000000040d2d6 in GPhotoCCD::AddWidget (this=0xbdf2c0, widget=0xc6f410)
    at /home/max/prj/indi/3rdparty/indi-gphoto/gphoto_ccd.cpp:890
#3  0x000000000040d7d2 in GPhotoCCD::ShowExtendedOptions (this=0xbdf2c0)
    at /home/max/prj/indi/3rdparty/indi-gphoto/gphoto_ccd.cpp:938
#4  0x000000000040a2f3 in GPhotoCCD::updateProperties (this=0xbdf2c0)
    at /home/max/prj/indi/3rdparty/indi-gphoto/gphoto_ccd.cpp:275
#5  0x00007ff44b86655d in INDI::DefaultDevice::ISNewSwitch(char const*, char const*, ISState*, char**, int) ()
   from /usr/lib/x86_64-linux-gnu/libindidriver.so.0
#6  0x00007ff44b86cb08 in INDI::CCD::ISNewSwitch(char const*, char const*, ISState*, char**, int) () from /usr/lib/x86_64-linux-gnu/libindidriver.so.0
#7  0x000000000040b0c7 in GPhotoCCD::ISNewSwitch (this=0xbdf2c0, 
    dev=0xbea060 "GPhoto CCD", name=0xbe9f60 "CONNECTION", states=0xbea210, 
    names=0xbea230, n=1)
    at /home/max/prj/indi/3rdparty/indi-gphoto/gphoto_ccd.cpp:459
#8  0x0000000000409775 in ISNewSwitch (dev=0xbea060 "GPhoto CCD", 
    name=0xbe9f60 "CONNECTION", states=0xbea210, names=0xbea230, num=1)
    at /home/max/prj/indi/3rdparty/indi-gphoto/gphoto_ccd.cpp:94
---Type <return> to continue, or q <return> to quit---
#9  0x00007ff44b85e829 in dispatch ()
   from /usr/lib/x86_64-linux-gnu/libindidriver.so.0
#10 0x00007ff44b85ec6b in clientMsgCB ()
   from /usr/lib/x86_64-linux-gnu/libindidriver.so.0
#11 0x00007ff44b861cbb in ?? ()
   from /usr/lib/x86_64-linux-gnu/libindidriver.so.0
#12 0x00007ff44b861e1d in eventLoop ()
   from /usr/lib/x86_64-linux-gnu/libindidriver.so.0
#13 0x00007ff44b8587e6 in main ()
   from /usr/lib/x86_64-linux-gnu/libindidriver.so.0
#14 0x00007ff449fcfec5 in __libc_start_main (main=0x408a20 <main@plt>, argc=1, 
    argv=0x7fff27aaa618, init=<optimized out>, fini=<optimized out>, 
    rtld_fini=<optimized out>, stack_end=0x7fff27aaa608) at libc-start.c:287
#15 0x00000000004094d9 in _start ()
(gdb) 

Will this help to solve the problem ?
9 years 9 months ago #1469

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

Replied by Jasem Mutlaq on topic Nikon bulb cable

well, the only thing I can gather is from this:
0x000000000040cf56 in GPhotoCCD::create_switch (this=0xbdf2c0, 
    basestr=0xc30804 "whitebiaspresetno", options=0xc89c60, max_opts=1, 
    setidx=0) at /home/max/prj/indi/3rdparty/indi-gphoto/gphoto_ccd.cpp:821

So options is a pointer to strings (const char **options) so it is crashing accessing options[0] in strncpy. The standalone doesn't fetch options so it wouldn't cause the crash. Have you tried compiling and running this on a different machine or distro?
9 years 9 months ago #1471

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

  • Posts: 94
  • Thank you received: 38

Replied by max on topic Nikon bulb cable

I may find the reason why it crash.Please read the comment in the code.
int gphoto_read_widget(gphoto_widget *widget)
{
    char *ptr=NULL;
	int i;
    int ret = GP_OK;
 
	switch(widget->type) {
	case GP_WIDGET_TEXT:
        /* some code here */
	case GP_WIDGET_RADIO:
	case GP_WIDGET_MENU:
		ret = gp_widget_get_value (widget->widget, &ptr);
                /* the first time precessing the whitebiaspresetno widget, ret = GP_OK, and ptr still NULL */
                if (ret != GP_OK)
                    return ret;
		if (! widget->choices) {
			widget->choice_cnt = gp_widget_count_choices (widget->widget);
			widget->choices = calloc(sizeof(char *), widget->choice_cnt + 1);
                        /* allocate memery */
			for ( i=0; i<widget->choice_cnt; i++) {
                                const char *choice=NULL;
				ret = gp_widget_get_choice (widget->widget, i, &choice);
                                / * ret = GP_OK and choice = "0" */
                if (ret != GP_OK)
                    return ret;
                if (ptr && choice)
                {
                    if (strcmp(choice, ptr) == 0)
                        widget->value.index = i;
                    widget->choices[i] = choice;
                }
                else
                    return GP_ERROR;
                    /* ptr = NULL, so return GP_ERROR, but widget->choices is not NULL */
			}
		}
		break;
	case GP_WIDGET_DATE:
		ret = gp_widget_get_value (widget->widget, &widget->value.date);
		break;
	default:
		fprintf(stderr, "WARNING: Widget type: %d is unsupported\n", widget->type);
	}
    return ret;
}

Back to here:
gphoto_widget *gphoto_get_widget_info(gphoto_driver *gphoto, gphoto_widget_list **iter)
{
	gphoto_widget *widget;
 
	if(! *iter)
		return NULL;
	widget = (*iter)->widget;
    int ret = gphoto_read_widget(widget);
    /* ret = GP_ERROR */
    if (ret == GP_OK)
    {
        *iter=(*iter)->next;
        return widget;
    }
    else
        return NULL;
        /* so iter still point to whitbiaspresetno widget */
}

The next time call
int gphoto_read_widget(gphoto_widget *widget)
{
    char *ptr=NULL;
	int i;
    int ret = GP_OK;
 
	switch(widget->type) {
	case GP_WIDGET_TEXT:
        /* some code here */
	case GP_WIDGET_RADIO:
	case GP_WIDGET_MENU:
		ret = gp_widget_get_value (widget->widget, &ptr);
                /* the second time precessing the whitebiaspresetno widget, ret = GP_OK, and ptr still NULL */
                if (ret != GP_OK)
                    return ret;
                 /* the last time widget whitbiaspresetno's choices's memery is allocated , but value of choices[0] is 0x0 */
                 /* this time func will directly return ret value, GP_OK */
		if (! widget->choices) {
			widget->choice_cnt = gp_widget_count_choices (widget->widget);
			widget->choices = calloc(sizeof(char *), widget->choice_cnt + 1);
			for ( i=0; i<widget->choice_cnt; i++) {
                                const char *choice=NULL;
				ret = gp_widget_get_choice (widget->widget, i, &choice);
                if (ret != GP_OK)
                    return ret;
                if (ptr && choice)
                {
                    if (strcmp(choice, ptr) == 0)
                        widget->value.index = i;
                    widget->choices[i] = choice;
                }
                else
                    return GP_ERROR;
			}
		}
		break;
	case GP_WIDGET_DATE:
		ret = gp_widget_get_value (widget->widget, &widget->value.date);
		break;
	default:
		fprintf(stderr, "WARNING: Widget type: %d is unsupported\n", widget->type);
	}
    return ret;
}

So, in func gphoto_get_widget_info, iter will move to the next widget and return a widget with choices[0] = 0x0, this cause create_switch func fail.

this may solve the problem
gphoto_widget *gphoto_get_widget_info(gphoto_driver *gphoto, gphoto_widget_list **iter)
{
	gphoto_widget *widget;
 
	if(! *iter)
		return NULL;
	widget = (*iter)->widget;
    int ret = gphoto_read_widget(widget);
        *iter=(*iter)->next;
    if (ret == GP_OK)
    {
        return widget;
    }
    else
        return NULL;
}
Last edit: 9 years 9 months ago by max.
9 years 9 months ago #1495

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

Replied by Jasem Mutlaq on topic Nikon bulb cable

Hi Max, thanks for the analysis. I made the change and a quick test revealed no issues. Please update and test on your side.
The following user(s) said Thank You: Joshua
9 years 9 months ago #1496

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

  • Posts: 94
  • Thank you received: 38

Replied by max on topic Nikon bulb cable

Hi Knro, It work well. Thanks.

I have another question , since DSLR has it's own storage to save the pic. and download pic to PC will take some time.
especially for the arm mini PC, it took about 10 more second to download .There are two copy of the same picture .
What about an option no to download picture to PC side when camera is a DSLR ?
The following user(s) said Thank You: Joshua
9 years 9 months ago #1497

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

Replied by Jasem Mutlaq on topic Nikon bulb cable

Yeah it would be nice to have such an option,but I'm not sure how to implement it using libgphoto. I didn't write the gphoto-driver, just maintaining it so I have 'superficial' knowledge on how it works.
9 years 9 months ago #1508

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

Replied by Jasem Mutlaq on topic Nikon bulb cable

Oh, I just had to poke around to resolve this, couldn't help it! Now you have in the main tab "Upload" options, by default it set to "Client" which would just upload the image to KStars/Ekos and not save it on SD Card. The 2nd option is "SD Card" which it will save to SD card only and not upload to client. The 3rd option is "Both" so it saves to SD card and also uploads it to client. I hope this helps. Please test and confirm if it works.

Edit: both libindi and indi-gphoto need to be updated and installed.

Edit2: It seems saving to SD card does NOT work for BULB exposures, I'm not sure why, I tried to use the same settings for non-bulb and it's not saving to SD card. If anyone can investigate this I'd appreciate it!
Last edit: 9 years 9 months ago by Jasem Mutlaq.
9 years 9 months ago #1509

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

Time to create page: 0.898 seconds