kopia lustrzana https://gitlab.com/sane-project/backends
Merge branch '666-epsonds-has-issues-with-saned' into 'master'
Draft: Resolve "epsonds has issues with saned" Closes #666 See merge request sane-project/backends!786merge-requests/786/merge
commit
47eb09f814
|
@ -2635,22 +2635,34 @@ sane_get_parameters(SANE_Handle handle, SANE_Parameters *params)
|
||||||
if (params == NULL)
|
if (params == NULL)
|
||||||
DBG(1, "%s: params is NULL\n", __func__);
|
DBG(1, "%s: params is NULL\n", __func__);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If sane_start was already called, then just retrieve the parameters
|
* If scanning then make sure that we acquire an image before we proceed
|
||||||
* from the scanner data structure
|
* if we didn't before. It is unlikely that s->scanning can be true and we have
|
||||||
|
* not acquired an image yet but let us be sure.
|
||||||
|
*
|
||||||
|
* Otherwise, we will generate parameters purely from the current settings
|
||||||
|
* rather than anything we got from the current image.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
if (s->scanning) {
|
if (s->scanning)
|
||||||
|
{
|
||||||
DBG(5, "scan in progress, returning saved params structure\n");
|
DBG(5, "scan in progress, returning saved params structure\n");
|
||||||
|
|
||||||
|
if (s->acquirePage == 0)
|
||||||
|
{
|
||||||
|
SANE_Status status = get_next_image(s);
|
||||||
|
if (status != SANE_STATUS_GOOD)
|
||||||
|
{
|
||||||
|
DBG(1, "failed to acquire image for parameters.\n");
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
/* otherwise initialize the params structure */
|
/* otherwise initialize the params structure */
|
||||||
eds_init_parameters(s);
|
eds_init_parameters(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SANE_Status status = SANE_STATUS_GOOD;
|
|
||||||
|
|
||||||
status = get_next_image(s);
|
|
||||||
|
|
||||||
// if size auto, update page size value
|
// if size auto, update page size value
|
||||||
if(s->val[OPT_ADF_CRP].w)
|
if(s->val[OPT_ADF_CRP].w)
|
||||||
{
|
{
|
||||||
|
@ -2713,7 +2725,7 @@ sane_get_parameters(SANE_Handle handle, SANE_Parameters *params)
|
||||||
print_params(s->params);
|
print_params(s->params);
|
||||||
|
|
||||||
DBG(20, "s->params.line = %d s->params.bytes_per_line = %d s->params.pixels_per_line = %d \n", s->params.lines, s->params.bytes_per_line , s->params.pixels_per_line );
|
DBG(20, "s->params.line = %d s->params.bytes_per_line = %d s->params.pixels_per_line = %d \n", s->params.lines, s->params.bytes_per_line , s->params.pixels_per_line );
|
||||||
return status;
|
return SANE_STATUS_GOOD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3311,6 +3323,10 @@ sane_start(SANE_Handle handle)
|
||||||
s->scanning = 1;
|
s->scanning = 1;
|
||||||
s->dummy = 0;
|
s->dummy = 0;
|
||||||
s->scanEnd = 0;
|
s->scanEnd = 0;
|
||||||
|
|
||||||
|
/* acquire the first image. */
|
||||||
|
status = get_next_image(s);
|
||||||
|
|
||||||
end:
|
end:
|
||||||
if (status != SANE_STATUS_GOOD) {
|
if (status != SANE_STATUS_GOOD) {
|
||||||
DBG(1, "%s: start failed: %s\n", __func__, sane_strstatus(status));
|
DBG(1, "%s: start failed: %s\n", __func__, sane_strstatus(status));
|
||||||
|
@ -3603,10 +3619,12 @@ sane_read(SANE_Handle handle, SANE_Byte *data, SANE_Int max_length, SANE_Int *le
|
||||||
// data is empty fin
|
// data is empty fin
|
||||||
if (read == 0) {
|
if (read == 0) {
|
||||||
*length = 0;
|
*length = 0;
|
||||||
eds_ring_flush(s->current);
|
|
||||||
eds_ring_destory(s->current);
|
// This is silly: we already established above that there is data available.
|
||||||
DBG(18, "returns EOF 2\n");
|
// eds_ring_flush(s->current);
|
||||||
return SANE_STATUS_EOF;
|
// eds_ring_destory(s->current);
|
||||||
|
DBG(18, "Couldn't read anything from ring buffer: probably not enough capacity to receive.\n");
|
||||||
|
return SANE_STATUS_GOOD;
|
||||||
}
|
}
|
||||||
*length = read;
|
*length = read;
|
||||||
|
|
||||||
|
|
|
@ -1796,6 +1796,10 @@ do_scan (Wire * w, int h, int data_fd)
|
||||||
/* get more input data */
|
/* get more input data */
|
||||||
|
|
||||||
/* reserve 4 bytes to store the length of the data record: */
|
/* reserve 4 bytes to store the length of the data record: */
|
||||||
|
|
||||||
|
/* NOTE: it seems to me that we could dispense with the record if we read nothing from sane_read() */
|
||||||
|
/* Consider an optimization whereby we add nothing to the ring buffer in this case. */
|
||||||
|
/* I do need to check the semantics of this though. [RL] */
|
||||||
i = reader;
|
i = reader;
|
||||||
reader += 4;
|
reader += 4;
|
||||||
if (reader >= (int) buffer_size)
|
if (reader >= (int) buffer_size)
|
||||||
|
|
Ładowanie…
Reference in New Issue