×

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

Bi-monthly release with minor bug fixes and improvements

Nikon bulb cable | SOLVED

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.

  • Posts: 94
  • Thank you received: 38

Replied by max on topic Nikon bulb cable

Wow,You are amazing.
I will try to test and investigate it.
I think this will save so much time.Not just for dslr, enven other CCD camera, most of the time we don't need to transfer the pic data to client side after focusing and preview, especially use indi server and client locally or have a slow connection .
9 years 9 months ago #1510

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 just test the save to SD card feature with my 5D2, and it work even at bulb mode.
Last edit: 9 years 8 months ago by max.
9 years 8 months ago #1586

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

It's weird.
The saving to SD card function work at the ppa version but not the latest code from svn. They even display difference.

the ppa version display like this:


the svn version display like this:
Last edit: 9 years 8 months ago by max.
9 years 8 months ago #1596
Attachments:

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

Replied by Jasem Mutlaq on topic Nikon bulb cable

The driver saves the image to the SD card, but it also saves it to the local specified directory as well. This is how "local" works for all CCD drivers, it saves to the local storage, but for GPhoto driver, it also saves it to the SD card. I think if you check the SD card, it will probably be there.
9 years 8 months ago #1598

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

  • Posts: 42
  • Thank you received: 15

Replied by Joshua on topic Nikon bulb cable

Hello knro,
Is there a way to make it save to the SD card only,not in the local directory?
Thanks,
9 years 8 months ago #1599

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

But the behavior is not like you said .
The PPA version , "upload" option is in main control tab, and there is no "upload settings" as the picture I posted .When I choose save to SD Card, it really only save to SD card .
The SVN version ,upload option is in option tab, as the picture I posted .save to local didn't work .
Last edit: 9 years 8 months ago by max.
9 years 8 months ago #1600

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

Time to create page: 2.856 seconds