<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">On 30/09/2014 12:05, Myroslav Kavatsyuk
      wrote:<br>
    </div>
    <blockquote
      cite="mid:1412071542.52739.YahooMailNeo@web140706.mail.bf1.yahoo.com"
      type="cite">
      <div style="color:#000; background-color:#fff;
        font-family:HelveticaNeue-Light, Helvetica Neue Light, Helvetica
        Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:8px">
        <div style="" class=""><span style="" class="">Dear Stef,</span></div>
        <div class="" style="color: rgb(0, 0, 0); font-size: 8px;
          background-color: transparent; font-style: normal;"><br
            style="" class="">
          <span style="" class=""></span></div>
        <div class="" style="color: rgb(0, 0, 0); font-size: 8px;
          background-color: transparent; font-style: normal;"><span
            style="" class="">After a summer brake I got again some time
            to work on the driver for canoscan 8400F. In order to
            simplify my task I have disconnected transparency<br
              style="" class="">
          </span></div>
        <div class="" style="color: rgb(0, 0, 0); font-size: 8px;
          background-color: transparent; font-style: normal;"><span
            style="" class="">unit while taking logs. This made logs
            more clear. Here are my findings:</span></div>
        <div class="" style="color: rgb(0, 0, 0); font-size: 8px;
          background-color: transparent; font-style: normal;"><br
            style="" class="">
          <span style="" class=""></span></div>
        <div class="" style="color: rgb(0, 0, 0); font-size: 8px;
          background-color: transparent; font-style: normal;"><span
            style="" class="">1) Sensor profiles: For all scan modes
            only two different sensor profiles are used:</span></div>
        <div class="" style="color: rgb(0, 0, 0); font-size: 8px;
          background-color: transparent; font-style: normal;"><span
            style="" class="">/* scan 1600, 1200 dpi, average_bit=0,
            DPISET=4800<br style="" class="">
                CKSEL=1 for all modes */<br style="" class="">
            {CCD_CS8400F, 1600, 14400, 0x1ff, 0x0, 0x24924, 5168,
            0,0x2a,0x0,0x0,0x0,0x0000,0x00,0x01,0x0000,0x0000,<br
              style="" class="">
                    {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x0c,
            0x11, 0x2a, 0x30, 0x00, 0x00, 0x84},<br style="" class="">
                   
            {0x0b,0x0e,0x11,0x02,0x05,0x08,0x63,0x00,0x40,0x00,0x00,0x0000,0x82},<br
              style="" class="">
            },<br style="" class="">
             /* scan 800, 600 dpi, average_bit=0, DPISET=4800<br
              style="" class="">
                 scan 300 dpi, average_bit=1, DPISET=2400<br style=""
              class="">
                 scan 100, 75 dpi, average_bit=1, DPISET=1200<br
              style="" class="">
                 CKSEL=3 for all modes*/<br style="" class="">
            {CCD_CS8400F,  800, 7200,  0xe3f, 0x0, 0x1b6db, 5168,
            0,0x2a,0x0,0x0,0x0,0x0000,0x01,0x02,0x0000,0x0000,<br
              style="" class="">
                    {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x0c,
            0x13, 0x2a, 0x30, 0x00, 0x00, 0x84},<br style="" class="">
                   
            {0x0d,0x10,0x01,0x04,0x07,0x0a,0x6b,0x00,0x40,0x00,0x00,0x0000,0x85},<br
              style="" class="">
             },</span></div>
        <div class="" style="color: rgb(0, 0, 0); font-size: 8px;
          background-color: transparent; font-style: normal;"><span
            style="" class="">Inside the comments you will find values
            of relevant registers (DPIHW=4800 for all modes). When I
            tried to use SANE to make a scan at 100 dpi, the actual</span></div>
        <div class="" style="color: rgb(0, 0, 0); font-size: 8px;
          background-color: transparent; font-style: normal;"><span
            style="" class="">scan was performed with ~ 70 dpi.
            According to the SANE logs, SANE was using dpiset=400 while
            the canon driver uses </span><span style="" class="">DPISET=1200,
          </span><span style="" class="">average_bit=1...</span></div>
        <div class="" style="color: rgb(0, 0, 0); font-size: 8px;
          background-color: transparent; font-style: normal;"><span
            style="" class="">To be honest I am sucked with this puzzle.</span></div>
        <div class="" style="color: rgb(0, 0, 0); font-size: 8px;
          background-color: transparent; font-style: normal;"><br
            style="" class="">
          <span style="" class=""></span></div>
        <div class="" style="color: rgb(0, 0, 0); font-size: 8px;
          background-color: transparent; font-style: normal;"><span
            style="" class="">2) Motor tables:</span></div>
        <div class="" style="color: rgb(0, 0, 0); font-size: 8px;
          background-color: transparent; font-style: normal;"><span
            style="" class="">   I found that for each movement scanner
            uses two tables. In most cases one table is short, 512
            bytes, another is long 2024 bytes. During the test scans the
            scan head was making three types of movements:</span></div>
        <div class="" style="color: rgb(0, 0, 0); font-size: 8px;
          background-color: transparent; font-style: normal;"><span
            style="" class="">  I) from parking position to the
            beginning of the scan</span></div>
        <div class="" style="color: rgb(0, 0, 0); font-size: 8px;
          background-color: transparent; font-style: normal;"><span
            style="" class="">  II) scanning</span></div>
        <div class="" style="color: rgb(0, 0, 0); font-size: 8px;
          background-color: transparent; font-style: normal;"><span
            style="" class="">  III) return to parking position</span></div>
        <div class="" style="color: rgb(0, 0, 0); font-size: 8px;
          background-color: transparent; font-style: normal;"><span
            style="" class=""> I have identified all tables for all
            modes. I will not send them in this mail since they are
            large.  Here is the summary:</span></div>
        <div style="" class="">    * Tables of type III are same same
          for all modes: 75-100, 300, 600-800, 1200-1600 dpi<br style=""
            class="">
              * Tables of type II are same for 600-800, 1200 dpi</div>
        <div style="" class="">    * All tables same for:  75 and 100
          dpi; 600 and  800 dpi; 1200 and 1600 dpi.</div>
        <div style="" class="">    * For resolutions of 75 and 100 dpi
          all tables of type I and II are short (512 bytes)</div>
        <div style="" class="">The interesting finding is that the
          tables for different movements are written to different
          addresses:</div>
        <div style="" class="">* Type I:<br style="" class="">
        </div>
        <div style="color: rgb(0, 0, 0); font-size: 8px;
          background-color: transparent; font-style: normal;" class="">    
          genesys_write_register(0x5b,0x40)        length 2048<br
            style="" class="">
               genesys_write_register(0x5c,0x00)<br style="" class="">
           </div>
        <div style="color: rgb(0, 0, 0); font-size: 8px;
          background-color: transparent; font-style: normal;" class=""> 
             genesys_write_register(0x5b,0x50)         length 512<br
            style="" class="">
               genesys_write_register(0x5c,0x00)<br style="" class="">
        </div>
        <div style="color: rgb(0, 0, 0); font-size: 8px;
          background-color: transparent; font-style: normal;" class="">*
          Type II<br style="" class="">
              genesys_write_register(0x5b,0x48)           length 2048<br
            style="" class="">
               genesys_write_register(0x5c,0x00)</div>
        <div style="color: rgb(0, 0, 0); font-size: 8px;
          background-color: transparent; font-style: normal;" class=""><br
            style="" class="">
              genesys_write_register(0x5b,0x58)            length 512<br
            style="" class="">
               genesys_write_register(0x5c,0x00)<br style="" class="">
        </div>
        <div style="color: rgb(0, 0, 0); font-size: 8px;
          background-color: transparent; font-style: normal;" class=""><br
            style="" class="">
        </div>
        <div style="color: rgb(0, 0, 0); font-size: 8px;
          background-color: transparent; font-style: normal;" class="">Type
          III<br style="" class="">
              genesys_write_register(0x5b,0x58)           length  2048<br
            style="" class="">
               genesys_write_register(0x5c,0x00)</div>
        <div style="color: rgb(0, 0, 0); font-size: 8px;
          background-color: transparent; font-style: normal;" class=""><br
            style="" class="">
              genesys_write_register(0x5b,0x40)          length 512<br
            style="" class="">
               genesys_write_register(0x5c,0x00)</div>
        <div style="color: rgb(0, 0, 0); font-size: 8px;
          background-color: transparent; font-style: normal;" class=""><br
            style="" class="">
        </div>
        <div style="color: rgb(0, 0, 0); font-size: 8px;
          background-color: transparent; font-style: normal;" class="">At
          this point I have collected some information but it is not
          clear how to implement it into the genesys backend. How to
          implement different motor</div>
        <div style="color: rgb(0, 0, 0); font-size: 8px;
          background-color: transparent; font-style: normal;" class="">tables
          for two-table movement? I see implementation for the g4050.
          There are few tables defined for it. But it is not clear which
          of them will be</div>
        <div style="color: rgb(0, 0, 0); font-size: 8px;
          background-color: transparent; font-style: normal;" class="">selected
          for each movement...</div>
        <div style="color: rgb(0, 0, 0); font-size: 8px;
          background-color: transparent; font-style: normal;" class=""><br>
        </div>
        <div style="color: rgb(0, 0, 0); font-size: 8px;
          background-color: transparent; font-style: normal;" class="">Please
          provide me more information or help me with the
          implementation.</div>
        <div style="color: rgb(0, 0, 0); font-size: 8px;
          background-color: transparent; font-style: normal;" class=""><br>
        </div>
        <div style="color: rgb(0, 0, 0); font-size: 8px;
          background-color: transparent; font-style: normal;" class="">Thank
          you in advance,</div>
        <div style="color: rgb(0, 0, 0); font-size: 8px;
          background-color: transparent; font-style: normal;" class="">Best
          regards,</div>
        <div style="color: rgb(0, 0, 0); font-size: 8px;
          background-color: transparent; font-style: normal;" class="">Myroslav<br
            style="" class="">
        </div>
        <div class="" style="font-family: HelveticaNeue-Light, Helvetica
          Neue Light, Helvetica Neue, Helvetica, Arial, Lucida Grande,
          sans-serif; font-size: 8px;">
          <div class="" style="font-family: HelveticaNeue, Helvetica
            Neue, Helvetica, Arial, Lucida Grande, sans-serif;
            font-size: 16px;">
            <div style="" class="" dir="ltr">
              <hr style="" class="" size="1"> <font style="" class=""
                face="Arial" size="2"> <b style="" class=""><span
                    class="" style="font-weight:bold;">From:</span></b>
                Stef <a class="moz-txt-link-rfc2396E" href="mailto:stef.dev@free.fr"><stef.dev@free.fr></a><br style="" class="">
                <b style="" class=""><span class="" style="font-weight:
                    bold;">To:</span></b> Myroslav Kavatsyuk
                <a class="moz-txt-link-rfc2396E" href="mailto:m.kavatsyuk@yahoo.com"><m.kavatsyuk@yahoo.com></a>;
                <a class="moz-txt-link-rfc2396E" href="mailto:sane-devel@lists.alioth.debian.org">"sane-devel@lists.alioth.debian.org"</a>
                <a class="moz-txt-link-rfc2396E" href="mailto:sane-devel@lists.alioth.debian.org"><sane-devel@lists.alioth.debian.org></a> <br style=""
                  class="">
                <b style="" class=""><span class="" style="font-weight:
                    bold;">Sent:</span></b> Wednesday, June 25, 2014
                6:41 AM<br style="" class="">
                <b style="" class=""><span class="" style="font-weight:
                    bold;">Subject:</span></b> Re: CANOSCAN 8400F<br
                  style="" class="">
              </font> </div>
            <div style="" class=""><br style="" class="">
              <div style="" class="" id="yiv3221448796">
                <div style="" class="">
                  <div style="" class="" id="yiv3221448796yqt06990">
                    <div style="" class="">On 23/06/2014 15:51, Myroslav
                      Kavatsyuk wrote:<br style="" class="" clear="none">
                    </div>
                    <blockquote style="" class="" type="cite">
                      <div class=""
                        style="color:#000;background-color:#fff;font-family:HelveticaNeue-Light,
                        Helvetica Neue Light, Helvetica Neue, Helvetica,
                        Arial, Lucida Grande, sans-serif;font-size:8pt;">
                        <div class="" style="">Dear Stef,</div>
                        <div class="" style=""><br class="" style=""
                            clear="none">
                        </div>
                        <div class="" style="color:rgb(0, 0,
0);font-size:10.6667px;font-family:serif;background-color:transparent;font-style:normal;">Thanks
                          a lot for your suggestions. I have studied
                          genesys documentation, and indeed it is
                          helpful :)</div>
                        <div class="" style="color:rgb(0, 0,
0);font-size:10.6667px;font-family:serif;background-color:transparent;font-style:normal;"><br
                            class="" style="" clear="none">
                        </div>
                        <div class="" style="color:rgb(0, 0,
0);font-size:10.6667px;font-family:serif;background-color:transparent;font-style:normal;">I
                          have collected usblogs for all useful scan
                          modes. In case you would like to look at them,
                          you can</div>
                        <div class="" style="color:rgb(0, 0,
0);font-size:10.6667px;font-family:serif;background-color:transparent;font-style:normal;">download
                          processed (with your script) logs at: <a
                            moz-do-not-send="true" rel="nofollow"
                            shape="rect" class="" style=""
                            target="_blank"
href="https://www.dropbox.com/sh/6je6fz2tsjy0r6x/AAA1yr9P6RrlEWaqk5lWjLNSa">CS8400F</a></div>
                        <div class="" id="yiv3221448796enhancrCard_0"
                          style="width:450px;font-family:'Georgia',
                          'Times', 'Times New Roman', 'serif';">
                          <table class=""
style="width:450px;height:60px;margin-top:5px;margin-bottom:5px;display:block;"
                            cellpadding="0" cellspacing="0">
                            <tbody class="" style="">
                              <tr class="" style="">
                                <td colspan="6" rowspan="1" class=""
                                  style="height:1px;background-color:#e5e5e5;"><br
                                    style="" class="" clear="none">
                                </td>
                              </tr>
                              <tr class="" style="">
                                <td colspan="1" rowspan="2" class=""
                                  style="width:1px;background-color:#e5e5e5;"><br
                                    style="" class="" clear="none">
                                </td>
                                <td colspan="1" rowspan="2" class=""
style="vertical-align:middle;width:58px;height:58px;background-color:#000000;">
                                  <div class="" style="width:58px;"
                                    align="center"><a
                                      moz-do-not-send="true"
                                      rel="nofollow" shape="rect"
                                      class="" target="_blank"
href="https://www.dropbox.com/sh/6je6fz2tsjy0r6x/AAA1yr9P6RrlEWaqk5lWjLNSa"
style="text-decoration:none;color:#000000;"><img moz-do-not-send="true"
                                        class="" alt="image"
                                        src="https://www.dropbox.com/static/images/icons128/folder_dropbox.png"
style="display:block;margin:auto;" height="58" width="58"></a></div>
                                </td>
                                <td colspan="1" rowspan="2" class=""
                                  style="width:1px;background-color:#e5e5e5;"><br
                                    style="" class="" clear="none">
                                </td>
                                <td colspan="2" rowspan="1" class=""
                                  style="width:100%;vertical-align:middle;font-family:'Georgia',
                                  'Times', 'Times New Roman', 'serif';">
                                  <div class=""
style="line-height:16.5px;background-color:#ffffff;height:34px;width:389px;">
                                    <div class=""
                                      style="word-wrap:break-word;padding:5px
                                      20px 0px 9px;"><span class=""
                                        style=""></span><span class=""
                                        style=""></span><a
                                        moz-do-not-send="true"
                                        rel="nofollow" shape="rect"
                                        class="" target="_blank"
href="https://www.dropbox.com/sh/6je6fz2tsjy0r6x/AAA1yr9P6RrlEWaqk5lWjLNSa"
style="text-decoration:none;color:#000000;"><span class=""
style="margin:0;font-weight:normal;font-size:13px;line-height:18px;max-height:19px;color:#000000;overflow:hidden;display:inline-block;">CS8400F</span></a>
                                      <div class=""
                                        style="font-size:11px;line-height:15px;color:#999999;max-height:16px;font-family:'Arial',
                                        'Helvetica Neue', 'Helvetica',
                                        'sans-serif';overflow:hidden;">Shared
                                        with Dropbox</div>
                                    </div>
                                  </div>
                                </td>
                                <td colspan="1" rowspan="2" class=""
                                  style="width:1px;background-color:#e5e5e5;"><br
                                    style="" class="" clear="none">
                                </td>
                              </tr>
                              <tr class="" style="">
                                <td colspan="1" rowspan="1" class=""
                                  style="width:100%;vertical-align:middle;font-family:'Arial',
                                  'Helvetica Neue', 'Helvetica',
                                  'sans-serif';">
                                  <div class=""
                                    style="font-size:0pt;padding:1px
                                    20px 1px 10px;"><a
                                      moz-do-not-send="true"
                                      rel="nofollow" shape="rect"
                                      class="" target="_blank"
href="https://www.dropbox.com/sh/6je6fz2tsjy0r6x/AAA1yr9P6RrlEWaqk5lWjLNSa"
style="color:black;text-decoration:none;cursor:pointer;"><span class=""
style="display:inline-block;line-height:11px;max-width:289px;min-width:229px;overflow:hidden;max-height:13px;"><span
                                          class=""
style="vertical-align:middle;font-size:9px;line-height:11px;color:#999999;">View
                                          on <span class=""
                                            style="font-weight:bold;">www.dropbox.com</span></span></span></a></div>
                                </td>
                                <td colspan="1" rowspan="1" class=""
                                  style="vertical-align:middle;width:100px;font-family:'Arial',
                                  'Helvetica Neue', 'Helvetica',
                                  'sans-serif';">
                                  <div class="" style="padding:2px 20px
                                    4px
0px;max-width:100px;min-width:80px;overflow:hidden;text-align:right;line-height:11px;max-height:13px;font-size:0pt;"><span
                                      class=""
style="vertical-align:middle;font-size:9px;line-height:11px;color:#999999;">Preview
                                      by Yahoo</span></div>
                                </td>
                              </tr>
                              <tr class="" style="">
                                <td colspan="6" rowspan="1" class=""
                                  style="height:1px;background-color:#e5e5e5;"><br
                                    style="" class="" clear="none">
                                </td>
                              </tr>
                            </tbody>
                          </table>
                        </div>
                        <div class="" style="color:rgb(0, 0,
0);font-size:10.6667px;font-family:serif;background-color:transparent;font-style:normal;"> </div>
                        <div class="" style="color:rgb(0, 0,
0);font-size:10.6667px;font-family:serif;background-color:transparent;font-style:normal;">I
                          made summary of all possible sensor profiles.
                          For each profile I wrote at which "dpi"
                          setting of windows driver</div>
                        <div class="" style="color:rgb(0, 0,
0);font-size:10.6667px;font-family:serif;background-color:transparent;font-style:normal;">   
                          it is used, value of the DPISET register,
                          value of the AVEENB bit (average over few
                          pixels or drop pixels):<br class="" style=""
                            clear="none">
                        </div>
                        <div class="" style="color:rgb(0, 0,
0);font-size:10.6667px;font-family:serif;background-color:transparent;font-style:normal;"> /*<br
                            class="" style="" clear="none">
                                  {CCD_CS8400F, dpi, 22000, 0x0, 0xff,
                          0x0, 5168, 0,0x2a,0x 0, 0x 0, 0x 0, -1, 0x07,
                          0x08, -1, -1,<br class="" style=""
                            clear="none">
                                  {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                          0x3b, 0x0c, 0x10, 0x2a, 0x30, 0x00, 0x00,
                          0x9a},<br class="" style="" clear="none">
                                  {0x01, 0x04, 0x07, 0x0a, 0x0d, 0x10,
                          0x1b, 0x00, 0x40, 0x00, 0x00, -1, 0x88},<br
                            class="" style="" clear="none">
                                  }, // Scanner init, DPISET=600;
                          AVEENB=1<br class="" style="" clear="none">
                                  {CCD_CS8400F, dpi, 10800, 0xe3f, 0x0,
                          0x1b6db, 5168, 0,0x2a,0x 0, 0x 0, 0x 0, -1,
                          0x01, 0x02, -1, -1,<br class="" style=""
                            clear="none">
                                  {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                          0x33, 0x0c, 0x13, 0x2a, 0x30, 0x00, 0x00,
                          0x84, },<br class="" style="" clear="none">
                                 
                          {0x0d,0x10,0x01,0x04,0x07,0x0a,0x6b,0x00,0x40,0x00,0x00,-1,0x88,},<br
                            class="" style="" clear="none">
                                  }, // Scanner init DPISET=2400, most
                          probably TPU, AVEENB=1<br class="" style=""
                            clear="none">
                                  {CCD_CS8400F, dpi, 7200, 0xe3f, 0x0,
                          0x1b6db, 5168, 0,-1,0xfffffffffffffeff,
                          0xfffffffffffffeff, 0xfffffffffffffeff, -1,
                          0x01, 0x02, -1, -1,<br class="" style=""
                            clear="none">
                                  {-1, -1, -1, -1, -1, -1, 0x33, 0x0c,
                          0x13, -1, 0x30, -1, 0x00, 0x84},<br class=""
                            style="" clear="none">
                                 
                          {0x0d,0x10,0x01,0x04,0x07,0x0a,0x6b,-1,0x40,0x00,0x00,-1,0x88},<br
                            class="" style="" clear="none">
                                  }, // 600 dpi DPISET=4800 (last value
                          0x88 -> 0x85); 400,300 dpi DPISET=2400,
                          last number 0x85; 100 dpi DPISET=1200<br
                            class="" style="" clear="none">
                                  {CCD_CS8400F, dpi, 7200, 0xe3f, 0x0,
                          0x1b6db, 5168, 0,0x2a,0x 0, 0x 0, 0x 0, -1,
                          0x01, 0x02, -1, -1,<br class="" style=""
                            clear="none">
                                  {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                          0x33, 0x0c, 0x13, 0x2a, 0x30, 0x00, 0x00,
                          0x84},<br class="" style="" clear="none">
                                  {0x0d, 0x10, 0x01, 0x04, 0x07, 0x0a,
                          0x6b, 0x00, 0x40, 0x00, 0x00,   -1, 0x85},<br
                            class="" style="" clear="none">
                                  }, // 800 dpi, DPISET=4800<br class=""
                            style="" clear="none">
                                  {CCD_CS8400F, dpi, 14400, 0x1ff, 0x0,
                          0x24924, 5168, 0,0x2a,0x 0, 0x 0, 0x 0, -1,
                          0x00, 0x01, -1, -1,<br class="" style=""
                            clear="none">
                                  {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                          0x33, 0x0c, 0x11, 0x2a, 0x30, 0x00, 0x00,
                          0x84},<br class="" style="" clear="none">
                                  {0x0b, 0x0e, 0x11, 0x02, 0x05, 0x08,
                          0x63, 0x00, 0x40, 0x00, 0x00,   -1, 0x82},<br
                            class="" style="" clear="none">
                                  }, // 1200, 1600 dpi; DPISET=4800<br
                            class="" style="" clear="none">
                                  {CCD_CS8400F, dpi, 28800,   0x0, 0x0,
                          0x24924, 5168, 0,0x2a,0x 0, 0x 0, 0x 0, -1,
                          0x09, 0x0a, -1, -1,<br class="" style=""
                            clear="none">
                                  {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                          0x33, 0x0c, 0x10, 0x2a, 0x30, 0x00, 0x20,
                          0x84, },<br class="" style="" clear="none">
                                  {0x02, 0x05, 0x08, 0x0b, 0x0e, 0x11,
                          0x1b, 0x00, 0x40, 0x00, 0x00,   -1, 0x88},<br
                            class="" style="" clear="none">
                                  }, // 3200,2400 scan; DPISET=4800
                          (last value can be 0x88 -> 0x81)</div>
                        <div class="" style="color:rgb(0, 0,
