Re: sane_read returning *len == 0

David Mosberger-Tang (David.Mosberger@acm.org)
Fri, 3 Apr 1998 00:31:50 -0800

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

Chris> I am wondering what the defined action/status of sane_read()
Chris> should be if when it returns, the *len == 0. Is this
Chris> considered an error?

No. It simply means that no data is available.

Chris> The reason I ask is because I see this
Chris> handled (or not handled) 2 different ways in xscanimage/xcam
Chris> vs. scanimage. In working on the driver for my Artec
Chris> scanner, to get it working quickly, I had sane_read() reading
Chris> only 1 row of data from the scanner for each time the
Chris> function is invoked. Since when in color mode, there is an
Chris> offset between the RGB lines, the first few times sane_read()
Chris> is called, *len is set to 0. The status is still set to
Chris> SANE_STATUS_GOOD though. This works fine in scanimage
Chris> because it only looks at the returned status of sane_read().
Chris> In xscanimage and xcam though, I see that they check both the
Chris> status of sane_read() and the value of *len. If *len == 0,
Chris> they break out of the loop.

This is indeed a bug. Can you try changing xscanimage.c around line
584 to read like this:

if (scan_win.input_tag >= 0 && !len)
break; /* out of data for now */

and tell me how it works?

--david

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