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!786
commit
de9f132419
|
@ -2635,22 +2635,34 @@ sane_get_parameters(SANE_Handle handle, SANE_Parameters *params)
|
|||
if (params == NULL)
|
||||
DBG(1, "%s: params is NULL\n", __func__);
|
||||
|
||||
|
||||
/*
|
||||
* If sane_start was already called, then just retrieve the parameters
|
||||
* from the scanner data structure
|
||||
* If scanning then make sure that we acquire an image before we proceed
|
||||
* 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");
|
||||
|
||||
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 {
|
||||
/* otherwise initialize the params structure */
|
||||
eds_init_parameters(s);
|
||||
}
|
||||
|
||||
|
||||
SANE_Status status = SANE_STATUS_GOOD;
|
||||
|
||||
status = get_next_image(s);
|
||||
|
||||
// if size auto, update page size value
|
||||
if(s->val[OPT_ADF_CRP].w)
|
||||
{
|
||||
|
@ -2713,7 +2725,7 @@ sane_get_parameters(SANE_Handle handle, SANE_Parameters *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 );
|
||||
return status;
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
|
||||
|
@ -3311,6 +3323,10 @@ sane_start(SANE_Handle handle)
|
|||
s->scanning = 1;
|
||||
s->dummy = 0;
|
||||
s->scanEnd = 0;
|
||||
|
||||
/* acquire the first image. */
|
||||
status = get_next_image(s);
|
||||
|
||||
end:
|
||||
if (status != SANE_STATUS_GOOD) {
|
||||
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
|
||||
if (read == 0) {
|
||||
*length = 0;
|
||||
eds_ring_flush(s->current);
|
||||
eds_ring_destory(s->current);
|
||||
DBG(18, "returns EOF 2\n");
|
||||
return SANE_STATUS_EOF;
|
||||
|
||||
// This is silly: we already established above that there is data available.
|
||||
// eds_ring_flush(s->current);
|
||||
// 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;
|
||||
|
||||
|
|
|
@ -1771,6 +1771,10 @@ do_scan (Wire * w, int h, int data_fd)
|
|||
/* get more input data */
|
||||
|
||||
/* 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;
|
||||
reader += 4;
|
||||
if (reader >= (int) buffer_size)
|
||||
|
|
Ładowanie…
Reference in New Issue