~ubuntu-branches/ubuntu/saucy/sane-backends/saucy

« back to all changes in this revision

Viewing changes to backend/genesys_gl841.c

  • Committer: Bazaar Package Importer
  • Author(s): Robert Ancell
  • Date: 2011-02-14 14:28:56 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110214142856-6gxjetg88q9zctid
Tags: 1.0.22-0ubuntu1
* New upstream release
* debian/control:
  - Use standards version 3.9.1
* debian/patches/allow_dll.d_symlinks.patch:
* debian/patches/fix_epson2_cancel.patch:
* debian/patches/fix_epson2_commands.patch:
* debian/patches/fix_xerox_mfp_color_mode.patch:
* debian/patches/genesys_disable_raw_data_log.patch:
* debian/patches/no_translations.patch:
* debian/patches/saned_exit_avahi_process.patch:
* debian/patches/scsi_perfection_2450.patch:
* debian/patches/scsi_scanjet_4c.patch:
* debian/patches/xerox_mfp_new_ids.patch:
  - Applied upstream
* debian/watch:
  - Dropped, the URL is not consistent between releases

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
   Copyright (C) 2003 Oliver Rauch
4
4
   Copyright (C) 2003, 2004 Henning Meier-Geinitz <henning@meier-geinitz.de>
5
5
   Copyright (C) 2004 Gerhard Jaeger <gerhard@gjaeger.de>
6
 
   Copyright (C) 2004, 2009 Stephane Voltz <stef.dev@free.fr>
 
6
   Copyright (C) 2004-2010 Stephane Voltz <stef.dev@free.fr>
7
7
   Copyright (C) 2005 Philipp Schmid <philipp8288@web.de>
8
 
   Copyright (C) 2005 - 2009 Pierre Willenbrock <pierre@pirsoft.dnsalias.org>
 
8
   Copyright (C) 2005-2009 Pierre Willenbrock <pierre@pirsoft.dnsalias.org>
9
9
   Copyright (C) 2006 Laurent Charpentier <laurent_pubs@yahoo.com>
 
10
   Copyright (C) 2010 Chris Berry <s0457957@sms.ed.ac.uk> and Michael Rickmann <mrickma@gwdg.de>
 
11
                 for Plustek Opticbook 3600 support
10
12
   
11
13
    
12
14
   This file is part of the SANE package.
1444
1446
 
1445
1447
 
1446
1448
  dev->reg[reg_0x01].value = 0x20;      /* (enable shading), CCD, color, 1M */
1447
 
  dev->reg[reg_0x01].value |= REG01_CISSET;
 
1449
  if (dev->model->is_cis == SANE_TRUE)
 
1450
    {
 
1451
      dev->reg[reg_0x01].value |= REG01_CISSET;
 
1452
    }
 
1453
  else
 
1454
    {
 
1455
      dev->reg[reg_0x01].value &= ~REG01_CISSET;
 
1456
    }
1448
1457
  
1449
 
 dev->reg[reg_0x02].value = 0x30 /*0x38 */ ;    /* auto home, one-table-move, full step */
 
1458
  dev->reg[reg_0x02].value = 0x30 /*0x38 */ ;   /* auto home, one-table-move, full step */
1450
1459
  dev->reg[reg_0x02].value |= REG02_AGOHOME;
1451
1460
  dev->reg[reg_0x02].value |= REG02_MTRPWR;
1452
1461
  dev->reg[reg_0x02].value |= REG02_FASTFED;
1454
1463
  dev->reg[reg_0x03].value = 0x1f /*0x17 */ ;   /* lamp on */
1455
1464
  dev->reg[reg_0x03].value |= REG03_AVEENB;
1456
1465
 
1457
 
  dev->reg[reg_0x04].value |= 1 << REG04S_AFEMOD;
 
1466
  if (dev->model->ccd_type == CCD_PLUSTEK_3600)  /* AD front end */
 
1467
    {
 
1468
      dev->reg[reg_0x04].value  = (2 << REG04S_AFEMOD) | 0x02;
 
1469
    }
 
1470
  else /* Wolfson front end */
 
1471
    {
 
1472
      dev->reg[reg_0x04].value |= 1 << REG04S_AFEMOD;
 
1473
    }
1458
1474
 
1459
1475
  dev->reg[reg_0x05].value = 0x00;      /* disable gamma, 24 clocks/pixel */
1460
1476
  if (dev->sensor.sensor_pixels < 0x1500)
1476
1492
  dev->reg[reg_0x06].value |= REG06_GAIN4;
1477
1493
 
1478
1494
  /* XP300 CCD needs different clock and clock/pixels values */
1479
 
  if (dev->model->ccd_type != CCD_XP300 && dev->model->ccd_type != CCD_DP685) 
 
1495
  if (dev->model->ccd_type != CCD_XP300 && dev->model->ccd_type != CCD_DP685
 
1496
                                        && dev->model->ccd_type != CCD_PLUSTEK_3600)
1480
1497
    {
1481
1498
      dev->reg[reg_0x06].value |= 0 << REG06S_SCANMOD;
1482
1499
      dev->reg[reg_0x09].value |= 1 << REG09S_CLKSET;
1630
1647
  return status;
1631
1648
}
1632
1649
 
 
1650
/* Set values of Analog Device type frontend */
 
1651
static SANE_Status
 
1652
gl841_set_ad_fe (Genesys_Device * dev, uint8_t set)
 
1653
{
 
1654
  SANE_Status status = SANE_STATUS_GOOD;
 
1655
  int i;
 
1656
  DBG (DBG_proc, "gl841_set_ad_fe(): start\n");
 
1657
  if (set == AFE_INIT)
 
1658
    {
 
1659
      DBG (DBG_proc, "gl841_set_ad_fe(): setting DAC %u\n",
 
1660
           dev->model->dac_type);
 
1661
 
 
1662
      /* sets to default values */
 
1663
      sanei_genesys_init_fe (dev);
 
1664
 
 
1665
      /* write them to analog frontend */
 
1666
      status = sanei_genesys_fe_write_data (dev, 0x00, dev->frontend.reg[0]);
 
1667
      if (status != SANE_STATUS_GOOD)
 
1668
            {
 
1669
        DBG (DBG_error, "gl841_set_ad_fe: writing reg 0x00 failed: %s\n",
 
1670
             sane_strstatus (status));
 
1671
        return status;
 
1672
            }
 
1673
 
 
1674
      status = sanei_genesys_fe_write_data (dev, 0x01, dev->frontend.reg[1]);
 
1675
      if (status != SANE_STATUS_GOOD)
 
1676
            {
 
1677
        DBG (DBG_error, "gl841_set_ad_fe: writing reg 0x01 failed: %s\n",
 
1678
            sane_strstatus (status));
 
1679
        return status;
 
1680
            }
 
1681
 
 
1682
      for (i = 0; i < 6; i++)
 
1683
        {
 
1684
        status =
 
1685
          sanei_genesys_fe_write_data (dev, 0x02 + i, 0x00);
 
1686
        if (status != SANE_STATUS_GOOD)
 
1687
          {
 
1688
            DBG (DBG_error,
 
1689
                 "gl841_set_ad_fe: writing sign[%d] failed: %s\n", 0x02 + i,
 
1690
                 sane_strstatus (status));
 
1691
            return status;
 
1692
          }
 
1693
        }
 
1694
    }
 
1695
  if (set == AFE_SET)
 
1696
    {
 
1697
      /* write them to analog frontend */
 
1698
      status = sanei_genesys_fe_write_data (dev, 0x00, dev->frontend.reg[0]);
 
1699
      if (status != SANE_STATUS_GOOD)
 
1700
            {
 
1701
        DBG (DBG_error, "gl841_set_ad_fe: writing reg 0x00 failed: %s\n",
 
1702
             sane_strstatus (status));
 
1703
        return status;
 
1704
            }
 
1705
 
 
1706
      status = sanei_genesys_fe_write_data (dev, 0x01, dev->frontend.reg[1]);
 
1707
      if (status != SANE_STATUS_GOOD)
 
1708
            {
 
1709
        DBG (DBG_error, "gl841_set_ad_fe: writing reg 0x01 failed: %s\n",
 
1710
            sane_strstatus (status));
 
1711
        return status;
 
1712
            }
 
1713
 
 
1714
      /* Write fe 0x02 (red gain)*/
 
1715
      status = sanei_genesys_fe_write_data (dev, 0x02, dev->frontend.gain[0]);
 
1716
      if (status != SANE_STATUS_GOOD)
 
1717
            {
 
1718
        DBG (DBG_error, "gl841_set_ad_fe: writing fe 0x02 (gain r) fail: %s\n",
 
1719
            sane_strstatus (status));
 
1720
        return status;
 
1721
            }
 
1722
 
 
1723
      /* Write fe 0x03 (green gain)*/
 
1724
      status = sanei_genesys_fe_write_data (dev, 0x03, dev->frontend.gain[1]);
 
1725
      if (status != SANE_STATUS_GOOD)
 
1726
            {
 
1727
        DBG (DBG_error, "gl841_set_ad_fe: writing fe 0x03 (gain g) fail: %s\n",
 
1728
            sane_strstatus (status));
 
1729
        return status;
 
1730
            }
 
1731
 
 
1732
      /* Write fe 0x04 (blue gain)*/
 
1733
      status = sanei_genesys_fe_write_data (dev, 0x04, dev->frontend.gain[2]);
 
1734
      if (status != SANE_STATUS_GOOD)
 
1735
            {
 
1736
        DBG (DBG_error, "gl841_set_ad_fe: writing fe 0x04 (gain b) fail: %s\n",
 
1737
            sane_strstatus (status));
 
1738
        return status;
 
1739
            }
 
1740
 
 
1741
      /* Write fe 0x05 (red offset)*/
 
1742
      status =
 
1743
          sanei_genesys_fe_write_data (dev, 0x05, dev->frontend.offset[0]);
 
1744
      if (status != SANE_STATUS_GOOD)
 
1745
            {
 
1746
        DBG (DBG_error, "gl841_set_ad_fe: write fe 0x05 (offset r) fail: %s\n",
 
1747
            sane_strstatus (status));
 
1748
        return status;
 
1749
            }
 
1750
 
 
1751
      /* Write fe 0x06 (green offset)*/
 
1752
      status =
 
1753
          sanei_genesys_fe_write_data (dev, 0x06, dev->frontend.offset[1]);
 
1754
      if (status != SANE_STATUS_GOOD)
 
1755
            {
 
1756
        DBG (DBG_error, "gl841_set_ad_fe: write fe 0x06 (offset g) fail: %s\n",
 
1757
            sane_strstatus (status));
 
1758
        return status;
 
1759
            }
 
1760
 
 
1761
      /* Write fe 0x07 (blue offset)*/
 
1762
      status =
 
1763
          sanei_genesys_fe_write_data (dev, 0x07, dev->frontend.offset[2]);
 
1764
      if (status != SANE_STATUS_GOOD)
 
1765
            {
 
1766
        DBG (DBG_error, "gl841_set_ad_fe: write fe 0x07 (offset b) fail: %s\n",
 
1767
            sane_strstatus (status));
 
1768
        return status;
 
1769
            }
 
1770
          }
 
1771
  DBG (DBG_proc, "gl841_set_ad_fe(): end\n");
 
1772
 
 
1773
  return status;
 
1774
}
 
