sane_read returning *len == 0

Chris Pinkham (cpinkham@billing.infi.net)
Thu, 2 Apr 1998 12:35:58 -0500 (EST)

I am wondering what the defined action/status of sane_read() should be if
when it returns, the *len == 0. Is this considered an error? The reason
I ask is because I see this handled (or not handled) 2 different ways in
xscanimage/xcam vs. scanimage. In working on the driver for my Artec
scanner, to get it working quickly, I had sane_read() reading only 1 row
of data from the scanner for each time the function is invoked. Since
when in color mode, there is an offset between the RGB lines, the first
few times sane_read() is called, *len is set to 0. The status is still
set to SANE_STATUS_GOOD though. This works fine in scanimage because it
only looks at the returned status of sane_read(). In xscanimage and xcam
though, I see that they check both the status of sane_read() and the
value of *len. If *len == 0, they break out of the loop. Basically
I'm asking is if sane_read() should ever return *len == 0 unless it is
also returning some other status than SANE_STATUS_GOOD. I am currently
modifying my sane_read() to read as many lines as possible into the buffer
before returning, so the problem of *len == 0 shouldn't occur then, but
I'm still wondering if *len == 0 occurs while sane_read() == SANE_STATUS_GOOD
is to be considered an error by the application.

I think I repeated repeated myself myself in there, but I just wanted to
make sure it was clear what I was asking. (probably didn't help though) :)

Chris

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
| Chris Pinkham |
| cpinkham@sh001.infi.net |
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

--
Source code, list archive, and docs: http://www.mostang.com/sane/
To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com