Re: backend fork/reader-process <-> sane_read

From: Chris Pinkham (cpinkham@infi.net)
Date: Sat Feb 19 2000 - 10:09:56 PST

  • Next message: Oliver Rauch: "xsane-0.56 and 16 bit preview"

    > b) there is no own reader process, the backend itself calls sanei_scsi_read()

    > All this could be hidden in a sanei_ routine so the backend does not see
    > anything about that. So a backend would not call sanei_scsi_read(),
    > instead it would call sanei_scsi_read_buffered().

    This is sort of what I did in my Artec backend. I have a sane_read() function
    and an artec_sane_read() function. sane_read has a buffer. When sane_read
    is called, if the buffer is empty, then artec_sane_read is called to read
    data from the scanner, up to the maximum size of the buffer. If there is
    data already in the buffer, then that data is returned up to the maximum
    amount requested. I wrote this "wrapper" sane_read function when I was
    informed that my backend didn't work over the net. It could really be
    used for any backend by renaming sane_read to sane_read_buffered and
    changing the function's internal calls from artec_sane_read() to just
    plain sane_read(). A few other things such as max read size from the
    scanner might have to be changed, but the individual sane_read() functions
    in each backend should handle that as they do now. The wrapper function
    could also be changed to increase the size of the buffer (I think I use
    only about 32K or 64K right now). If this buffer were bigger, then
    the backend's sane_read() function could be called multiple times in a row
    in order to fill up the buffer. This might cause jerkiness in data being
    returned to the application, but it would probably eliminate some of the
    backtracing of the scan head.

    Chris

    *****************************************************************************
    ** Chris Pinkham Linux v2.2.6, Sane v1.0.1, Cajun v3.0-8 **
    ** cpinkham@infi.net http://www4.infi.net/~cpinkham/ **
    *****************************************************************************

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



    This archive was generated by hypermail 2b29 : Sat Feb 19 2000 - 10:12:44 PST