2002-04-19 Lutz M�ller <lutz@users.sourceforge.net>

* library.c: If we tell the camera to switch to another speed, we
          need to change the port's speed, too.


git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@4453 67ed7778-7388-44ab-90cf-0a291f65f57c
This commit is contained in:
Lutz Mueller
2002-04-19 07:24:06 +00:00
parent 4068810fb6
commit 8e55fef6db
3 changed files with 32 additions and 1 deletions

View File

@@ -1,3 +1,8 @@
2002-04-19 Lutz Müller <lutz@users.sourceforge.net>
* library.c: If we tell the camera to switch to another speed, we
need to change the port's speed, too.
2002-04-18 Lutz Müller <lutz@users.sourceforge.net>
* library.c

View File

@@ -91,6 +91,9 @@
#define ETB 0x17 /* End of transmission block */
#define NAK 0x15
#define FUJI_ACK 0x00
#define FUJI_NAK 0x01
#if 0
#define FUJI_GET_PICCOUNT 0x0b
@@ -784,7 +787,14 @@ fuji_set_speed (Camera *camera, FujiSpeed speed, GPContext *context)
CLEN (buf_len, 1);
/* Check the response */
if (buf[0] != 0) {
switch (buf[0]) {
case FUJI_ACK:
break;
case FUJI_NAK:
gp_context_error (context, _("The camera does not "
"support speed %i."), speed);
return (GP_ERROR_NOT_SUPPORTED);
default:
gp_context_error (context, _("Could not set speed to "
"%i (camera responded with %i)."), speed, buf[0]);
return (GP_ERROR);

View File

@@ -257,9 +257,11 @@ pre_func (Camera *camera, GPContext *context)
{
int r;
unsigned int i;
GPPortSettings settings;
GP_DEBUG ("Initializing connection...");
CR (gp_port_get_settings (camera->port, &settings));
CR (fuji_ping (camera, context));
if (!camera->pl->speed) {
@@ -269,6 +271,13 @@ pre_func (Camera *camera, GPContext *context)
if (r >= 0)
break;
}
/*
* Change the port's speed and check if the camera is
* still there.
*/
settings.serial.speed = Speeds[i].bit_rate;
CR (gp_port_set_settings (camera->port, settings));
CR (fuji_ping (camera, context));
} else {
@@ -286,6 +295,13 @@ pre_func (Camera *camera, GPContext *context)
/* Change the speed if necessary. */
if (camera->pl->speed != Speeds[i].bit_rate) {
CR (fuji_set_speed (camera, Speeds[i].speed, context));
/*
* Change the port's speed and check if the camera is
* still there.
*/
settings.serial.speed = Speeds[i].bit_rate;
CR (gp_port_set_settings (camera->port, settings));
CR (fuji_ping (camera, context));
}
}