diff options
author | Marcus Meissner <marcus@jet.franken.de> | 2009-11-29 20:48:28 +0000 |
---|---|---|
committer | Marcus Meissner <marcus@jet.franken.de> | 2009-11-29 20:48:28 +0000 |
commit | 3135caf5d3dab4109dfcb7787b6940b50e071855 (patch) | |
tree | 5547213ce6090f051692de51c34ed08e4979755c /examples | |
parent | a7a9a9f6c2d6ce710215907dff0fbb614215ca72 (diff) | |
download | libgphoto2-3135caf5d3dab4109dfcb7787b6940b50e071855.tar.gz |
shorten autodetect to use the new gp_camera_autodetect call
git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@12533 67ed7778-7388-44ab-90cf-0a291f65f57c
Diffstat (limited to 'examples')
-rw-r--r-- | examples/autodetect.c | 40 |
1 files changed, 2 insertions, 38 deletions
diff --git a/examples/autodetect.c b/examples/autodetect.c index 4814aabad..c610233c0 100644 --- a/examples/autodetect.c +++ b/examples/autodetect.c @@ -16,44 +16,8 @@ static CameraAbilitiesList *abilities = NULL; */ int sample_autodetect (CameraList *list, GPContext *context) { - int ret, i; - CameraList *xlist = NULL; - - ret = gp_list_new (&xlist); - if (ret < GP_OK) goto out; - if (!portinfolist) { - /* Load all the port drivers we have... */ - ret = gp_port_info_list_new (&portinfolist); - if (ret < GP_OK) goto out; - ret = gp_port_info_list_load (portinfolist); - if (ret < 0) goto out; - ret = gp_port_info_list_count (portinfolist); - if (ret < 0) goto out; - } - /* Load all the camera drivers we have... */ - ret = gp_abilities_list_new (&abilities); - if (ret < GP_OK) goto out; - ret = gp_abilities_list_load (abilities, context); - if (ret < GP_OK) goto out; - - /* ... and autodetect the currently attached cameras. */ - ret = gp_abilities_list_detect (abilities, portinfolist, xlist, context); - if (ret < GP_OK) goto out; - - /* Filter out the "usb:" entry */ - ret = gp_list_count (xlist); - if (ret < GP_OK) goto out; - for (i=0;i<ret;i++) { - const char *name, *value; - - gp_list_get_name (xlist, i, &name); - gp_list_get_value (xlist, i, &value); - if (!strcmp ("usb:",value)) continue; - gp_list_append (list, name, value); - } -out: - gp_list_free (xlist); - return gp_list_count(list); + gp_list_reset (&list); + return gp_camera_autodetect (list, context); } /* |