0);font-size:10.6667px;font-family:serif;background-color:transparent;font-style:normal;">       
                          //</div>
                        <div class="" style="color:rgb(0, 0,
0);font-size:10.6667px;font-family:serif;background-color:transparent;font-style:normal;"> 
                                // AVEENB=1 for dpi from 100-400
                          range; AVEENB=0 for dpi 600-3200 range</div>
                        <div class="" style="color:rgb(0, 0,
0);font-size:10.6667px;font-family:serif;background-color:transparent;font-style:normal;">
                                   */</div>
                        <div class="" style="color:rgb(0, 0,
0);font-size:10.6667px;font-family:serif;background-color:transparent;font-style:normal;">  
                          This values are almost ready to be plugged
                          into the code. I have to replace at some
                          places "-1" values. What is strange for me</div>
                        <div class="" style="color:rgb(0, 0,
0);font-size:10.6667px;font-family:serif;background-color:transparent;font-style:normal;">  
                          that DPISET values are very high with respect
                          to dpi setting reported by driver.</div>
                        <div class="" style="color:rgb(0, 0,
0);font-size:10.6667px;font-family:serif;background-color:transparent;font-style:normal;"><br
                            class="" style="" clear="none">
                        </div>
                        <div class="" style="color:rgb(0, 0,
0);font-size:10.6667px;font-family:serif;background-color:transparent;font-style:normal;">My
                          questions are:</div>
                        <div class="" style="color:rgb(0, 0,
0);font-size:10.6667px;font-family:serif;background-color:transparent;font-style:normal;">1)
                          what does the second field (dpi) means in the
                          scanner profile? Is this value of the DPISET
                          register?</div>
                        <div class="" style="color:rgb(0, 0,
0);font-size:10.6667px;font-family:serif;background-color:transparent;font-style:normal;">2)
                          I did not manage to follow where actually sane
                          decides which profile to use, which DPISET
                          value to select?</div>
                        <div class="" style="color:rgb(0, 0,
0);font-size:10.6667px;font-family:serif;background-color:transparent;font-style:normal;">  
                          In other words how to make sure that the
                          correct combination will be selected for scan
                          if I pass resolution of dpi to scanimage.</div>
                        <div class="" style="color:rgb(0, 0,
0);font-size:10.6667px;font-family:serif;background-color:transparent;font-style:normal;">3)
                          From the logs I do not see how to extract
                          motor tables (like one in the genesys_gl843.h
                          at line 678). In the logs</div>
                        <div class="" style="color:rgb(0, 0,
0);font-size:10.6667px;font-family:serif;background-color:transparent;font-style:normal;">I
                          have seen setting up of the MTRTBL bit for
                          downloading table
                          (genesys_write_register(0x5b,0x01)genesys_write_register(0x5c,0x00))</div>
                        <div class="" style="color:rgb(0, 0,
0);font-size:10.6667px;font-family:serif;background-color:transparent;font-style:normal;">This
                          statements are followed by data. Is that data
                          a motor table?</div>
                        <div class="" style="color:rgb(0, 0,
0);font-size:10.6667px;font-family:serif;background-color:transparent;font-style:normal;"><br
                            style="" class="" clear="none">
                        </div>
                        <div class="" style="color:rgb(0, 0,
