[sane-devel] basic hs2p backend working
jazz_johnson at verizon.net
jazz_johnson at verizon.net
Tue Oct 30 04:38:45 UTC 2007
I've finally got the major features of the IS450 working
but would appreciate some advice on implementing reading duplex window data in SANE.
in sane_start() I have something like:
select Flatbed/ADF scan source
if ADF select simplex/duplex (continuous?)
select endorser and endorser string
select lineart/halftone(dither/error diffusion)/4-bit gray/8-bit gray
if HALFTONE select halftone pattern
select basic measurement unit
select scan wait mode
select gamma pre-sets
select b/w filters and gray filters
select xy resolution
select window coordinates for scanning
wait for data ready
calculate number of bytes to read
read some data
decrement the amount of remaining data to be read by the amount actually read
I need to read two windows of data but have the sane-frontend realize that the data
is to be saved into a frontside and backside for each sheet and not just one long page.
I have an sp15c which duplexes so I've been looking over the sp15c backend
which uses threads and arrays of pipes neither of which my backend uses.
One further issue about Flow Control:
At the back of the HS2P Manual four methods of flow control are shown:
1) Normal (The method used in the backends I've drawn from */
reserve unit -> mode select -> set window -> trigger scan -> wait for data ready -> read until done -> release unit
2) Fast (Ricoh Recommended method)
reserve unit -> mode select -> set window --------------------------------------------------------> read until done -> release unit
3) continuous scanning
4) scanning with automatic size detection (available only if IPU installed)
Once I get the duplexing working, I'd may try to implement continuous ADF simplex scanning as an option.
I was wondering if any other backends implement continuous scanning? Basically I would need to keep
reading a buffer's worth of data until the last partial buffer.
If I scan a letter sheet as legal on my sp15c ADF, the ADF will hold the letter page when it reaches the end of the sheet
and continue scanning blank lines until it reaches the requested legal length, after which it ejects the letter-size sheet.
Xsane then saves the scan as a legal-sized document, padded with white space at the bottom.
If I try the same thing with my hs2p backend (requesting legal-sized document with letter-sized documents on ADF),
it will scan just one letter length, eject the sheet, and return READ_ERROR
which xsane will see as an I/O read error and then not save anything at all.
So I'm wondering how other backends treat incomplete reads.
Do they pad with white space, return I/O Error, or just truncate the page at the actual length scanned?
There are some other features of the IS450, such as reading/setting IPU parameters and sub-window sections,
and reading/setting maintenance data (EEPROM registers and what not) which I'll not implement any time soon,
since I don't have an IPU and I don't see the necessity of cluttering up the advanced window of xsane with a whole
lot of extra options. However, the scanner does have the capability of uploading user-definable halftone patterns
and gamma tables. I have an epson scanner which Epson's Iscan software allows me to click-and-drag the gamma
table curve to define a (quadratic or cubic?) spline to apply to the intensity data. None of the sane backends I've
used has such a feature, but if xsane had such an option to let the user define a gamma vector table, then my
hs2p backend could easily upload such a vector to the scanner. Of course if you're running xsane as a plugin
through gimp, then gimp already provides such data manipulation and more, so then there's probably no need
for the scanner to do image manipulation.
The IS450 and IS420 family of scanners are supposedly similar. I've tried to take into account the
differences detailed at the back of the HS2P Manual. If someone has an IS420 or IS430 and would
like to tryout my hs2p backend, directions can be found here:
THANKS for any insights.
More information about the sane-devel