[sane-devel] HP5470c scanner nearly working!

Bertrik Sikken bertrik@zonnet.nl
Sat, 22 Feb 2003 14:06:31 +0100


Martijn van Oosterhout wrote:

>>>5. Turn it into a SANE backend. Hopefully this will not be hard.
>>>
>>>
>>I won't mind helping you with this.
>>What I did with the hp3300 was to put the core functionality in one
>>source file. Then on top of this, I could put either a sane interface
>>(which is quite simple) or a frontend for a console testtool.
>>
>
>Thanks for that. My main questions are: what functions do you need to
>implement and is it backend push or caller pull for the data? Maybe I'll
>look through the source for the hp3300 driver to see what I can do.
>
There is a document somewhere on www.mostang.com/sane which describes
the sane api quite well.
The frontend pulls data from the backend (by means of the sane_read 
function)

The sane api allows a lot of flexibility for scanner settings, by letting
the scanner backend present a set of options to the scanner frontend.
For example the backend can present the vertical scan position as
a value in the range 0..300 with unit mm. Another example is scan
resolution which can take on one of a set of discrete values
{75, 150, 300, 600, 1200} with unit dpi.
You can probably copy the mechanism for informing the frontend about
these options and for setting / getting the values of these options
from other backends without making a lot of changes.

Some important functions in the sane api are
* sane_get_parameters, which reports the actual size in pixels and bytes
if the scan would be done with the currently set scanner settings.
So you may need to convert from mm to pixels here.
* sane_start, which indicates that image capture should be started.
Here you could probably convert the scan options into values / tables
that the scanner hardware understands.
* sane_read, which reads chunks of image data.

Regards,
Bertrik