Commit 7a8ae928 authored by Stanislav Yuzvinsky's avatar Stanislav Yuzvinsky

ricoh2: Rearrange init/deinit code of ricoh2 to correctly support "code flow"

The backend worked incorrectly when scanning process was interrupted before the
current page was scanned completely. For example, scanimage tool could not scan
the next page if the previous one was interrupted. Now this issue is fixed.

See also "4.4. Code Flow" in SANE API specification v.1.06.

Also debug levels was changed to have better control over what should be
logged.
parent e13b80fa
This diff is collapsed.
......@@ -97,7 +97,7 @@ ricoh2_buffer_create (SANE_Int size,
self->remain_in_line = pixels_per_line;
DBG (100,
DBG (192,
"size = %d pixels_per_line = %d info_size = %d rgb? = %d pos = %d\n",
self->size,
self->pixels_per_line,
......@@ -121,12 +121,12 @@ static SANE_Byte *
ricoh2_buffer_get_internal_buffer (ricoh2_buffer *self)
{
assert (self);
DBG (100, "engaging a buffer of size %d\n", self->size);
DBG (192, "engaging a buffer of size %d\n", self->size);
self->current_position = 0;
self->remain_in_line = self->pixels_per_line;
DBG (100, "remain in line = %d\n", self->remain_in_line);
DBG (192, "remain in line = %d\n", self->remain_in_line);
return self->data;
}
......@@ -136,7 +136,7 @@ ricoh2_buffer_get_bytes_remain (ricoh2_buffer *self)
{
assert (self);
DBG (100,
DBG (192,
"bytes remain in the buffer %d\n",
self->size - self->current_position);
......@@ -168,7 +168,7 @@ ricoh2_buffer_get_data (ricoh2_buffer *self,
bytes_per_pixel = self->is_rgb ? 3 : 1;
bytes_per_color = self->pixels_per_line + self->info_size;
DBG (2,
DBG (192,
"trying to get %d bytes from the buffer, "
"while %d bytes in the line\n",
dest_size,
......@@ -181,7 +181,7 @@ ricoh2_buffer_get_data (ricoh2_buffer *self,
min (dest_size / bytes_per_pixel, self->remain_in_line))
{
DBG (2,
DBG (192,
"providing %d bytes to the user (until the end of the line), "
"position in buffer is %d\n",
pixels_to_copy * bytes_per_pixel,
......@@ -212,12 +212,12 @@ ricoh2_buffer_get_data (ricoh2_buffer *self,
if (self->is_rgb)
self->current_position += 2 * bytes_per_color;
self->remain_in_line = self->pixels_per_line;
DBG (100,
DBG (192,
"Line feed, new position is %d\n",
self->current_position);
}
DBG (100,
DBG (192,
"left in the buffer: %d\n",
self->size - self->current_position);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment