<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi Ronald,<br>
    <br>
    Please test 'scanimage -A' instead of 'scanimage --resolution 300
    --button-controlled'. Source and action should fill the response
    fields 'original' and 'target', e.g.<br>
    <br>
    $ SANE_DEBUG_PIXMA=11 sanimage -A > test<br>
    ...<br>
        --button-update<br>
            Update button state
    <div>[pixma] INTR T=44.622 len=64</div>
    [pixma]  00000000:<b><i>11 01</i></b> 00 00 00 00 00 00  00 00 00 00
    00 00 00 00 
    <div>[pixma]  00000010:00 00 00 00 00 00 00 00  00 00 00 00 00 00 00
      00 </div>
    <div>[pixma]  00000020:00 00 00 00 00 00 00 00  00 00 00 00 00 00 00
      00 </div>
    <div>[pixma]  00000030:00 00 00 00 00 00 00 00  00 00 00 00 00 00 00
      00 <br>
    </div>
    [pixma] <br>
        --button-1 <int> [1] [read-only]<br>
            Button 1<br>
        --button-2 <int> [0] [read-only]<br>
            Button 2<br>
        --original <int> [17] [read-only]<br>
            Type of original to scan<br>
        --target <int> [1] [read-only]<br>
            Target operation type<br>
        --scan-resolution <int> [0] [read-only]<br>
            Scan resolution<br>
    ...<br>
    $<br>
    <br>
    Please check which buttons trigger --button-1 and --button-2. In
    some frontends (e.g. scanimage, xsane) --button-1 is used as 'SCAN'
    or 'COLOR' button and --button-2 is used as 'GRAY' or 'END' button.
    If the assignment is not clear, I would like to patch this issue to
    your needs.<br>
    <br>
    Another great tool for button controlled scanning is scanbd
    (<a class="moz-txt-link-freetext" href="http://sourceforge.net/projects/scanbd/">http://sourceforge.net/projects/scanbd/</a>). scanbd is also supported
    via the Sane mailing list.<br>
    <br>
    Cheers,<br>
    Rolf<br>
    <br>
    <br>
    <div class="moz-cite-prefix">Am 17.05.2015 um 18:48 schrieb Ronald
      Müller:<br>
    </div>
    <blockquote
cite="mid:%3CCA+JK7syRUkEpmuDwJmvUtQOFCWFibPWha-y7X_Lws9cj7ZWfYA@mail.gmail.com%3E"
      type="cite">
      <div dir="ltr">Hi,
        <div><br>
        </div>
        <div>i use Canon Pixma MX850 AiO at home and want to use it as
          network-scanner.</div>
        <div>Its very impressing what is possible till now with SANE and
          the Canon maschines, so many thanks to guys who made this
          possible.</div>
        <div><br>
        </div>
        <div>To use the MX850 as network-scanner i use the
          "scanadf"-tool with button-controlled turned on and ADF-duplex
          option in a loop and do some postprocessing on the scanned
          images like deskewing, croping and ocr-ing, finally i produce
          a pdf from it copy this to my NAS for archiving.</div>
        <div><br>
        </div>
        <div>So overall i'm fine with this solution, but there is still
          space for improvements:</div>
        <div><br>
        </div>
        <div>- sort out the empty pages on one sided documents (ADF
          simplex option would help also to speed up)</div>
        <div>- better documents "detection" - actually the final image
          is always ~ 2552x4200 px @ 300dpi (which i think is the max.
          size) and i have to make a clever crop to have my DIN A4 page
          available (thanks to imagemagick this is no magic)  </div>
        <div><br>
        </div>
        <div>To improve this task it would be nice to evaluate what user
          has choosen at scan-dialog on the maschine and take this in to
          account (if possible). I don't know other Canon AiO, but if
          you want to scan something with the MX850, there is a small
          wizard: first you have to choose the scan-backend (USB, PC,
          ...). In the second step you can choose the source (document
          on flatbed, photo an flatbed, ADF simplex, ADF duplex). The
          third step is to choose some kind of action (save to PC, save
          as PDF to PC, send as mail, open with application).<br>
        </div>
        <div><br>
        </div>
        <div>Till now this information is not available to the frontends
          like "scanadf". Or at least i don't know how to do this. It
          would be nice to have a least the "source"-option available. <br>
        </div>
        <div>What i found out so far is that, when i pressed the
          scan-button there is packet sent from the scanner to the
          backend which contains this configuration information in byte
          0 and 1 (see debug output below). So my question: Can i use
          this information somehow? Or is not implemented yet?  </div>
        <div><br>
        </div>
        <div>The sane-backend is installed on an fresh debian jessie
          from standard repository. The MX850 is connected via network.</div>
        <div><br>
        </div>
        <div>
          <div>
            <div>root@scanner-server:/# scanimage -V</div>
            <div>scanimage (sane-backends) 1.0.24; backend version
              1.0.24</div>
            <div><br>
            </div>
            <div>root@scanner-server:/# SANE_DEBUG_PIXMA=11 scanimage
              --resolution 300 --button-controlled > test</div>
            <div>[sanei_debug] Setting debug level of pixma to 11.</div>
            <div>[pixma] pixma is compiled with pthread support.</div>
            <div>[pixma] pixma version 0.17.4</div>
            <div>[pixma] Scanner model found: Name MX850(Canon PIXMA
              MX850) matches MX850 series</div>
            <div>[pixma] pixma_collect_devices() found Canon PIXMA MX850
              at bjnp://<a moz-do-not-send="true"
                href="http://192.168.2.200">192.168.2.200</a></div>
            <div>[pixma] pixma_find_scanners() found 1 devices</div>
            <div>[pixma] Scanner model found: Name MX850(Canon PIXMA
              MX850) matches MX850 series</div>
            <div>[pixma] pixma_collect_devices() found Canon PIXMA MX850
              at bjnp://<a moz-do-not-send="true"
                href="http://192.168.2.200">192.168.2.200</a></div>
            <div>[pixma] pixma_open(): Canon PIXMA MX850</div>
            <div>[pixma] OUT  T=2.516 len=16</div>
            <div>[pixma]  00000000:f3 20 00 00 00 00 00 00  00 00 00 00
              00 00 00 10 </div>
            <div>[pixma] </div>
            <div>[pixma] IN   T=2.519 len=24</div>
            <div>[pixma]  00000000:06 06 00 00 00 00 00 00  03 00 01 00
              02 03 00 02 </div>
            <div>[pixma]  00000010:00 00 00 00 00 00 00 f5  </div>
            <div>[pixma] </div>
            <div>[pixma] Current status: paper=0 cal=0 lamp=2 busy=0</div>
            <div>[pixma] Reader task started</div>
            <div>[pixma] Reader task id=140543408641792 (threaded)</div>
            <div>[pixma] ==== Button-controlled scan mode is enabled.</div>
            <div>[pixma] ==== To proceed, press 'SCAN' or 'COLOR'
              button. To cancel, press 'GRAY' or 'END' button.</div>
            <div>[pixma] INTR T=44.622 len=64</div>
            <div><br>
            </div>
            <div>The following first two byte contains the
              wizard-configuration:</div>
            <div>byte 0: 11,21,31,41 (source) </div>
            <div>byte 1; 01,02,03,...  (action)</div>
            <div><br>
            </div>
            <div>[pixma]  00000000:<b><i>11 01</i></b> 00 00 00 00 00 00
               00 00 00 00 00 00 00 00 </div>
            <div>[pixma]  00000010:00 00 00 00 00 00 00 00  00 00 00 00
              00 00 00 00 </div>
            <div>[pixma]  00000020:00 00 00 00 00 00 00 00  00 00 00 00
              00 00 00 00 </div>
            <div>[pixma]  00000030:00 00 00 00 00 00 00 00  00 00 00 00
              00 00 00 00 </div>
            <div>[pixma] </div>
            <div>[pixma] </div>
            <div>[pixma] pixma_scan(): start</div>
            <div>[pixma]   line_size=7656 image_size=26857248 channels=3
              depth=8</div>
            <div>[pixma]   dpi=300x300 offset=(0,0) dimension=2552x3508</div>
            <div>[pixma]   gamma_table=0x7fd2de75def0 source=0</div>
            <div>[pixma]   threshold=127 threshold_curve=0</div>
            <div>[pixma]   ADF page count: 0</div>
            <div>[pixma] OUT  T=44.629 len=16</div>
            <div>[pixma]  00000000:db 20 00 00 00 00 00 00  00 00 00 00
              00 00 00 00 </div>
            <div>[pixma] </div>
            <div>[pixma] IN   T=44.640 len=8</div>
            <div>[pixma]  00000000:06 06 00 00 00 00 00 00  </div>
            <div>[pixma] </div>
          </div>
          <div>[...]</div>
          <div><br>
          </div>
          <div>Concerning detecting the paper-size i found this in the
            debug output: 3495 lines is roughly what i would expect for
            a din a4 page. But i always get 4200 lines ?!<br>
          </div>
          <div>Can i somehow get an cropped image directly from the
            scanner?</div>
          <div><br>
          </div>
          <div>
            <div>[pixma] WARNING:image size mismatches</div>
            <div>[pixma]     32155200 expected (4200 lines) but 26757720
              received (<b><i>3495</i></b> lines)</div>
            <div>[pixma] pixma_read_image(): completed (underrun
              detected)</div>
            <div>[pixma] Reader task terminated</div>
          </div>
          <div><br>
          </div>
          <div>regards</div>
          <div><br>
          </div>
          <div>Ronald</div>
          -- <br>
          <div class="gmail_signature">*********************************************<br>
            * email <a moz-do-not-send="true"
              href="mailto:ronald_mueller@gmx.de" target="_blank">ronald_mueller@gmx.de</a><br>
            * mobil +49-177-5633820<br>
            * icq  #134663106<br>
            * skype ronald_mueller<br>
            *********************************************</div>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>