kopia lustrzana https://gitlab.com/sane-project/backends
pixma: retry image retrieval for Canon MF3228. Fixes #442
`read_image_block` needs retry code for this MFP, otherwise `iclass_fill_buffer` tries to send another `request_image_block` command, which the printer does not accept when the previous data haven't been read yet, and it enters an endless loop. This commit is an attempt to fix this issue, by "increasing" the timeout up to 15 seconds. It retries 15 times, waiting up to 1100 ms between retries (1s USB timeout with `HAVE_SANEI_USB_SET_TIMEOUT` + `pixma_sleep`).merge-requests/870/head
rodzic
a9ad50fe56
commit
c0eb7aa9ab
|
@ -75,6 +75,7 @@
|
|||
#define D480_PID 0x26ed
|
||||
#define MF4320_PID 0x26ee
|
||||
#define D420_PID 0x26ef
|
||||
/* also used for MF3228 */
|
||||
#define MF3200_PID 0x2684
|
||||
#define MF6500_PID 0x2686
|
||||
#define IR1018_PID 0x269d
|
||||
|
@ -371,7 +372,7 @@ static int
|
|||
read_image_block (pixma_t * s, uint8_t * data, unsigned size)
|
||||
{
|
||||
iclass_t *mf = (iclass_t *) s->subdriver;
|
||||
int error;
|
||||
int error, i;
|
||||
unsigned maxchunksize, chunksize, count = 0;
|
||||
|
||||
maxchunksize = MAX_CHUNK_SIZE * ((mf->generation >= 2 ||
|
||||
|
@ -387,7 +388,20 @@ read_image_block (pixma_t * s, uint8_t * data, unsigned size)
|
|||
chunksize = size;
|
||||
else
|
||||
chunksize = size - (size % MIN_CHUNK_SIZE);
|
||||
error = pixma_read (s->io, data, chunksize);
|
||||
for (i=0; i<15; i++) {
|
||||
error = pixma_read (s->io, data, chunksize);
|
||||
if (s->cfg->pid == MF3200_PID) {
|
||||
PDBG (pixma_dbg
|
||||
(1, "Using increased timeout for MF3228\n"));
|
||||
if (error == PIXMA_ETIMEDOUT) {
|
||||
PDBG (pixma_dbg
|
||||
(1, "Timeout in read_image_block, waiting 100ms and trying again\n"));
|
||||
pixma_sleep (100000);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (error < 0)
|
||||
return count;
|
||||
count += error;
|
||||
|
|
Ładowanie…
Reference in New Issue