Writing Fujitsu M3091 backend

From: Frederik Ramm (frederik@remote.org)
Date: Tue Feb 27 2001 - 05:42:17 PST

  • Next message: Davis, Tom: "Fujitsu fi-4750C Backend Project"

    Hi,

       if anybody has (or is writing) a driver for the Fujitsu M3091,
    please send me an eMail and disregard the remainder of this message.
    Otherwise, read on:

    My background:
       Reasonable C programming experience but no SCSI drivers or SANE
       stuff yet.

    My scanner:
       Fujitsu M3091DCd, a scanner that looks more like a fax machine and
       is ADF-only, supports 50-300 by 50-600 dpi in line art, grayscale
       and 24bit color, 128 kB cache and duplex (!). I am in possession of
       the full SCSI command documentation for that specific scanner.

    My goal:
       To get as much as possible of that working with SANE. Below is a
       report of my current progress, and I would be very happy about any
       and all sort of hints, tips, tricks, pitfalls, spiritual guidance,
       links to documentation etc :-)

    With minor changes, I got Randolph Bentson's M3096 driver to work with
    this scanner supporting the full resolution but neither color nor
    duplex. I was thinking about using that driver as a basis and make
    extensions as necessary, but I have some questions for the SANE
    experts here before I go on.

    Question 1 - How to do duplex scanning.

    To use the duplex mode, I have to send an extended SET WINDOW command
    to the scanner which should be no problem. The question is, how do I
    then feed the two images into SANE? As far as I can see from the
    existing driver, a subprocess gets started to read more-or-less raw
    binary data from the scanner, which is then passed via a pipe to the
    calling program; it seems to "leave" the backend via the sane_read
    function. Since the scanner has dual scan heads and only 128 kB of
    cache, in duplex mode it will send a data stream that contains two
    interspersed images. I would be able to separate them on reading, but
    what next? How do I tell the SANE middleware (or front-end for that
    matter) that I actually have TWO images? How would a front-end (like
    scanimage, the only one I've used so far) cope?

    If SANE doesn't support that, I could introduce a new parameter that
    controls whether the front or rear side is to be scanned, and each
    page would have to be run through the scanner twice. A waste, but
    possible.

    I've grepped for "duplex" in the existing backends (1.0.4) but found
    nothing.

    Question 2 - How to do the color thing.

    This is just a quick question in case somebody has noticed something
    similar with their scanners. When I read color data from the scanner,
    I get one row of "R" values, then one row of "G" values, then one row
    of "B" values, and so on. These are slightly offset, e.g. the first
    row of "R" values have to be paired with the fifth row of "G" and the
    ninth row of "B" values or so (the documentation is detailed but at
    the same time not very clear on that - http://www.fujitsu-europe.com/
    home/support/scanner/manuals/M3091dc.scsi.en.pdf, pp. 75-77). So far,
    so good, but in reality it seems that after a certain number of these
    R row/G row/B row groups I suddenly get TWO R rows following each
    other, and then on like before, and the same phenomenon again every x
    blocks. I haven't fully investigated that and don't really know what
    to make of it yet.

    I do understand that I'll have to get all the bytes into the right
    order before passing them on to the SANE middleware. Once I found out
    what the correct order is, that should be no problem. However I don't
    know how the scanner deals with the specified window size in relation
    to the sensor offset. If, as stated above, the R/G/B sensors are
    offset by 4 lines each, that means that there are 8 lines of
    incomplete data at the beginning and the end of the data stream. If I
    request an image of, say, 100 pixels in height, will the scanner then
    give me 100 of which only 84 are fully usable, or will it give me 116?

    Randolph has suggested looking at the SP15C driver which contains
    color support, and I'll do that.

    Question 3 - How to support the "hot button(s)"

    This is probably beyond the scope of SANE but maybe somebody knows
    something. The scanner has the following controls: a "scan" button, a
    "duplex" button, a "send to" button, and a number dial that can select
    numbers 0-9. The scanner does nothing with these buttons; the obvious
    purpose (as supported by some Windows software that comes with it) is
    that you can insert a document and then, by pressing one of them, have
    your computer launch a program that does something. (My idea of use
    would be assigning categories to the numbers, i.e. 1=bills, 2=bank
    letters, 3=personal letters, etc., and then use the number dial and
    "send" button on the scanner to store documents away in the proper
    folders on my Linux box.)

    The SCSI docs tell me that there are some extended fields in the
    scanner's response to the INQUIRY command that tell you if one of
    these buttons has been pressed. The respective fields are "true" for
    three seconds after button press. So I imagine I'd need some sort of
    "inquiry daemon" that sends the command to the scanner every 2 seconds
    or so and then launches whatever program has been defined when certain
    fields in the response data have certain values.

    Does such a program already exist? If not, can somebody point me to a
    very very simple program that (outside of the SANE context) sends a
    simple SCSI command to a device and evaluates the response, so that I
    could work from there?

    Bye
    Frederik

    -- 
    Frederik Ramm  ##  eMail frederik@remote.org  ##  N57°48.10' W005°40.32'
    

    -- 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 : Tue Feb 27 2001 - 05:27:08 PST