Hi,
we've discussed how to handle duplex in a backend; the almost-
consensus was to have the scanner scan both sides when the first
"sane_start" is issued, but only return the front page, and then when
a second "sane_start" follows, return the back side.
As mentioned earlier, my driver uses a separate process for reading
from the scanner; that process also decodes the image in front and
back, and caches the back page. It writes its output to a pipe,
which is read from the other process, within "sane_read". "sane_read"
normally reads until the other end closes the pipe. Currently, for
testing, I just write the front and back pages to the pipe, resulting
in an image that is twice as high as requested.
I have to change that somehow, to let sane_read know when to stop
reading *although there's still data available* (and return that
additional data only after another sane_start has been called).
There's a myriad of ways to possibly do it and I am not sure how to
proceed. Some ideas:
+ Let sane_start calculate the number of bytes expected, and
let sane_read stop reading after that number of bytes. This
would be easy to implement but what if e.g. the paper in the
scanner is shorter than expected?
+ Instead of sending raw image data over the pipe, let the reader
process send a header first - something that describes the
nature and amount of data to follow. However, such a header
would be most useful if it was already available when the
front-end calls "sane_get_parameters", wouldn't it?
+ Open a second pipe between the backend and its reader process
and use that pipe to transfer control information - either FROM
the reader process ("image 01 follows, 123456 bytes") or TO
the reader process ("send image 01 now").
+ Use IPC to communicate between reader process and backend...
Any suggestions?
Thanks
Frederik
-- Frederik Ramm ## eMail frederik@remote.org ## N57°48.10' W005°40.32'-- 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 02 2001 - 10:10:43 PST