2001-10-22 Lutz M�ller <urc8@rz.uni-karlsruhe.de>
* libgphoto2/gphoto2-camera.c: Autodetect also in case of
camera->port != NULL.
* frontends/command-line/main.c: Only call gp_camera_set_abilities
if a model has been specified. Same with gp_camera_set_port_path.
git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@2682 67ed7778-7388-44ab-90cf-0a291f65f57c
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
2001-10-22 Lutz Müller <urc8@rz.uni-karlsruhe.de>
|
||||
|
||||
* libgphoto2/gphoto2-camera.c: Autodetect also in case of
|
||||
camera->port != NULL.
|
||||
* frontends/command-line/main.c: Only call gp_camera_set_abilities
|
||||
if a model has been specified. Same with gp_camera_set_port_path.
|
||||
|
||||
2001-10-22 Fredrik <fredrik@krixor.xy.org>
|
||||
|
||||
* camlibs/canon/psa50.c:
|
||||
|
||||
@@ -917,7 +917,9 @@ OPTION_CALLBACK (about)
|
||||
static int
|
||||
set_globals (void)
|
||||
{
|
||||
CameraAbilitiesList *al;
|
||||
CameraAbilities abilities;
|
||||
int model;
|
||||
|
||||
/* takes all the settings and sets up the gphoto lib */
|
||||
|
||||
@@ -925,9 +927,20 @@ set_globals (void)
|
||||
|
||||
cli_debug_print ("Setting globals...");
|
||||
CHECK_RESULT (gp_camera_new (&glob_camera));
|
||||
CHECK_RESULT (gp_camera_abilities_by_name (glob_model, &abilities));
|
||||
CHECK_RESULT (gp_camera_set_abilities (glob_camera, abilities));
|
||||
if (strcmp (glob_model, "Directory Browse"))
|
||||
|
||||
/* Only set the model if the user specified one */
|
||||
if (strcmp ("", glob_model)) {
|
||||
CHECK_RESULT (gp_abilities_list_new (&al));
|
||||
CHECK_RESULT (gp_abilities_list_load (al));
|
||||
model = gp_abilities_list_lookup_model (al, glob_model);
|
||||
CHECK_RESULT (model);
|
||||
CHECK_RESULT (gp_abilities_list_get_abilities (al, model,
|
||||
&abilities));
|
||||
CHECK_RESULT (gp_camera_set_abilities (glob_camera, abilities));
|
||||
}
|
||||
|
||||
/* Only set the port if the user specified one */
|
||||
if (strcmp (glob_model, "Directory Browse") && strcmp ("", glob_port))
|
||||
CHECK_RESULT (gp_camera_set_port_path (glob_camera, glob_port));
|
||||
|
||||
/*
|
||||
|
||||
@@ -716,46 +716,45 @@ gp_camera_init (Camera *camera)
|
||||
camera->pc->a.model);
|
||||
|
||||
/*
|
||||
* If the port or the model hasn't been indicated, try to
|
||||
* If the model hasn't been indicated, try to
|
||||
* figure it out (USB only). Beware of "Directory Browse".
|
||||
*/
|
||||
if (strcasecmp (camera->pc->a.model, "Directory Browse")) {
|
||||
if (!camera->port || !strcmp ("", camera->pc->a.model)) {
|
||||
if (strcasecmp (camera->pc->a.model, "Directory Browse") &&
|
||||
!strcmp ("", camera->pc->a.model)) {
|
||||
|
||||
gp_log (GP_LOG_DEBUG, "gphoto2-camera", "Neither "
|
||||
"port nor model set. Trying auto-detection"
|
||||
"...");
|
||||
gp_log (GP_LOG_DEBUG, "gphoto2-camera", "Neither "
|
||||
"port nor model set. Trying auto-detection...");
|
||||
|
||||
/* Call auto-detect and choose the first camera */
|
||||
CRS (camera, gp_autodetect (&list));
|
||||
if (!gp_list_count (&list))
|
||||
return (GP_ERROR_MODEL_NOT_FOUND);
|
||||
|
||||
CRS (camera, gp_list_get_name (&list, 0, &model));
|
||||
CRS (camera, gp_camera_abilities_by_name (model, &a));
|
||||
CRS (camera, gp_camera_set_abilities (camera, a));
|
||||
CRS (camera, gp_camera_set_model (camera, model));
|
||||
CRS (camera, gp_list_get_value (&list, 0, &port));
|
||||
CRS (camera, gp_camera_set_port_path (camera, port));
|
||||
/* Call auto-detect and choose the first camera */
|
||||
CRS (camera, gp_autodetect (&list));
|
||||
if (!gp_list_count (&list)) {
|
||||
gp_log (GP_LOG_ERROR, "gphoto2-camera", _("Could not "
|
||||
"detect any camera"));
|
||||
return (GP_ERROR_MODEL_NOT_FOUND);
|
||||
}
|
||||
|
||||
CRS (camera, gp_list_get_name (&list, 0, &model));
|
||||
CRS (camera, gp_camera_abilities_by_name (model, &a));
|
||||
CRS (camera, gp_camera_set_abilities (camera, a));
|
||||
CRS (camera, gp_list_get_value (&list, 0, &port));
|
||||
CRS (camera, gp_camera_set_port_path (camera, port));
|
||||
}
|
||||
|
||||
/* If we don't have a port at this point, return error */
|
||||
if (!camera->port) {
|
||||
gp_camera_status (camera, "");
|
||||
return (GP_ERROR_UNKNOWN_PORT);
|
||||
}
|
||||
|
||||
/* In case of USB, find the device */
|
||||
switch (camera->port->type) {
|
||||
case GP_PORT_USB:
|
||||
CRS (camera, gp_port_usb_find_device (camera->port,
|
||||
camera->pc->a.usb_vendor,
|
||||
camera->pc->a.usb_product));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
/* If we don't have a port at this point, return error */
|
||||
if (!camera->port) {
|
||||
gp_camera_status (camera, "");
|
||||
return (GP_ERROR_UNKNOWN_PORT);
|
||||
}
|
||||
|
||||
/* In case of USB, find the device */
|
||||
switch (camera->port->type) {
|
||||
case GP_PORT_USB:
|
||||
CRS (camera, gp_port_usb_find_device (camera->port,
|
||||
camera->pc->a.usb_vendor,
|
||||
camera->pc->a.usb_product));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* Load the library. */
|
||||
|
||||
Reference in New Issue
Block a user