* library.c (dc240_packet_read): handle COMM0 error packet
(dc240_packet_exchange): handle a GP_ERROR_NOT_SUPPORTED returned by dc240_packet_read Fix bug #499404 git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@4198 67ed7778-7388-44ab-90cf-0a291f65f57c
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
2002-02-21 Peter Fales <psfales@lucent.com>
|
||||
|
||||
* library.c (dc240_packet_read): handle COMM0 error packet
|
||||
(dc240_packet_exchange): handle a GP_ERROR_NOT_SUPPORTED returned by
|
||||
dc240_packet_read
|
||||
Fix bug #499404
|
||||
|
||||
2002-01-19 Lutz Müller <lutz@users.sourceforge.net>
|
||||
|
||||
* library.c (dc240_capture): free (file) -> gp_file_unref (file)
|
||||
|
||||
@@ -143,9 +143,22 @@ write_again:
|
||||
return GP_OK;
|
||||
}
|
||||
|
||||
static int dc240_packet_read (Camera *camera, char *packet, int size) {
|
||||
static int
|
||||
dc240_packet_read (Camera *camera, char *packet, int size)
|
||||
{
|
||||
|
||||
int retval = gp_port_read(camera->port, packet, size);
|
||||
|
||||
/*
|
||||
* If we try to read data about a non-picture file, we get back
|
||||
* a single COMM0 byte. So, if we're trying to read a packet with
|
||||
* size greater than one, but we only get one byte, and it is a
|
||||
* COMM0 error, return failure
|
||||
*/
|
||||
if ((size > 1) && (retval == 1) && ((unsigned char)packet[0] == COMM0)) {
|
||||
return GP_ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
if (retval < GP_OK) {
|
||||
return retval;
|
||||
}
|
||||
@@ -300,6 +313,11 @@ read_data_read_again:
|
||||
|
||||
/* Read the response/data */
|
||||
retval = dc240_packet_read(camera, packet, block_size+2);
|
||||
|
||||
if (retval == GP_ERROR_NOT_SUPPORTED) {
|
||||
return retval;
|
||||
}
|
||||
|
||||
if ((retval == GP_ERROR) || (retval == GP_ERROR_TIMEOUT)) {
|
||||
/* ERROR reading response/data */
|
||||
if (retries++ > RETRIES)
|
||||
|
||||
Reference in New Issue
Block a user