Re: snapscan

From: Henning Meier-Geinitz (
Date: Wed Jan 10 2001 - 11:17:04 PST

  • Next message: abel deuring: "Re: SANE and Linux kernel 2.4.0"


    On Wed, Jan 10, 2001 at 11:21:03AM +0100, Christian Nassau wrote:
    > *** Remarks on blocking/non-blocking mode
    > There seems to be some confusion or unclarity what one
    > should mean by these terms. Note that the SANE specs
    > don't say anything about it!

    The standard defines the meaning of blocking/non-blocking mode in
    chapter 4.3.10 (sane_read). Blocking/non-blocking describes the
    behaviour of sane_read in the case that no data is available. In
    blocking mode sane_read will wait until at least one byte is available
    (it "blocks"). In non-blocking mode it returns immediately (len=0).
    > -- blocking mode (aka *strongly* blocking mode):
    > all of the data is fetched from the scanner (in the
    > first call to sane_read), then handed over to the frontend
    > in digestable pieces

    No blocking or non-blocking involved. It's completely up to the
    backend how it gets data from the scanner. Most backends start a
    reader process in sane_start and have some way of buffering data.

    > -- simulated non-blocking mode:
    > program runs in strongly blocking mode but asks
    > only for a convenient amount of data,
    > data is then handed out to the frontend

    As Oliver said, the backend must provide any amount of data down to
    one byte per read.

    > -- non-blocking mode
    > program runs in strongly blocking mode (for
    > the full image), but as a background process

    For blocking/non-blocking (from the SANE point of view) it's
    unimportant how the data was transmitted from the scanner to the
    backend. The backend may use 32 k buffers and wait until each buffer
    is transmitted to the frontend, use double buffering, or read all data
    from the scanner into one big buffer before returning the first byte
    through sane_read.


    Source code, list archive, and docs:
    To unsubscribe: echo unsubscribe sane-devel | mail

    This archive was generated by hypermail 2b29 : Wed Jan 10 2001 - 12:33:08 PST