kopia lustrzana https://gitlab.com/sane-project/backends
Return NO_DOCS after last ADF page, not IO_ERROR
When scanning from ADF in MP150 based scanners, after the last page is scanned the XML session-close was sent. However, when using the ADF, if the frontend called sane_start/sane_read(), it would try and send an XML command that was not valid after the session abort. This would give an IO error up through the stack. Now, check if ADF scanning is happening and on reads after the last page return SANE_STATUS_NO_DOCS on read. and abort. Finally, minor fix of max DPI for Pixma MAXIFY MB21xx/27xx to 1200 DPI.merge-requests/2/head
rodzic
9d315bc2f7
commit
5e5183c84e
|
@ -1462,7 +1462,22 @@ read_image (pixma_sane_t * ss, void *buf, unsigned size, int *readlen)
|
|||
{
|
||||
status = pixma_jpeg_read_header(ss);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
return status;
|
||||
{
|
||||
close (ss->rpipe);
|
||||
pixma_jpeg_finish(ss);
|
||||
ss->rpipe = -1;
|
||||
if (sanei_thread_is_valid (terminate_reader_task (ss, &status))
|
||||
&& status != SANE_STATUS_GOOD)
|
||||
{
|
||||
return status;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* either terminate_reader_task failed or
|
||||
rpipe was closed but we expect more data */
|
||||
return SANE_STATUS_IO_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ss->sp.mode_jpeg)
|
||||
|
@ -1829,6 +1844,22 @@ sane_start (SANE_Handle h)
|
|||
ss->last_read_status = SANE_STATUS_GOOD;
|
||||
ss->scanning = SANE_TRUE;
|
||||
ss->idle = SANE_FALSE;
|
||||
if (ss->sp.mode_jpeg && !ss->jpeg_header_seen)
|
||||
{
|
||||
SANE_Status status;
|
||||
status = pixma_jpeg_read_header(ss);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
{
|
||||
close (ss->rpipe);
|
||||
pixma_jpeg_finish(ss);
|
||||
ss->rpipe = -1;
|
||||
if (sanei_thread_is_valid (terminate_reader_task (ss, &error))
|
||||
&& error != SANE_STATUS_GOOD)
|
||||
{
|
||||
return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return map_error (error);
|
||||
}
|
||||
|
|
|
@ -1422,6 +1422,12 @@ mp150_scan (pixma_t * s)
|
|||
if (mp->state != state_idle)
|
||||
return PIXMA_EBUSY;
|
||||
|
||||
/* no paper inserted after first adf page => abort session */
|
||||
if (s->param->adf_pageid && is_scanning_from_adf(s) && mp->adf_state == state_idle)
|
||||
{
|
||||
return PIXMA_ENO_PAPER;
|
||||
}
|
||||
|
||||
/* Generation 4+: send XML dialog */
|
||||
/* adf: first page or idle */
|
||||
if (mp->generation >= 4 && mp->adf_state == state_idle)
|
||||
|
@ -1877,9 +1883,9 @@ const pixma_config_t pixma_mp150_devices[] = {
|
|||
DEVICE ("Canon MAXIFY MB5000 Series", "MB5000", MB5000_PID, 1200, 0, 0, 638, 1050, PIXMA_CAP_CIS | PIXMA_CAP_ADFDUP),
|
||||
DEVICE ("Canon MAXIFY MB5300 Series", "MB5300", MB5300_PID, 1200, 0, 0, 638, 1050, PIXMA_CAP_CIS | PIXMA_CAP_ADFDUP),
|
||||
DEVICE ("Canon MAXIFY MB2000 Series", "MB2000", MB2000_PID, 1200, 0, 0, 638, 1050, PIXMA_CAP_CIS | PIXMA_CAP_ADFDUP),
|
||||
DEVICE ("Canon MAXIFY MB2100 Series", "MB2100", MB2100_PID, 600, 0, 0, 638, 1050, PIXMA_CAP_CIS | PIXMA_CAP_ADF | PIXMA_CAP_ADF_JPEG),
|
||||
DEVICE ("Canon MAXIFY MB2100 Series", "MB2100", MB2100_PID, 1200, 0, 0, 638, 1050, PIXMA_CAP_CIS | PIXMA_CAP_ADF | PIXMA_CAP_ADF_JPEG),
|
||||
DEVICE ("Canon MAXIFY MB2300 Series", "MB2300", MB2300_PID, 1200, 0, 0, 638, 1050, PIXMA_CAP_CIS | PIXMA_CAP_ADF),
|
||||
DEVICE ("Canon MAXIFY MB2700 Series", "MB2700", MB2700_PID, 600, 0, 0, 638, 1050, PIXMA_CAP_CIS | PIXMA_CAP_ADF | PIXMA_CAP_ADF_JPEG),
|
||||
DEVICE ("Canon MAXIFY MB2700 Series", "MB2700", MB2700_PID, 1200, 0, 0, 638, 1050, PIXMA_CAP_CIS | PIXMA_CAP_ADF | PIXMA_CAP_ADF_JPEG),
|
||||
DEVICE ("Canon PIXMA E400", "E400", E400_PID, 600, 0, 0, 638, 877, PIXMA_CAP_CIS),
|
||||
DEVICE ("Canon PIXMA E560", "E560", E560_PID, 1200, 0, 0, 638, 877, PIXMA_CAP_CIS),
|
||||
DEVICE ("Canon PIXMA MG7500 Series", "MG7500", MG7500_PID, 2400, 0, 0, 638, 877, PIXMA_CAP_CIS),
|
||||
|
|
Ładowanie…
Reference in New Issue