0);font-size:10.6667px;font-family:serif;background-color:transparent;font-style:normal;">Best
                          regards,</div>
                        <div class="" style="color:rgb(0, 0,
0);font-size:10.6667px;font-family:serif;background-color:transparent;font-style:normal;">Myroslav<br
                            class="" style="" clear="none">
                        </div>
                        <div class="" style="color:rgb(0, 0,
0);font-size:10.6667px;font-family:serif;background-color:transparent;font-style:normal;"> </div>
                      </div>
                    </blockquote>
                  </div>
                      Hello,<br style="" class="" clear="none">
                  <br style="" class="" clear="none">
                      1) the dpi value is the effective maximum dpi for
                  the scan. Scan's dpi is the result of DPISET, DPIHW
                  and CKSET. In the simplest case it is the hardware DPI
                  set for the recorded scan.<br style="" class=""
                    clear="none">
                  <br style="" class="" clear="none">
                      2) for a given target resolution, exposure is
                  chosen first (gl843_compute_exposure which uses
                  get_sensor_profile) by selecting the sensor profile
                  which has the lowest dpi value above or equal to the
                  target dpi.<br style="" class="" clear="none">
                  <br style="" class="" clear="none">
                      3) data can be written to the GL843 by many
                  slightly different ways that the decoding scripts may
                  not handle, so look for bulk writes mostly shorter
                  than 2048 bytes, which turned (little-endian) to 16
                  bit values give a decreasing slope with end values
                  becoming closer. In such a situation, I look at
                  semi-processed log generated by the 'partial.sh'
                  script. After writes to 5b/5c registers like you
                  noticed.<br style="" class="" clear="none">
                  <br style="" class="" clear="none">
                  Example from a 4400F log:<br style="" class=""
                    clear="none">
                  URB  2992  control  0x40 0x04 0x82 0x00 len     8
                  wrote 0x01 0x00 0x82 0x00 0xfe 0x01 0x00 0x00 <br
                    style="" class="" clear="none">
                  URB  2993  bulk_out len   510  wrote 0x00 0x60 0x00
                  0x60 0xd4 0x3c 0x32 0x2e 0x29 0x26 0xdb 0x20 0x1e 0x1d
                  0x41 0x1a 0x00 0x18 0x2e 0x16 0xaf 0x14 0x61 0x13 0x49
                  0x12 0x5b 0x11 0x84 0x10 0xc0 0x0f 0x18 0x0f 0x7d 0x0e
                  0xf6 0x0d 0x71 0x0d 0x04 0x0d 0x97 0x0c 0x36 0x0c 0xd6
                  0x0b 0x81 0x0b 0x36 0x0b 0xe9 0x0a 0xa5 0x0a 0x65 0x0a
                  0x27 0x0a 0xec 0x09 0xb4 0x09 0x82 0x09 0x4f 0x09 0x21
                  0x09 0xf4 0x08 0xca 0x08 0xa1 0x08 0x79 0x08 0x53 0x08
                  0x31 0x08 0x0d 0x08 0xed 0x07 0xce 0x07 0xae 0x07 0x91
                  0x07 0x74 0x07 0x5b 0x07 0x40 0x07 0x27 0x07 0x0d 0x07
                  0xf7 0x06 0xdf 0x06 0xc9 0x06 0xb3 0x06 0x9e 0x06 0x8b
                  0x06 0x77 0x06 0x64 0x06 0x52 0x06 0x40 0x06 0x2e 0x06
                  0x1d 0x06 0x0c 0x06 0xfb 0x05 0xec 0x05 0xdc 0x05 0xce
                  0x05 0xbf 0x05 0xb1 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05
                  0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf
                  0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05
                  0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf
                  0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05
                  0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf
                  0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05
                  0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf
                  0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05
                  0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf
                  0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05
                  0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf
                  0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05
                  0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf
                  0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05
                  0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf
                  0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05
                  0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf
                  0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05
                  0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf
                  0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05
                  0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf
                  0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05
                  0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf
                  0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05
                  0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf
                  0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05
                  0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf
                  0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05
                  0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf
                  0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05
                  0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf
                  0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05
                  0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf 0x05 0xaf
                  0x05 <br style="" class="" clear="none">
                  URB  2994  control  0x40 0x04 0x83 0x00 len     2
                  wrote 0x5b 0x00 <br style="" class="" clear="none">
                  <br style="" class="" clear="none">
                  which gives 0x6000, 0x6000, 0x3cd4, 0x2e32, ....,
                  0x05ce, 0x05bc, 0x05b1, 0x05af, 0x05af .... 0x05af<br
                    style="" class="" clear="none">
                  <br style="" class="" clear="none">
                  Regards,<br style="" class="" clear="none">
                      Stef<br style="" class="" clear="none">
                </div>
              </div>
              <br style="" class="">
              <br style="" class="">
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
        Hello,<br>
    <br>
        what i would recommend for a start is to reach 'first light'
    status. Focus on getting a ~100 dpi color scan working. To ease and
    speed up develoment, write a simple unit test program and compile
    the backend with UNIT_TESTING defined. So you can tinker with
    registers values easily and focus on a particular thing without
    requiring everything to work. <br>
        Also, stick to one motor table scan at first. Once you have
    something working, you can improve it. Some sample code for unit
    test program to quick-start yours:<br>
    <br>
     DBG_INIT();<br>
      <br>
      /* backend init */ <br>
      status = sane_genesys_init (&vc, cb);<br>
      if (status != SANE_STATUS_GOOD)<br>
        <br>
        {<br>
          printf ("sane_init()=%s\n", sane_strstatus (status));<br>
          return 1;<br>
        }<br>
      status = sane_genesys_open ("genesys", &handle);<br>
      if (status != SANE_STATUS_GOOD)<br>
        <br>
        {<br>
          printf ("sane_open()=%s\n", sane_strstatus (status));<br>
          sane_genesys_exit ();<br>
          return 1;<br>
        }<br>
      session = (Genesys_Scanner *) handle;<br>
      dev = session->dev;<br>
    <br>
      /* zone de test */<br>
      dev->settings.scan_method=SCAN_METHOD_TRANSPARENCY;<br>
      status = dev->model->cmd_set->move_to_ta (dev);<br>
      if (status != SANE_STATUS_GOOD)<br>
        {<br>
          DBG (DBG_error, "move_to_ta failed: %s\n", sane_strstatus
    (status));<br>
        }<br>
    <br>
      /* scan */<br>
      dpi = 1200;<br>
      dpihw = sanei_genesys_compute_dpihw (dev, dpi);<br>
      channels = 3;<br>
      depth=8;<br>
      lines = 1200;<br>
      startx =
    (SANE_UNFIX(dev->model->x_offset_ta)*dpihw)/MM_PER_INCH;<br>
      pixels =
    (SANE_UNFIX(dev->model->x_size_ta)*dpihw)/MM_PER_INCH;<br>
    <br>
      size=pixels*channels*lines*(depth/8);<br>
      data = malloc (size);<br>
     <br>
      /* round down pixel number */<br>
      factor=pixels;<br>
      factor=(factor/2)&0xfffe;<br>
      pixels=factor;<br>
    <br>
      gl843_init_scan_regs (dev,<br>
                dev->reg,<br>
                dpi,<br>
                dpi,<br>
                startx,<br>
                0,<br>
                pixels,<br>
                lines,<br>
                depth,<br>
                channels,<br>
                            SCAN_MODE_COLOR,<br>
                0,<br>
                SCAN_FLAG_USE_XPA |<br>
                SCAN_FLAG_DISABLE_SHADING |<br>
                SCAN_FLAG_DISABLE_GAMMA |<br>
                SCAN_FLAG_IGNORE_LINE_DISTANCE);<br>
    <br>
    ......<br>
    <br>
      r = sanei_genesys_get_address (dev->reg, 0x98);<br>
      r->value = 0x02;<br>
      r = sanei_genesys_get_address (dev->reg, 0x99);<br>
      r->value = 0xe0;<br>
      r = sanei_genesys_get_address (dev->reg, 0x9b);<br>
      r->value = 0x90;<br>
    <br>
      RIE (dev->model->cmd_set->bulk_write_register (dev,
    dev->reg, GENESYS_GL843_MAX_REGS));<br>
    <br>
      RIE (gl843_begin_scan (dev, dev->reg, SANE_FALSE));<br>
      DBG (DBG_proc, "XXX STEF XXX\n");<br>
      DBG (DBG_proc, "sanei_genesys_start_motor\n");<br>
      DBG (DBG_proc, "ZZZ STEF ZZZ\n");<br>
      sanei_genesys_read_data_from_scanner (dev, data, size);<br>
      RIE (gl843_end_scan (dev, dev->reg, SANE_TRUE));<br>
      sanei_genesys_write_pnm_file ("image.pnm", data, depth, channels,
    pixels, lines);<br>
    <br>
      /* on gare et on ferme */<br>
      status = dev->model->cmd_set->slow_back_home (dev,
    SANE_TRUE);<br>
      sane_genesys_close (handle);<br>
      sane_genesys_exit ();<br>
      return 0;<br>
    <br>
    <br>
  </body>
</html>