5 #include <gphoto2/gphoto2-camera.h>
9 /* Sample autodetection program.
11 * This program can autodetect a single camera and then calls a
12 * simple function in it (summary).
15 int main(int argc, char **argv) {
22 context = sample_create_context (); /* see context.c */
23 gp_camera_new (&camera);
25 /* This call will autodetect cameras, take the
26 * first one from the list and use it. It will ignore
27 * any others... See the *multi* examples on how to
28 * detect and use more than the first one.
30 ret = gp_camera_init (camera, context);
32 printf("No camera auto detected.\n");
33 gp_camera_free (camera);
37 /* Simple query the camera summary text */
38 ret = gp_camera_get_summary (camera, &text, context);
40 printf("Camera failed retrieving summary.\n");
41 gp_camera_free (camera);
44 printf("Summary:\n%s\n", text.text);
46 /* Simple query of a string configuration variable. */
47 ret = get_config_value_string (camera, "owner", &owner, context);
49 printf("Owner: %s\n", owner);
52 gp_camera_exit (camera, context);
53 gp_camera_free (camera);