1775
 
1633
1776
/* Set values of analog frontend */
1634
1777
static SANE_Status
1635
1778
gl841_set_fe (Genesys_Device * dev, uint8_t set)
1642
1785
       set == AFE_INIT ? "init" : set == AFE_SET ? "set" : set ==
1643
1786
       AFE_POWER_SAVE ? "powersave" : "huh?");
1644
1787
 
 
1788
  /* Analog Device type frontend */
 
1789
  if ((dev->reg[reg_0x04].value & REG04_FESET) == 0x02)
 
1790
    {
 
1791
      return gl841_set_ad_fe (dev, set);
 
1792
    }
 
1793
 
1645
1794
  if ((dev->reg[reg_0x04].value & REG04_FESET) != 0x00)
1646
1795
    {
1647
1796
      DBG (DBG_proc, "gl841_set_fe(): unsupported frontend type %d\n",
2517
2666
      }
2518
2667
 
2519
2668
    /* enable shading */
2520
 
/*  dev->reg[reg_0x01].value |= REG01_DVDSET | REG01_SCAN;*/
2521
2669
    r = sanei_genesys_get_address (reg, 0x01);
2522
2670
    r->value |= REG01_SCAN;
2523
2671
    if ((flags & OPTICAL_FLAG_DISABLE_SHADING) ||
2542
2690
        if (flags & OPTICAL_FLAG_DISABLE_LAMP)
2543
2691
            r->value = 0x01;/* 0x0101 is as off as possible */
2544
2692
        else
 
2693
          { /* EXP[R,G,B] only matter for CIS scanners */
2545
2694
            if (dev->sensor.regs_0x10_0x1d[i] == 0x00)
2546
 
                r->value = 0x01;/*0x00 will not be accepted*/
 
2695
                r->value = 0x01; /*0x00 will not be accepted*/
2547
2696
            else
2548
2697
                r->value = dev->sensor.regs_0x10_0x1d[i];
 
2698
          }
2549
2699
    }
2550
2700
 
2551
2701
    r = sanei_genesys_get_address (reg, 0x19);
2578
2728
    }
