Author: post
Date: 2011-02-21 20:36:01 +0100 (Mon, 21 Feb 2011)
New Revision: 3826

Modified:
   trunk/src/rs-tethered-shooting.c
Log:
Fix Tethered shooting for Nikon (and possibly other) cameras.

Modified: trunk/src/rs-tethered-shooting.c
===================================================================
--- trunk/src/rs-tethered-shooting.c    2011-02-20 10:07:53 UTC (rev 3825)
+++ trunk/src/rs-tethered-shooting.c    2011-02-21 19:36:01 UTC (rev 3826)
@@ -284,58 +284,76 @@
        if (!t->camera)
                return -1;
 
-       append_status(t, _("Enabling capture mode\n"));
-
-  g_debug("Get root config.\n");
+  g_debug("Get root config.");
   CameraWidget *rootconfig; // okay, not really
   CameraWidget *actualrootconfig;
+       CameraWidget *child;
 
-  retval = gp_camera_get_config(t->camera, &rootconfig, t->context);
+       retval = gp_camera_get_config(t->camera, &rootconfig, t->context);
        CHECKRETVAL(retval);
-  actualrootconfig = rootconfig;
+               actualrootconfig = rootconfig;
 
-  g_debug("Get main config.\n");
-  CameraWidget *child;
-  retval = gp_widget_get_child_by_name(rootconfig, "main", &child);
-       CHECKRETVAL(retval);
+       /* Enable on Canon */
+       if (retval >= 0)
+       {
+               retval = gp_widget_get_child_by_name(rootconfig, "main", 
&child);
+       }
+       if (retval >= 0)
+       {
+               rootconfig = child;
+               retval = gp_widget_get_child_by_name(rootconfig, "settings", 
&child);
+       }
+       
+       if (retval >= 0)
+       {
+               rootconfig = child;
+               retval = gp_widget_get_child_by_name(rootconfig, "capture", 
&child);
+       }
+       if (retval >= 0)
+       {
+               CameraWidget *capture = child;
 
-  g_debug("Get settings config.\n");
-  rootconfig = child;
-  retval = gp_widget_get_child_by_name(rootconfig, "settings", &child);
-       CHECKRETVAL(retval);
+               const char *widgetinfo;
+               gp_widget_get_name(capture, &widgetinfo);
+               const char *widgetlabel;
+               gp_widget_get_label(capture, &widgetlabel);
+               int widgetid;
+               gp_widget_get_id(capture, &widgetid);
+               CameraWidgetType widgettype;
+               gp_widget_get_type(capture, &widgettype);
+               int one=1;
+               retval = gp_widget_set_value(capture, &one);
+               append_status(t, _("Enabling capture mode for Canon 
cameras.\n"));
+       }
 
-  g_debug("Get capture config.\n");
-  rootconfig = child;
-  retval = gp_widget_get_child_by_name(rootconfig, "capture", &child);
-       CHECKRETVAL(retval);
+       /* Nikon may need this*/
+       retval = gp_widget_get_child_by_name(actualrootconfig, "main", &child);
 
-  CameraWidget *capture = child;
-
-  const char *widgetinfo;
-  gp_widget_get_name(capture, &widgetinfo);
-  g_debug("config name: %s\n", widgetinfo );
-
-  const char *widgetlabel;
-  gp_widget_get_label(capture, &widgetlabel);
-  g_debug("config label: %s\n", widgetlabel);
-
-  int widgetid;
-  gp_widget_get_id(capture, &widgetid);
-  g_debug("config id: %d\n", widgetid);
-
-  CameraWidgetType widgettype;
-  gp_widget_get_type(capture, &widgettype);
-  g_debug("config type: %d == %d \n", widgettype, GP_WIDGET_TOGGLE);
-
-  int one=1;
-  retval = gp_widget_set_value(capture, &one);
-       CHECKRETVAL(retval);
-
-  g_debug("Enabling capture.\n");
+       if (retval >= 0)
+       {
+               rootconfig = child;
+               retval = gp_widget_get_child_by_name(rootconfig, "settings", 
&child);
+       }
+       
+       if (retval >= 0)
+       {
+               rootconfig = child;
+               retval = gp_widget_get_child_by_name(rootconfig, 
"recordingmedia", &child);
+       }
+       if (retval >= 0)
+       {
+               CameraWidget *capture = child;
+               CameraWidgetType widgettype;
+               gp_widget_get_type(capture, &widgettype);
+               const gchar* one = "SDRAM";
+               retval = gp_widget_set_value(capture, one);
+               append_status(t, _("Enabling capture mode for Nikon 
cameras.\n"));
+       }
+  g_debug("Enabling capture.");
   retval = gp_camera_set_config(t->camera, actualrootconfig, t->context);
        CHECKRETVAL(retval);
 
-  g_debug("Capture Enabled.\n");
+  g_debug("Capture Enabled.");
        append_status(t, _("Capture Enabled.\n"));
 
        return GP_OK;


_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit

Reply via email to