Hi,
at the moment I am trying to look at the problems reported for Mustek 3-pass
scanners in color mode. I am using a MFS-12000CX scanner and lineart/gray
works fine.
Color mode, however, results in endless error messages after the 3rd (blue)
frame is scanned (both in xscanimage and xsane). The message is something
like "Error during read: scan was cancelled". This doesn't occur if
non_blocking mode is disabled in the backend.
I think the problem is in the frontends (correct me if I am wrong). The next
paragraphs are about xscanimage but I think it's the same with xsane.
At the start of the scan "scan_start" is called. "input_available" does the
reading of data and calls "scan_start" recursively until all 3 frames are
finished. At the end of "scan_start" "input_available" is called directly,
if the backend doesn't support non-blocking mode. That does work. However,
in the case of non-blocking mode, gdk_input_add is used to let gdk look at
the sane filedescriptor. However, gdk_input_add is called once for each
frame (3 times in total) and at the end of the scan only one instance is
killed (in "scan_done").
scan_win.input_tag = -1;
if (sane_set_io_mode (dev, SANE_TRUE) == SANE_STATUS_GOOD
&& sane_get_select_fd (dev, &fd) == SANE_STATUS_GOOD)
scan_win.input_tag = gdk_input_add (fd, GDK_INPUT_READ |
GDK_INPUT_EXCEPTION, input_available, 0);
else
input_available (0, -1, GDK_INPUT_READ);
As a quick hack I did the following:
if (sane_set_io_mode (dev, SANE_TRUE) == SANE_STATUS_GOOD
&& sane_get_select_fd (dev, &fd) == SANE_STATUS_GOOD)
{
if (scan_win.param.format != SANE_FRAME_GREEN
&& scan_win.param.format != SANE_FRAME_BLUE)
{
scan_win.input_tag = gdk_input_add (fd, GDK_INPUT_READ |
GDK_INPUT_EXCEPTION, input_available, 0);
}
}
else
{
scan_win.input_tag = -1;
input_available (0, -1, GDK_INPUT_READ);
}
This works for me. However, it is quite ugly and I don't know if the red
frame is the first in every case. So I think, it would be better to have a
flag for the first frame and don't use gdk_input_add for the others.
Another point: Don't try to scan an image with a 3-pass scanner into a pnm
file on a NFS disc. It is extremely slow (about 2k per second!), probably
because of the method used to put the three frames in the pnm file (write
one byte, fseek two bytes, write one byte ...).
One more point: The TODO file is right about the progress bar not reaching
100% at the end of each frame.
I tried to use the 3-pass scanner with scanimage but hadn't any luck because
the scan stops before the first frame gets read (sane_cancel is called). I
will look into this tomorrow.
Bye, Henning
-- Source code, list archive, and docs: http://www.mostang.com/sane/ To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com
This archive was generated by hypermail 2b29 : Fri Mar 31 2000 - 12:59:52 PST