2579
2729
    
2580
2730
    r->value &= ~(REG04_FILTER | REG04_AFEMOD);
2581
 
    if (channels == 1) {
2582
 
        switch (color_filter) {
 
2731
    if (channels == 1) 
 
2732
      {
 
2733
        switch (color_filter)
 
2734
          {
2583
2735
            case 0:
2584
2736
                r->value |= 0x14;       /* red filter */
2585
2737
                break;
2590
2742
                r->value |= 0x18;       /* green filter */
2591
2743
                break;
2592
2744
        }
2593
 
    } else 
2594
 
        r->value |= 0x10;       /* color pixel by pixel */
 
2745
   }
 
2746
   else
 
2747
     {
 
2748
        if (dev->model->ccd_type == CCD_PLUSTEK_3600)
 
2749
          {
 
2750
            r->value |= 0x22;   /* slow color pixel by pixel */
 
2751
          }
 
2752
        else
 
2753
          {
 
2754
            r->value |= 0x10;   /* color pixel by pixel */
 
2755
          }
 
2756
    }
2595
2757
 
2596
2758
    /* CIS scanners can do true gray by setting LEDADD */
2597
2759
    if (dev->model->is_cis == SANE_TRUE)
3958
4120
{
3959
4121
  SANE_Status status = SANE_STATUS_GOOD;
3960
4122
  SANE_Bool paper_loaded;
3961
 
  unsigned int scancnt = 0;
3962
 
  int flines, channels, depth, bytes_remain, sublines,
3963
 
    bytes_to_flush, lines, sub_bytes, tmp, read_bytes_left;
 
4123
  unsigned int scancnt = 0, lincnt, postcnt;
 
4124
  uint8_t val;
 
4125
  size_t total_bytes_to_read;
 
4126
 
3964
4127
  DBG (DBG_proc, "%s: begin\n", __FUNCTION__);
3965
4128
 
3966
4129
  RIE (gl841_get_paper_sensor (dev, &paper_loaded));
3971
4134
      DBG (DBG_info, "%s: no more document\n", __FUNCTION__);
3972
4135
      dev->document = SANE_FALSE;
3973
4136
 
3974
 
      channels = dev->current_setup.channels;
3975
 
      depth = dev->current_setup.depth;
3976
 
      read_bytes_left = (int) dev->read_bytes_left;
3977
 
      DBG (DBG_io, "gl841_detect_document_end: read_bytes_left=%d\n",
3978
 
           read_bytes_left);
3979
 
 
3980
 
      /* read lins read */
3981
 
      status = sanei_genesys_read_scancnt (dev, &scancnt);
3982
 
      if (status != SANE_STATUS_GOOD)
3983
 
        {
3984
 
          flines = 0;
3985
 
        }
3986
 
      else
3987
 
        {
3988
 
          /* compute number of line read */
3989
 
          tmp = (int) dev->total_bytes_read;
3990
 
          if (depth == 1 || dev->settings.scan_mode == SCAN_MODE_LINEART)
3991
 
            flines = tmp * 8 / dev->settings.pixels / channels;
3992
 
          else
3993
 
            flines = tmp / (depth / 8) / dev->settings.pixels / channels;
3994
 
 
3995
 
          /* number of scanned lines, but no read yet */
3996
 
          flines = scancnt - flines;
3997
 
 
3998
 
          DBG (DBG_io,
3999
 
               "gl841_detect_document_end: %d scanned but not read lines\n",
4000
 
               flines);
4001
 
        }
4002
 
 
4003
 
      /* adjust number of bytes to read 
4004
 
       * we need to read the final bytes which are word per line * number of last lines
4005
 
       * to have doc leaving feeder */
4006
 
      lines =
4007
 
        (SANE_UNFIX (dev->model->post_scan) * dev->current_setup.yres) /
4008
 
        MM_PER_INCH + flines;
4009
 
      DBG (DBG_io, "gl841_detect_document_end: adding %d line to flush\n",
4010
 
           lines);
4011
 
 
4012
 
      /* number of bytes to read from scanner to get document out of it after
4013
 
       * end of document dectected by hardware sensor */
4014
 
      bytes_to_flush = lines * dev->wpl;
4015
 
 
4016
 
      /* if we are already close to end of scan, flushing isn't needed */
4017
 
      if (bytes_to_flush < read_bytes_left)
4018
 
        {
4019
 
          /* we take all these step to work around an overflow on some plateforms */
4020
 
          tmp = (int) dev->total_bytes_read;
4021
 
          DBG (DBG_io, "gl841_detect_document_end: tmp=%d\n", tmp);
4022
 
          bytes_remain = (int) dev->total_bytes_to_read;
4023
 
          DBG (DBG_io, "gl841_detect_document_end: bytes_remain=%d\n",
4024
 
               bytes_remain);
4025
 
          bytes_remain = bytes_remain - tmp;
4026
 
          DBG (DBG_io, "gl841_detect_document_end: bytes_remain=%d\n",
4027
 
               bytes_remain);
4028
 
 
4029
 
          /* remaining lines to read by frontend for the current scan */
4030
 
          if (depth == 1 || dev->settings.scan_mode == SCAN_MODE_LINEART)
4031
 
            {
4032
 
              flines = bytes_remain * 8 / dev->settings.pixels / channels;
4033
 
            }
4034
 
          else
4035
 
            flines = bytes_remain / (depth / 8)
4036
 
              / dev->settings.pixels / channels;
4037
 
          DBG (DBG_io, "gl841_detect_document_end: flines=%d\n", flines);
4038
 
 
4039
 
          if (flines > lines)
4040
 
            {
4041
 
              /* change the value controlling communication with the frontend :
4042
 
               * total bytes to read is current value plus the number of remaining lines 
4043
 
               * multiplied by bytes per line */
4044
 
              sublines = flines - lines;
4045
 
 
4046
 
              if (depth == 1 || dev->settings.scan_mode == SCAN_MODE_LINEART)
4047
 
                sub_bytes =
4048
 
                  ((dev->settings.pixels * sublines) / 8 +
4049
 
                   (((dev->settings.pixels * sublines) % 8) ? 1 : 0)) *
4050
 
                  channels;
4051
 
              else
4052
 
                sub_bytes =
4053
 
                  dev->settings.pixels * sublines * channels * (depth / 8);
4054
 
 
4055
 
              dev->total_bytes_to_read -= sub_bytes;
4056
 
 
4057
 
              /* then adjust the physical bytes to read */
4058
 
              if (read_bytes_left > sub_bytes)
4059
 
                {
4060
 
                  dev->read_bytes_left -= sub_bytes;
4061
 
                }
4062
 
              else
4063
 
                {
4064
 
                  dev->total_bytes_to_read = dev->total_bytes_read;
4065
 
                  dev->read_bytes_left = 0;
4066
 
                }
4067
 
 
4068
 
              DBG (DBG_io, "gl841_detect_document_end: sublines=%d\n",
4069
 
                   sublines);
4070
 
              DBG (DBG_io, "gl841_detect_document_end: subbytes=%d\n",
4071
 
                   sub_bytes);
4072
 
              DBG (DBG_io,
4073
 
                   "gl841_detect_document_end: total_bytes_to_read=%d\n",
4074
 
                   dev->total_bytes_to_read);
4075
 
              DBG (DBG_io, "gl841_detect_document_end: read_bytes_left=%d\n",
4076
 
                   read_bytes_left);
4077
 
            }
4078
 
        }
4079
 
      else
4080
 
        {
4081
 
          DBG (DBG_io, "gl841_detect_document_end: no flushing needed\n");
4082
 
        }
 
4137
      /* we can't rely on total_bytes_to_read since the frontend
 
4138
       * might have been slow to read data, so we re-evaluate the
 
4139
       * amount of data to scan form the hardware settings
 
4140
       */
 
4141
      status=sanei_genesys_read_scancnt(dev,&scancnt);
 
4142
      if(status!=SANE_STATUS_GOOD)
 
4143
        {
 
4144
          dev->total_bytes_to_read = dev->total_bytes_read;
 
4145
          dev->read_bytes_left = 0;
 
4146
          DBG (DBG_proc, "%s: finished\n", __FUNCTION__);
 
4147
          return SANE_STATUS_GOOD;
 
4148
        }
 
4149
      if (dev->settings.scan_mode == SCAN_MODE_COLOR && dev->model->is_cis)
 
4150
        {
 
4151
          scancnt/=3;
 
4152
        }
 
4153
      DBG (DBG_io, "%s: scancnt=%u lines\n",__FUNCTION__, scancnt);
 
4154
 
 
4155
      RIE(sanei_genesys_read_register(dev, 0x25, &val));
 
4156
      lincnt=65536*val;
 
4157
      RIE(sanei_genesys_read_register(dev, 0x26, &val));
 
4158
      lincnt+=256*val;
 
4159
      RIE(sanei_genesys_read_register(dev, 0x27, &val));
 
4160
      lincnt+=val;
 
4161
      DBG (DBG_io, "%s: lincnt=%u lines\n",__FUNCTION__, lincnt);
 
4162
      postcnt=(SANE_UNFIX(dev->model->post_scan)/MM_PER_INCH)*dev->settings.yres;
 
4163
      DBG (DBG_io, "%s: postcnt=%u lines\n",__FUNCTION__, postcnt);
 
4164
 
 
4165
      /* the current scancnt is also the final one, so we use it to
 
4166
       * compute total bytes to read. We also add the line count to eject document */
 
4167
      total_bytes_to_read=(scancnt+postcnt)*dev->wpl;
 
4168
      DBG (DBG_io, "%s: old total_bytes_to_read=%u\n",__FUNCTION__,dev->total_bytes_to_read);
 
4169
      DBG (DBG_io, "%s: new total_bytes_to_read=%u\n",__FUNCTION__,total_bytes_to_read);
 
4170
 
 
4171
      /* assign new end value */
 
4172
      if(dev->total_bytes_to_read>total_bytes_to_read)
 
4173
        {
 
4174
          DBG (DBG_io, "%s: scan shorten\n",__FUNCTION__);
 
4175
          dev->total_bytes_to_read=total_bytes_to_read;
 
4176
        }
4083
4177
    }
4084
4178
 
4085
4179
  DBG (DBG_proc, "%s: finished\n", __FUNCTION__);
4098
4192
  DBG (DBG_proc, "gl841_begin_scan\n");
4099
4193
 
4100
4194
  local_reg[0].address = 0x03;
4101
 
  local_reg[0].value = sanei_genesys_read_reg_from_set (reg, 0x03) | REG03_LAMPPWR;
 
4195
  if (dev->model->ccd_type != CCD_PLUSTEK_3600)
 
4196
    {
 
4197
      local_reg[0].value = sanei_genesys_read_reg_from_set (reg, 0x03) | REG03_LAMPPWR;
 
4198
    }
 
4199
  else
 
4200
    {
 
4201
      local_reg[0].value = sanei_genesys_read_reg_from_set (reg, 0x03); /* TODO PLUSTEK_3600: why ?? */
 
4202
    }
4102
4203
 
4103
4204
  local_reg[1].address = 0x01;
4104
4205
  local_reg[1].value = sanei_genesys_read_reg_from_set (reg, 0x01) | REG01_SCAN;        /* set scan bit */
4555
4656
gl841_init_regs_for_shading (Genesys_Device * dev)
4556
4657
{
4557
4658
  SANE_Status status;
 
4659
  SANE_Int ydpi;
4558
4660
 
4559
4661
  DBG (DBG_proc, "gl841_init_regs_for_shading: lines = %d\n",
4560
4662
       dev->model->shading_lines);
4561
4663
 
 
4664
  ydpi = dev->motor.base_ydpi;
 
4665
  if (dev->motor.motor_id == MOTOR_PLUSTEK_3600)  /* TODO PLUSTEK_3600: 1200dpi not yet working, produces dark bar */
 
4666
    {
 
4667
      ydpi = 600;
 
4668
    }
 
4669
 
4562
4670
  dev->calib_channels = 3;
4563
4671
  status = gl841_init_scan_regs (dev,
4564
4672
                                 dev->calib_reg,
4565
4673
                                 dev->settings.xres,
4566
 
                                 dev->motor.base_ydpi,
 
4674
                                 ydpi,
4567
4675
                                 0,
4568
4676
                                 0,
4569
4677
                                 (dev->sensor.sensor_pixels * dev->settings.xres) / dev->sensor.optical_res,
4688
4796
   * scan since color calibration is OK for this mode
4689
4797
   */
4690
4798
  flags = 0;
4691
 
  if(dev->model->is_cis && dev->settings.true_gray)
 
4799
  
 
4800
  if(dev->model->is_cis && dev->settings.true_gray
 
4801
    &&dev->model->ccd_type != CCD_CANONLIDE35)
4692
4802
    {
4693
4803
      flags |= OPTICAL_FLAG_ENABLE_LEDADD;
4694
4804
    }
5020
5130
  return status;
5021
5131
}
5022
5132
 
 
5133
/** @brief calibration for AD frontend devices
 
5134
 * experiments show that modifying offset is of little (if no) influence
 
5135
 * so we just return
 
5136
 * CHRIS: This was added from gl646.c as again offset seems to make no
 
5137
 * difference
 
5138
 *
 
5139
 * TODO PLUSTEK_3600 Michael Rickmann:
 
5140
 * offset calibration makes a lot of a difference but currently
 
5141
 * makes everything to dark
 
5142
 */
 
5143
static SANE_Status
 
5144
ad_fe_offset_calibration (Genesys_Device * dev)
 
5145
{
 
5146
  SANE_Status status = SANE_STATUS_GOOD;
 
5147
 
 
5148
  DBG (DBG_proc, "ad_fe_offset_calibration: start\n");
 
5149
  DBG (DBG_info, "ad_fe_offset_calibration: offset=(%d,%d,%d)\n",
 
5150
       dev->frontend.offset[0], dev->frontend.offset[1],
 
5151
       dev->frontend.offset[2]);
 
5152
  DBG (DBG_proc, "ad_fe_offset_calibration: end\n");
 
5153
  return status;
 
5154
}
 
5155
 
5023
5156
/* this function does the offset calibration by scanning one line of the calibration
5024
5157
   area below scanner's top. There is a black margin and the remaining is white.
5025
5158
   sanei_genesys_search_start() must have been called so that the offsets and margins
5046
5179
  SANE_Bool acceptable = SANE_FALSE;
5047
5180
  int mintgt = 0x400;
5048
5181
 
 
5182
  /* Analog Device fronted have a different calibration */
 
5183
  if (dev->model->dac_type == DAC_PLUSTEK_3600)
 
5184
    {
 
5185
      return ad_fe_offset_calibration (dev);
 
5186
    }
 
5187
 
5049
5188
  DBG (DBG_proc, "gl841_offset_calibration\n");
5050
5189
 
5051
5190
  /* offset calibration is always done in color mode */
5674
5813
static SANE_Status
5675
5814
sanei_gl841_repark_head (Genesys_Device * dev)
5676
5815
{
5677
 
  Genesys_Register_Set local_reg[GENESYS_GL841_MAX_REGS + 1];
5678
5816
  SANE_Status status;
5679
5817
 
5680
5818
  DBG (DBG_proc, "sanei_gl841_repark_head\n");
5704
5842
 
5705
5843
  DBG (DBG_proc, "gl841_is_compatible_calibration\n");
5706
5844
 
 
5845
  /* calibration cache not working yet for this model */
 
5846
  if (dev->model->ccd_type == CCD_PLUSTEK_3600)
 
5847
    {
 
5848
      return SANE_STATUS_UNSUPPORTED;
 
5849
    }
 
5850
 
5707
5851
  status = gl841_calculate_current_setup (dev);
5708
5852
 
5709
5853
  if (status != SANE_STATUS_GOOD)
6296
6440
  gl841_search_strip,
6297
6441
 
6298
6442
  gl841_is_compatible_calibration,
 
6443
  NULL,
6299
6444
  NULL
6300
6445
};
6301
6446