diff --git a/camlibs/fuji/ChangeLog b/camlibs/fuji/ChangeLog index 5df6cf3c6..bf6ba42fd 100644 --- a/camlibs/fuji/ChangeLog +++ b/camlibs/fuji/ChangeLog @@ -1,3 +1,8 @@ +2002-04-19 Lutz Müller + + * 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 * library.c diff --git a/camlibs/fuji/fuji.c b/camlibs/fuji/fuji.c index e772ca79d..103aa5809 100644 --- a/camlibs/fuji/fuji.c +++ b/camlibs/fuji/fuji.c @@ -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); diff --git a/camlibs/fuji/library.c b/camlibs/fuji/library.c index 331889317..64082e5af 100644 --- a/camlibs/fuji/library.c +++ b/camlibs/fuji/library.c @@ -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)); } }