kopia lustrzana https://gitlab.com/sane-project/backends
				
				
				
			Merge branch 'gl847'
						commit
						f805e27531
					
				| 
						 | 
				
			
			@ -156,7 +156,7 @@ am_libfujitsu_la_OBJECTS = libfujitsu_la-fujitsu.lo
 | 
			
		|||
libfujitsu_la_OBJECTS = $(am_libfujitsu_la_OBJECTS)
 | 
			
		||||
libgenesys_la_LIBADD =
 | 
			
		||||
am_libgenesys_la_OBJECTS = libgenesys_la-genesys.lo \
 | 
			
		||||
	libgenesys_la-genesys_gl646.lo libgenesys_la-genesys_gl841.lo
 | 
			
		||||
	libgenesys_la-genesys_gl646.lo libgenesys_la-genesys_gl841.lo libgenesys_la-genesys_gl847.lo
 | 
			
		||||
libgenesys_la_OBJECTS = $(am_libgenesys_la_OBJECTS)
 | 
			
		||||
libgphoto2_i_la_LIBADD =
 | 
			
		||||
am_libgphoto2_i_la_OBJECTS = libgphoto2_i_la-gphoto2.lo
 | 
			
		||||
| 
						 | 
				
			
			@ -1974,7 +1974,7 @@ nodist_libsane_fujitsu_la_SOURCES = fujitsu-s.c
 | 
			
		|||
libsane_fujitsu_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=fujitsu
 | 
			
		||||
libsane_fujitsu_la_LDFLAGS = $(DIST_SANELIBS_LDFLAGS)
 | 
			
		||||
libsane_fujitsu_la_LIBADD = $(COMMON_LIBS) libfujitsu.la ../sanei/sanei_init_debug.lo ../sanei/sanei_constrain_value.lo ../sanei/sanei_config.lo ../sanei/sanei_config2.lo sane_strstatus.lo ../sanei/sanei_usb.lo ../sanei/sanei_scsi.lo ../sanei/sanei_magic.lo $(MATH_LIB) $(SCSI_LIBS) $(USB_LIBS) $(RESMGR_LIBS)
 | 
			
		||||
libgenesys_la_SOURCES = genesys.c genesys.h genesys_gl646.c genesys_gl646.h genesys_gl841.c genesys_low.h
 | 
			
		||||
libgenesys_la_SOURCES = genesys.c genesys.h genesys_gl646.c genesys_gl646.h genesys_gl841.c genesys_gl847.c genesys_gl847.h genesys_low.h
 | 
			
		||||
libgenesys_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=genesys
 | 
			
		||||
nodist_libsane_genesys_la_SOURCES = genesys-s.c
 | 
			
		||||
libsane_genesys_la_CPPFLAGS = $(AM_CPPFLAGS) -DBACKEND_NAME=genesys
 | 
			
		||||
| 
						 | 
				
			
			@ -2840,6 +2840,7 @@ distclean-compile:
 | 
			
		|||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgenesys_la-genesys.Plo@am__quote@
 | 
			
		||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgenesys_la-genesys_gl646.Plo@am__quote@
 | 
			
		||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgenesys_la-genesys_gl841.Plo@am__quote@
 | 
			
		||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgenesys_la-genesys_gl847.Plo@am__quote@
 | 
			
		||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgphoto2_i_la-gphoto2.Plo@am__quote@
 | 
			
		||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgt68xx_la-gt68xx.Plo@am__quote@
 | 
			
		||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhp3500_la-hp3500.Plo@am__quote@
 | 
			
		||||
| 
						 | 
				
			
			@ -3304,6 +3305,13 @@ libgenesys_la-genesys_gl841.lo: genesys_gl841.c
 | 
			
		|||
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 | 
			
		||||
@am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgenesys_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgenesys_la-genesys_gl841.lo `test -f 'genesys_gl841.c' || echo '$(srcdir)/'`genesys_gl841.c
 | 
			
		||||
 | 
			
		||||
libgenesys_la-genesys_gl847.lo: genesys_gl847.c
 | 
			
		||||
@am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgenesys_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgenesys_la-genesys_gl847.lo -MD -MP -MF $(DEPDIR)/libgenesys_la-genesys_gl847.Tpo -c -o libgenesys_la-genesys_gl847.lo `test -f 'genesys_gl847.c' || echo '$(srcdir)/'`genesys_gl847.c
 | 
			
		||||
@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libgenesys_la-genesys_gl847.Tpo $(DEPDIR)/libgenesys_la-genesys_gl847.Plo
 | 
			
		||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='genesys_gl847.c' object='libgenesys_la-genesys_gl847.lo' libtool=yes @AMDEPBACKSLASH@
 | 
			
		||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 | 
			
		||||
@am__fastdepCC_FALSE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgenesys_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libgenesys_la-genesys_gl847.lo `test -f 'genesys_gl847.c' || echo '$(srcdir)/'`genesys_gl847.c
 | 
			
		||||
 | 
			
		||||
libgphoto2_i_la-gphoto2.lo: gphoto2.c
 | 
			
		||||
@am__fastdepCC_TRUE@	$(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgphoto2_i_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libgphoto2_i_la-gphoto2.lo -MD -MP -MF $(DEPDIR)/libgphoto2_i_la-gphoto2.Tpo -c -o libgphoto2_i_la-gphoto2.lo `test -f 'gphoto2.c' || echo '$(srcdir)/'`gphoto2.c
 | 
			
		||||
@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libgphoto2_i_la-gphoto2.Tpo $(DEPDIR)/libgphoto2_i_la-gphoto2.Plo
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -77,8 +77,6 @@
 | 
			
		|||
#include "genesys.h"
 | 
			
		||||
#include "genesys_devices.c"
 | 
			
		||||
 | 
			
		||||
#define FREE_IFNOT_NULL(x)		if(x!=NULL) { free(x); x=NULL;}
 | 
			
		||||
 | 
			
		||||
static SANE_Int num_devices = 0;
 | 
			
		||||
static Genesys_Device *first_dev = 0;
 | 
			
		||||
static Genesys_Scanner *first_handle = 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -166,7 +164,7 @@ static const SANE_Range threshold_curve_range = {
 | 
			
		|||
/* ------------------------------------------------------------------------ */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * returns true if filter bit is on (monochrome scan)
 | 
			
		||||
 * setup the hardware dependent functions
 | 
			
		||||
 */
 | 
			
		||||
static SANE_Status
 | 
			
		||||
genesys_init_cmd_set (Genesys_Device * dev)
 | 
			
		||||
| 
						 | 
				
			
			@ -177,6 +175,8 @@ genesys_init_cmd_set (Genesys_Device * dev)
 | 
			
		|||
      return sanei_gl646_init_cmd_set (dev);
 | 
			
		||||
    case GENESYS_GL841:
 | 
			
		||||
      return sanei_gl841_init_cmd_set (dev);
 | 
			
		||||
    case GENESYS_GL847:
 | 
			
		||||
      return sanei_gl847_init_cmd_set (dev);
 | 
			
		||||
    default:
 | 
			
		||||
      return SANE_STATUS_INVAL;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -284,13 +284,45 @@ sanei_genesys_set_reg_from_set (Genesys_Register_Set * reg, SANE_Byte address,
 | 
			
		|||
/*                  Read and write RAM, registers and AFE                   */
 | 
			
		||||
/* ------------------------------------------------------------------------ */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Write to one GL847 ASIC register
 | 
			
		||||
URB    10  control  0x40 0x04 0x83 0x00 len     2 wrote 0xa6 0x04 
 | 
			
		||||
 */
 | 
			
		||||
static SANE_Status
 | 
			
		||||
sanei_genesys_write_gl847_register (Genesys_Device * dev, uint8_t reg, uint8_t val)
 | 
			
		||||
{
 | 
			
		||||
  SANE_Status status;
 | 
			
		||||
  uint8_t buffer[2];
 | 
			
		||||
 | 
			
		||||
/* Write to one register */
 | 
			
		||||
  buffer[0]=reg;
 | 
			
		||||
  buffer[1]=val;
 | 
			
		||||
  status =
 | 
			
		||||
    sanei_usb_control_msg (dev->dn, REQUEST_TYPE_OUT, REQUEST_BUFFER,
 | 
			
		||||
			   VALUE_SET_REGISTER, INDEX, 2, buffer);
 | 
			
		||||
  if (status != SANE_STATUS_GOOD)
 | 
			
		||||
    {
 | 
			
		||||
      DBG (DBG_error, "sanei_genesys_write_gl847_register (0x%02x, 0x%02x): failed : %s\n", reg, val, sane_strstatus (status));
 | 
			
		||||
      return status;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  DBG (DBG_io, "sanei_genesys_write_gl847_register (0x%02x, 0x%02x) completed\n",
 | 
			
		||||
       reg, val);
 | 
			
		||||
 | 
			
		||||
  return status;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Write to one ASIC register
 | 
			
		||||
 */
 | 
			
		||||
SANE_Status
 | 
			
		||||
sanei_genesys_write_register (Genesys_Device * dev, uint8_t reg, uint8_t val)
 | 
			
		||||
{
 | 
			
		||||
  SANE_Status status;
 | 
			
		||||
 | 
			
		||||
  /* route to gl847 function if needed */
 | 
			
		||||
  if(dev->model->asic_type==GENESYS_GL847)
 | 
			
		||||
    return sanei_genesys_write_gl847_register(dev, reg, val);
 | 
			
		||||
 | 
			
		||||
  status =
 | 
			
		||||
    sanei_usb_control_msg (dev->dn, REQUEST_TYPE_OUT, REQUEST_REGISTER,
 | 
			
		||||
			   VALUE_SET_REGISTER, INDEX, 1, ®);
 | 
			
		||||
| 
						 | 
				
			
			@ -319,6 +351,29 @@ sanei_genesys_write_register (Genesys_Device * dev, uint8_t reg, uint8_t val)
 | 
			
		|||
  return status;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* read reg 0x41:
 | 
			
		||||
 * URB   164  control  0xc0 0x04 0x8e 0x4122 len     2 read  0xfc 0x55
 | 
			
		||||
 */
 | 
			
		||||
static SANE_Status
 | 
			
		||||
sanei_genesys_read_gl847_register (Genesys_Device * dev, uint8_t reg, uint8_t * val)
 | 
			
		||||
{
 | 
			
		||||
  SANE_Status status;
 | 
			
		||||
  uint16_t value;
 | 
			
		||||
 | 
			
		||||
  status =
 | 
			
		||||
    sanei_usb_control_msg (dev->dn, REQUEST_TYPE_IN, REQUEST_BUFFER,
 | 
			
		||||
			   VALUE_GET_REGISTER, 0x22+(reg<<8), 2, (SANE_Byte *)&value);
 | 
			
		||||
  if (status != SANE_STATUS_GOOD)
 | 
			
		||||
    {
 | 
			
		||||
      DBG (DBG_error,
 | 
			
		||||
	   "sanei_genesys_read_gl847_register (0x%02x): failed while setting register: %s\n",
 | 
			
		||||
	   reg, sane_strstatus (status));
 | 
			
		||||
      return status;
 | 
			
		||||
    }
 | 
			
		||||
  *val=value & 0xff;
 | 
			
		||||
  DBG( DBG_io2, "sanei_genesys_read_gl847_register(0x%02x)=0x%02x\n",reg,value & 0xff);
 | 
			
		||||
  return status;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Read from one register */
 | 
			
		||||
SANE_Status
 | 
			
		||||
| 
						 | 
				
			
			@ -326,6 +381,10 @@ sanei_genesys_read_register (Genesys_Device * dev, uint8_t reg, uint8_t * val)
 | 
			
		|||
{
 | 
			
		||||
  SANE_Status status;
 | 
			
		||||
 | 
			
		||||
  /* route to gl847 function if needed */
 | 
			
		||||
  if(dev->model->asic_type==GENESYS_GL847)
 | 
			
		||||
    return sanei_genesys_read_gl847_register(dev, reg, val);
 | 
			
		||||
 | 
			
		||||
  status =
 | 
			
		||||
    sanei_usb_control_msg (dev->dn, REQUEST_TYPE_OUT, REQUEST_REGISTER,
 | 
			
		||||
			   VALUE_SET_REGISTER, INDEX, 1, ®);
 | 
			
		||||
| 
						 | 
				
			
			@ -361,6 +420,13 @@ SANE_Status
 | 
			
		|||
sanei_genesys_set_buffer_address (Genesys_Device * dev, uint32_t addr)
 | 
			
		||||
{
 | 
			
		||||
  SANE_Status status;
 | 
			
		||||
  
 | 
			
		||||
  if(dev->model->asic_type==GENESYS_GL847)
 | 
			
		||||
    {
 | 
			
		||||
      DBG (DBG_warn,
 | 
			
		||||
	   "sanei_genesys_set_buffer_address: shouldn't be used for GL847 \n");
 | 
			
		||||
      return SANE_STATUS_GOOD;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  DBG (DBG_io,
 | 
			
		||||
       "sanei_genesys_set_buffer_address: setting address to 0x%05x\n",
 | 
			
		||||
| 
						 | 
				
			
			@ -587,16 +653,29 @@ sanei_genesys_read_valid_words (Genesys_Device * dev, unsigned int *words)
 | 
			
		|||
  uint8_t value;
 | 
			
		||||
 | 
			
		||||
  DBG (DBG_proc, "sanei_genesys_read_valid_words\n");
 | 
			
		||||
 | 
			
		||||
  RIE (sanei_genesys_read_register (dev, 0x44, &value));
 | 
			
		||||
  *words = value;
 | 
			
		||||
  RIE (sanei_genesys_read_register (dev, 0x43, &value));
 | 
			
		||||
  *words += (value * 256);
 | 
			
		||||
  RIE (sanei_genesys_read_register (dev, 0x42, &value));
 | 
			
		||||
  if (dev->model->asic_type == GENESYS_GL646)
 | 
			
		||||
    *words += ((value & 0x03) * 256 * 256);
 | 
			
		||||
  if (dev->model->asic_type == GENESYS_GL847)
 | 
			
		||||
    {
 | 
			
		||||
      RIE (sanei_genesys_read_register (dev, 0x42, &value));
 | 
			
		||||
      *words=(value & 0x03);
 | 
			
		||||
      RIE (sanei_genesys_read_register (dev, 0x43, &value));
 | 
			
		||||
      *words=*words*256+value;
 | 
			
		||||
      RIE (sanei_genesys_read_register (dev, 0x44, &value));
 | 
			
		||||
      *words=*words*256+value;
 | 
			
		||||
      RIE (sanei_genesys_read_register (dev, 0x45, &value));
 | 
			
		||||
      *words=*words*256+value;
 | 
			
		||||
    }
 | 
			
		||||
  else
 | 
			
		||||
    *words += ((value & 0x0f) * 256 * 256);
 | 
			
		||||
    {
 | 
			
		||||
      RIE (sanei_genesys_read_register (dev, 0x44, &value));
 | 
			
		||||
      *words = value;
 | 
			
		||||
      RIE (sanei_genesys_read_register (dev, 0x43, &value));
 | 
			
		||||
      *words += (value * 256);
 | 
			
		||||
      RIE (sanei_genesys_read_register (dev, 0x42, &value));
 | 
			
		||||
      if (dev->model->asic_type == GENESYS_GL646)
 | 
			
		||||
        *words += ((value & 0x03) * 256 * 256);
 | 
			
		||||
      else
 | 
			
		||||
        *words += ((value & 0x0f) * 256 * 256);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  DBG (DBG_proc, "sanei_genesys_read_valid_words: %d words\n", *words);
 | 
			
		||||
  return SANE_STATUS_GOOD;
 | 
			
		||||
| 
						 | 
				
			
			@ -631,7 +710,7 @@ Genesys_Register_Set *
 | 
			
		|||
sanei_genesys_get_address (Genesys_Register_Set * regs, SANE_Byte addr)
 | 
			
		||||
{
 | 
			
		||||
  int i;
 | 
			
		||||
  for (i = 0; i < GENESYS_MAX_REGS && regs[i].address; i++)
 | 
			
		||||
  for (i = 0; i < GENESYS_MAX_REGS; i++)
 | 
			
		||||
    {
 | 
			
		||||
      if (regs[i].address == addr)
 | 
			
		||||
	return ®s[i];
 | 
			
		||||
| 
						 | 
				
			
			@ -1377,8 +1456,20 @@ genesys_send_offset_and_shading (Genesys_Device * dev, uint8_t * data,
 | 
			
		|||
 | 
			
		||||
  DBG (DBG_proc, "genesys_send_offset_and_shading (size = %d)\n", size);
 | 
			
		||||
 | 
			
		||||
  /* ASIC higher than gl843 doesn't have register 2A/2B, so we route to
 | 
			
		||||
   * a per ASIC shading data loading function if available */
 | 
			
		||||
  if(dev->model->cmd_set->send_shading_data!=NULL)
 | 
			
		||||
    {
 | 
			
		||||
        status=dev->model->cmd_set->send_shading_data(dev, data, size);
 | 
			
		||||
        DBG (DBG_proc, "genesys_send_offset_and_shading: completed\n");
 | 
			
		||||
        return status;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  /* gl646, gl84[123] case */
 | 
			
		||||
  dpihw = sanei_genesys_read_reg_from_set (dev->reg, 0x05) >> 6;
 | 
			
		||||
 | 
			
		||||
  /* TODO invert the test so only the 2 models behaving like that are 
 | 
			
		||||
   * tested instead of adding all the others */
 | 
			
		||||
  /* many scanners send coefficient for lineart/gray like in color mode */
 | 
			
		||||
  if (dev->settings.scan_mode < 2
 | 
			
		||||
      && dev->model->ccd_type != CCD_DSMOBILE600
 | 
			
		||||
| 
						 | 
				
			
			@ -1766,8 +1857,10 @@ sanei_genesys_read_feed_steps (Genesys_Device * dev, unsigned int *steps)
 | 
			
		|||
  RIE (sanei_genesys_read_register (dev, 0x48, &value));
 | 
			
		||||
  if (dev->model->asic_type == GENESYS_GL646)
 | 
			
		||||
    *steps += ((value & 0x03) * 256 * 256);
 | 
			
		||||
  else
 | 
			
		||||
  else if (dev->model->asic_type == GENESYS_GL841)
 | 
			
		||||
    *steps += ((value & 0x0f) * 256 * 256);
 | 
			
		||||
  else
 | 
			
		||||
    *steps += ((value & 0x1f) * 256 * 256);
 | 
			
		||||
 | 
			
		||||
  DBG (DBG_proc, "sanei_genesys_read_feed_steps: %d steps\n", *steps);
 | 
			
		||||
  return SANE_STATUS_GOOD;
 | 
			
		||||
| 
						 | 
				
			
			@ -3213,6 +3306,7 @@ genesys_send_shading_coefficient (Genesys_Device * dev)
 | 
			
		|||
                            target_code);
 | 
			
		||||
      break;
 | 
			
		||||
    case CCD_CANONLIDE35:
 | 
			
		||||
    case CIS_CANONLIDE100:
 | 
			
		||||
      target_bright = 0xfa00;
 | 
			
		||||
      target_dark = 0xa00;
 | 
			
		||||
      o = 4;			/*first four pixels are ignored */
 | 
			
		||||
| 
						 | 
				
			
			@ -6055,7 +6149,10 @@ config_attach_genesys (SANEI_Config * config, const char *devname)
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
/* probes for scanner to attach to the backend */
 | 
			
		||||
static SANE_Status
 | 
			
		||||
#ifndef UNIT_TESTING
 | 
			
		||||
static
 | 
			
		||||
#endif
 | 
			
		||||
SANE_Status
 | 
			
		||||
probe_genesys_devices (void)
 | 
			
		||||
{
 | 
			
		||||
  SANEI_Config config;
 | 
			
		||||
| 
						 | 
				
			
			@ -6567,6 +6664,10 @@ sane_close (SANE_Handle handle)
 | 
			
		|||
 | 
			
		||||
  /* maybe todo: shut down scanner */
 | 
			
		||||
 | 
			
		||||
  /* we need this to avoid ASIC getting stuck
 | 
			
		||||
   * in bulk writes */
 | 
			
		||||
  sanei_usb_reset (s->dev->dn);
 | 
			
		||||
 | 
			
		||||
  sanei_usb_close (s->dev->dn);
 | 
			
		||||
  free (s);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -36,6 +36,12 @@ usb 0x04a9 0x2213
 | 
			
		|||
# Canon LiDE 60
 | 
			
		||||
usb 0x04a9 0x221c
 | 
			
		||||
 | 
			
		||||
# Canon LiDE 100
 | 
			
		||||
usb 0x04a9 0x1904
 | 
			
		||||
 | 
			
		||||
# Canon LiDE 200
 | 
			
		||||
usb 0x04a9 0x1905
 | 
			
		||||
 | 
			
		||||
# Visioneer Strobe XP200
 | 
			
		||||
usb 0x04a7 0x0426
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -49,6 +49,8 @@
 | 
			
		|||
 | 
			
		||||
#include "genesys_low.h"
 | 
			
		||||
 | 
			
		||||
#define FREE_IFNOT_NULL(x)		if(x!=NULL) { free(x); x=NULL;}
 | 
			
		||||
 | 
			
		||||
#define ENABLE(OPTION)  s->opt[OPTION].cap &= ~SANE_CAP_INACTIVE
 | 
			
		||||
#define DISABLE(OPTION) s->opt[OPTION].cap |=  SANE_CAP_INACTIVE
 | 
			
		||||
#define IS_ACTIVE(OPTION) (((s->opt[OPTION].cap) & SANE_CAP_INACTIVE) == 0)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -137,7 +137,15 @@ static Genesys_Frontend Wolfson[] = {
 | 
			
		|||
   , {0xa0, 0xa0, 0xa0}
 | 
			
		||||
   , {0x07, 0x00, 0x00}
 | 
			
		||||
   }
 | 
			
		||||
  ,		
 | 
			
		||||
  ,
 | 
			
		||||
  {DAC_CANONLIDE200,
 | 
			
		||||
     {0x9d, 0x91, 0x00, 0x00}
 | 
			
		||||
   , {0x00, 0x00, 0x00}
 | 
			
		||||
   , {0x00, 0x3f, 0x00} 
 | 
			
		||||
   , {0x32, 0x04, 0x00}
 | 
			
		||||
   , {0x00, 0x00, 0x00}
 | 
			
		||||
   }
 | 
			
		||||
  ,			
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -393,6 +401,56 @@ static Genesys_Sensor Sensor[] = {
 | 
			
		|||
   1.0, 1.0, 1.0,
 | 
			
		||||
   NULL, NULL, NULL}
 | 
			
		||||
  ,
 | 
			
		||||
  /* CANONLIDE200 */
 | 
			
		||||
  {CIS_CANONLIDE200,
 | 
			
		||||
   1200,	/* optical resolution */
 | 
			
		||||
   87,		/* black pixels */
 | 
			
		||||
   16,		/* dummy pixels */
 | 
			
		||||
   0,		
 | 
			
		||||
   10400,		
 | 
			
		||||
   210,
 | 
			
		||||
   200,
 | 
			
		||||
   {0x00, 0x00, 0x00, 0x00},
 | 
			
		||||
   /* reg 0x10 - 0x1d */
 | 
			
		||||
   {0x02, 0x7d, 0x02, 0x7d, 0x02, 0x7d, /* EXPR/EXPG/EXPB */
 | 
			
		||||
    0x10, 0x0c, 0x00, 0xff, 0x34, 0x00, 0x02, 0x04 },
 | 
			
		||||
   /* reg 0x52 - 0x5e */
 | 
			
		||||
   {0x03, 0x07,
 | 
			
		||||
    0x00, 0x00, 0x00, 0x00,
 | 
			
		||||
    0x2a, 0xe1,
 | 
			
		||||
    0x55,		
 | 
			
		||||
    0x00, 0x00, 0x00, 
 | 
			
		||||
    0x41	
 | 
			
		||||
    }
 | 
			
		||||
   ,
 | 
			
		||||
   1.0, 1.0, 1.0,
 | 
			
		||||
   NULL, NULL, NULL}
 | 
			
		||||
  ,
 | 
			
		||||
  /* CANONLIDE100 */
 | 
			
		||||
  {CIS_CANONLIDE100,
 | 
			
		||||
   1200,	/* optical resolution */
 | 
			
		||||
   87,		/* black pixels */
 | 
			
		||||
   16,		/* dummy pixels */
 | 
			
		||||
   0,		
 | 
			
		||||
   10592, /* 10272 + 320 start */
 | 
			
		||||
   210,
 | 
			
		||||
   200,
 | 
			
		||||
   {0x00, 0x00, 0x00, 0x00},
 | 
			
		||||
   /* reg 0x10 - 0x1d */
 | 
			
		||||
   {0x03, 0x00, 0x02, 0x00, 0x01, 0x80, /* EXPR/EXPG/EXPB */
 | 
			
		||||
    0x10, 0x08, 0x00, 0xff, 0x34, 0x00, 0x02, 0x04 },
 | 
			
		||||
   /* reg 0x52 - 0x5e */
 | 
			
		||||
   {0x03, 0x07,
 | 
			
		||||
    0x00, 0x00, 0x00, 0x00,
 | 
			
		||||
    0x2a, 0xe1,
 | 
			
		||||
    0x55,		
 | 
			
		||||
    0x00, 0x00, 0x00, 
 | 
			
		||||
    0x41	
 | 
			
		||||
    }
 | 
			
		||||
   ,
 | 
			
		||||
   1.0, 1.0, 1.0,
 | 
			
		||||
   NULL, NULL, NULL}
 | 
			
		||||
  ,
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -492,6 +550,14 @@ static Genesys_Gpo Gpo[] = {
 | 
			
		|||
   {0xfb, 0x00}, /* 6e, 6f */
 | 
			
		||||
  }
 | 
			
		||||
  ,
 | 
			
		||||
  /* CANONLIDE200 */
 | 
			
		||||
  {GPO_CANONLIDE200,
 | 
			
		||||
   {0xfb, 0x20}	/* 0xfb when idle , 0xf9/0xe9 (1200) when scanning */
 | 
			
		||||
   ,
 | 
			
		||||
   {0xff, 0x00}
 | 
			
		||||
   ,
 | 
			
		||||
   }
 | 
			
		||||
  ,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static Genesys_Motor Motor[] = {
 | 
			
		||||
| 
						 | 
				
			
			@ -712,6 +778,40 @@ static Genesys_Motor Motor[] = {
 | 
			
		|||
     0.8,
 | 
			
		||||
     },},},
 | 
			
		||||
  },
 | 
			
		||||
  {MOTOR_CANONLIDE100,		/* Canon LiDE 100 */
 | 
			
		||||
   1200,
 | 
			
		||||
   4800,
 | 
			
		||||
   2,   /* maximum step type count */
 | 
			
		||||
   1,   /* maximum power modes count */
 | 
			
		||||
   { /* motor slopes */
 | 
			
		||||
	   { /* power mode 0 */
 | 
			
		||||
		   {   2343,   1017, 128, 0.80}, /* full step */
 | 
			
		||||
    		   {   4678,   2034, 64, 0.80}, /* half step */
 | 
			
		||||
    		   { 4*2034, 4*2034, 32, 0.80}, /* quarter step */
 | 
			
		||||
		   /* extra values kept for documentation   
 | 
			
		||||
		   {   2343,    864, 32, 0.80},    full step   
 | 
			
		||||
    		   { 2*1171,  2*648, 32, 0.80},    half step */
 | 
			
		||||
	   },
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  {MOTOR_CANONLIDE200,		/* Canon LiDE 200 */
 | 
			
		||||
   1200,
 | 
			
		||||
   2400,
 | 
			
		||||
   1,
 | 
			
		||||
   1,
 | 
			
		||||
   {{{
 | 
			
		||||
     2343, /* first value of a recorded motor slope */
 | 
			
		||||
     534,  /* last value of recorded slope table */
 | 
			
		||||
     60,
 | 
			
		||||
     0.8,
 | 
			
		||||
     },
 | 
			
		||||
    {
 | 
			
		||||
     3500,
 | 
			
		||||
     1400,
 | 
			
		||||
     60,
 | 
			
		||||
     0.8,
 | 
			
		||||
    },},},
 | 
			
		||||
  },
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/* here we have the various device settings...
 | 
			
		||||
| 
						 | 
				
			
			@ -821,6 +921,115 @@ static Genesys_Model canon_lide_50_model = {
 | 
			
		|||
  400
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static Genesys_Model canon_lide_100_model = {
 | 
			
		||||
  "canon-lide-100",		/* Name */
 | 
			
		||||
  "Canon",			/* Device vendor string */
 | 
			
		||||
  "LiDE 100",			/* Device model name */
 | 
			
		||||
  GENESYS_GL847,
 | 
			
		||||
  NULL,
 | 
			
		||||
 | 
			
		||||
  {1200, 600, 300, 150, 100, 75, 0},	/* possible x-resolutions */
 | 
			
		||||
  {1200, 600, 300, 150, 100, 75, 0},	/* possible y-resolutions */
 | 
			
		||||
  {16, 8, 0},			/* possible depths in gray mode */
 | 
			
		||||
  {16, 8, 0},			/* possible depths in color mode */
 | 
			
		||||
 | 
			
		||||
  SANE_FIX (6.42),		/* Start of scan area in mm (x) */
 | 
			
		||||
  SANE_FIX (0.0),		/* Start of scan area in mm (y) */
 | 
			
		||||
  SANE_FIX (217.44),		/* Size of scan area in mm (x) */
 | 
			
		||||
  SANE_FIX (299.0),		/* Size of scan area in mm (y) */
 | 
			
		||||
 | 
			
		||||
  SANE_FIX (3.0),		/* Start of white strip in mm (y) */
 | 
			
		||||
  SANE_FIX (0.0),		/* Start of black mark in mm (x) */
 | 
			
		||||
 | 
			
		||||
  SANE_FIX (0.0),		/* Start of scan area in TA mode in mm (x) */
 | 
			
		||||
  SANE_FIX (0.0),		/* Start of scan area in TA mode in mm (y) */
 | 
			
		||||
  SANE_FIX (100.0),		/* Size of scan area in TA mode in mm (x) */
 | 
			
		||||
  SANE_FIX (100.0),		/* Size of scan area in TA mode in mm (y) */
 | 
			
		||||
 | 
			
		||||
  SANE_FIX (0.0),		/* Start of white strip in TA mode in mm (y) */
 | 
			
		||||
 | 
			
		||||
  SANE_FIX (0.0),		/* Size of scan area after paper sensor stops
 | 
			
		||||
				   sensing document in mm */
 | 
			
		||||
  SANE_FIX (0.0),		/* Amount of feeding needed to eject document 
 | 
			
		||||
				   after finishing scanning in mm */
 | 
			
		||||
 | 
			
		||||
  0, 0, 0,			/* RGB CCD Line-distance correction in pixel */
 | 
			
		||||
 | 
			
		||||
  COLOR_ORDER_RGB,		/* Order of the CCD/CIS colors */
 | 
			
		||||
 | 
			
		||||
  SANE_TRUE,			/* Is this a CIS scanner? */
 | 
			
		||||
  SANE_FALSE,			/* Is this a sheetfed scanner? */
 | 
			
		||||
  CIS_CANONLIDE100,
 | 
			
		||||
  DAC_CANONLIDE200,
 | 
			
		||||
  GPO_CANONLIDE200,
 | 
			
		||||
  MOTOR_CANONLIDE100,
 | 
			
		||||
  GENESYS_FLAG_LAZY_INIT 	/* Which flags are needed for this scanner? */
 | 
			
		||||
    | GENESYS_FLAG_NO_CALIBRATION 
 | 
			
		||||
    | GENESYS_FLAG_SKIP_WARMUP
 | 
			
		||||
    | GENESYS_FLAG_OFFSET_CALIBRATION
 | 
			
		||||
    | GENESYS_FLAG_DARK_WHITE_CALIBRATION
 | 
			
		||||
    | GENESYS_FLAG_CUSTOM_GAMMA,
 | 
			
		||||
  GENESYS_HAS_SCAN_SW | GENESYS_HAS_COPY_SW | GENESYS_HAS_EMAIL_SW | GENESYS_HAS_FILE_SW,
 | 
			
		||||
  150,
 | 
			
		||||
  400
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static Genesys_Model canon_lide_200_model = {
 | 
			
		||||
  "canon-lide-200",		/* Name */
 | 
			
		||||
  "Canon",			/* Device vendor string */
 | 
			
		||||
  "LiDE 200",			/* Device model name */
 | 
			
		||||
  GENESYS_GL847,
 | 
			
		||||
  NULL,
 | 
			
		||||
 | 
			
		||||
  {1200, 600, 300, 150, 75, 0},	/* possible x-resolutions */
 | 
			
		||||
  {1200, 600, 300, 150, 75, 0},	/* possible y-resolutions */
 | 
			
		||||
  {16, 8, 0},			/* possible depths in gray mode */
 | 
			
		||||
  {16, 8, 0},			/* possible depths in color mode */
 | 
			
		||||
 | 
			
		||||
  SANE_FIX (0.42),		/* Start of scan area in mm  (x) */
 | 
			
		||||
  SANE_FIX (7.9),		/* Start of scan area in mm (y) */
 | 
			
		||||
  SANE_FIX (218.0),		/* Size of scan area in mm (x) */
 | 
			
		||||
  SANE_FIX (299.0),		/* Size of scan area in mm (y) */
 | 
			
		||||
 | 
			
		||||
  SANE_FIX (3.0),		/* Start of white strip in mm (y) */
 | 
			
		||||
  SANE_FIX (0.0),		/* Start of black mark in mm (x) */
 | 
			
		||||
 | 
			
		||||
  SANE_FIX (0.0),		/* Start of scan area in TA mode in mm (x) */
 | 
			
		||||
  SANE_FIX (0.0),		/* Start of scan area in TA mode in mm (y) */
 | 
			
		||||
  SANE_FIX (100.0),		/* Size of scan area in TA mode in mm (x) */
 | 
			
		||||
  SANE_FIX (100.0),		/* Size of scan area in TA mode in mm (y) */
 | 
			
		||||
 | 
			
		||||
  SANE_FIX (0.0),		/* Start of white strip in TA mode in mm (y) */
 | 
			
		||||
 | 
			
		||||
  SANE_FIX (0.0),		/* Size of scan area after paper sensor stops
 | 
			
		||||
				   sensing document in mm */
 | 
			
		||||
  SANE_FIX (0.0),		/* Amount of feeding needed to eject document 
 | 
			
		||||
				   after finishing scanning in mm */
 | 
			
		||||
 | 
			
		||||
  0, 0, 0,			/* RGB CCD Line-distance correction in pixel */
 | 
			
		||||
 | 
			
		||||
  COLOR_ORDER_RGB,		/* Order of the CCD/CIS colors */
 | 
			
		||||
 | 
			
		||||
  SANE_TRUE,			/* Is this a CIS scanner? */
 | 
			
		||||
  SANE_FALSE,			/* Is this a sheetfed scanner? */
 | 
			
		||||
  CIS_CANONLIDE200,
 | 
			
		||||
  DAC_CANONLIDE200,
 | 
			
		||||
  GPO_CANONLIDE200,
 | 
			
		||||
  MOTOR_CANONLIDE200,
 | 
			
		||||
  GENESYS_FLAG_LAZY_INIT 	/* Which flags are needed for this scanner? */
 | 
			
		||||
    | GENESYS_FLAG_NO_CALIBRATION
 | 
			
		||||
    | GENESYS_FLAG_SKIP_WARMUP
 | 
			
		||||
    | GENESYS_FLAG_OFFSET_CALIBRATION
 | 
			
		||||
    | GENESYS_FLAG_DARK_WHITE_CALIBRATION
 | 
			
		||||
    | GENESYS_FLAG_CUSTOM_GAMMA 
 | 
			
		||||
    | GENESYS_FLAG_HALF_CCD_MODE,
 | 
			
		||||
  GENESYS_HAS_SCAN_SW | GENESYS_HAS_COPY_SW | GENESYS_HAS_EMAIL_SW | GENESYS_HAS_FILE_SW,
 | 
			
		||||
  150,
 | 
			
		||||
  400
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static Genesys_Model canon_lide_60_model = {
 | 
			
		||||
  "canon-lide-60",		/* Name */
 | 
			
		||||
  "Canon",			/* Device vendor string */
 | 
			
		||||
| 
						 | 
				
			
			@ -1906,5 +2115,8 @@ static Genesys_USB_Device_Entry genesys_usb_device_list[] = {
 | 
			
		|||
  {0x0a82, 0x480c, &syscan_docketport_685_model},
 | 
			
		||||
  {0x1dcc, 0x4810, &dct_docketport_487_model},
 | 
			
		||||
  {0x1dcc, 0x4812, &syscan_docketport_467_model},
 | 
			
		||||
  /* GL847 devices */
 | 
			
		||||
  {0x04a9, 0x1904, &canon_lide_100_model},
 | 
			
		||||
  {0x04a9, 0x1905, &canon_lide_200_model},
 | 
			
		||||
  {0, 0, NULL}
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5752,7 +5752,8 @@ static Genesys_Command_Set gl646_cmd_set = {
 | 
			
		|||
  gl646_search_strip,
 | 
			
		||||
 | 
			
		||||
  gl646_is_compatible_calibration,
 | 
			
		||||
  gl646_move_to_ta
 | 
			
		||||
  gl646_move_to_ta,
 | 
			
		||||
  NULL
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
SANE_Status
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -107,6 +107,7 @@
 | 
			
		|||
#define REG05_DPIHW_600	0x00
 | 
			
		||||
#define REG05_DPIHW_1200	0x40
 | 
			
		||||
#define REG05_DPIHW_2400	0x80
 | 
			
		||||
#define REG05_DPIHW_4800	0xc0
 | 
			
		||||
#define REG05_GMMTYPE	0x30
 | 
			
		||||
#define REG05_GMM14BIT  0x10
 | 
			
		||||
#define REG05_GMMENB	0x08
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6296,6 +6296,7 @@ static Genesys_Command_Set gl841_cmd_set = {
 | 
			
		|||
  gl841_search_strip,
 | 
			
		||||
 | 
			
		||||
  gl841_is_compatible_calibration,
 | 
			
		||||
  NULL,
 | 
			
		||||
  NULL
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
										
											
												Plik diff jest za duży
												Load Diff
											
										
									
								
							| 
						 | 
				
			
			@ -0,0 +1,491 @@
 | 
			
		|||
/* sane - Scanner Access Now Easy.
 | 
			
		||||
 | 
			
		||||
   Copyright (C) 2010 Stéphane Voltz <stef.dev@free.fr>
 | 
			
		||||
 | 
			
		||||
   This file is part of the SANE package.
 | 
			
		||||
   
 | 
			
		||||
   This program is free software; you can redistribute it and/or
 | 
			
		||||
   modify it under the terms of the GNU General Public License as
 | 
			
		||||
   published by the Free Software Foundation; either version 2 of the
 | 
			
		||||
   License, or (at your option) any later version.
 | 
			
		||||
   
 | 
			
		||||
   This program is distributed in the hope that it will be useful, but
 | 
			
		||||
   WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
			
		||||
   General Public License for more details.
 | 
			
		||||
   
 | 
			
		||||
   You should have received a copy of the GNU General Public License
 | 
			
		||||
   along with this program; if not, write to the Free Software
 | 
			
		||||
   Foundation, Inc., 59 Temple Place - Suite 330, Boston,
 | 
			
		||||
   MA 02111-1307, USA.
 | 
			
		||||
   
 | 
			
		||||
   As a special exception, the authors of SANE give permission for
 | 
			
		||||
   additional uses of the libraries contained in this release of SANE.
 | 
			
		||||
   
 | 
			
		||||
   The exception is that, if you link a SANE library with other files
 | 
			
		||||
   to produce an executable, this does not by itself cause the
 | 
			
		||||
   resulting executable to be covered by the GNU General Public
 | 
			
		||||
   License.  Your use of that executable is in no way restricted on
 | 
			
		||||
   account of linking the SANE library code into it.
 | 
			
		||||
   
 | 
			
		||||
   This exception does not, however, invalidate any other reasons why
 | 
			
		||||
   the executable file might be covered by the GNU General Public
 | 
			
		||||
   License.
 | 
			
		||||
   
 | 
			
		||||
   If you submit changes to SANE to the maintainers to be included in
 | 
			
		||||
   a subsequent release, you agree by submitting the changes that
 | 
			
		||||
   those changes may be distributed with this exception intact.
 | 
			
		||||
 | 
			
		||||
   If you write modifications of your own for SANE, it is your choice
 | 
			
		||||
   whether to permit this exception to apply to your modifications.
 | 
			
		||||
   If you do not wish that, delete this exception notice. 
 | 
			
		||||
*/
 | 
			
		||||
#include "../include/sane/config.h"
 | 
			
		||||
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
#include <math.h>
 | 
			
		||||
 | 
			
		||||
#include "../include/sane/sane.h"
 | 
			
		||||
#include "../include/sane/sanei.h"
 | 
			
		||||
#include "../include/sane/saneopts.h"
 | 
			
		||||
 | 
			
		||||
#undef BACKEND_NAME
 | 
			
		||||
#define BACKEND_NAME genesys_gl847
 | 
			
		||||
 | 
			
		||||
#include "../include/sane/sanei_backend.h"
 | 
			
		||||
#include "../include/sane/sanei_config.h"
 | 
			
		||||
#include "../include/sane/sanei_usb.h"
 | 
			
		||||
 | 
			
		||||
#include "../include/_stdint.h"
 | 
			
		||||
#include "genesys.h"
 | 
			
		||||
 | 
			
		||||
#define DBGSTART DBG (DBG_proc, "%s start\n", __FUNCTION__);
 | 
			
		||||
#define DBGCOMPLETED DBG (DBG_proc, "%s completed\n", __FUNCTION__);
 | 
			
		||||
 | 
			
		||||
#define REG01           0x01
 | 
			
		||||
#define REG01_CISSET	0x80
 | 
			
		||||
#define REG01_DOGENB	0x40
 | 
			
		||||
#define REG01_DVDSET	0x20
 | 
			
		||||
#define REG01_STAGGER   0x10
 | 
			
		||||
#define REG01_COMPENB	0x08
 | 
			
		||||
#define REG01_TRUEGRAY  0x04
 | 
			
		||||
#define REG01_SHDAREA	0x02
 | 
			
		||||
#define REG01_SCAN	0x01
 | 
			
		||||
 | 
			
		||||
#define REG02        	0x02
 | 
			
		||||
#define REG02_NOTHOME	0x80
 | 
			
		||||
#define REG02_ACDCDIS	0x40
 | 
			
		||||
#define REG02_AGOHOME	0x20
 | 
			
		||||
#define REG02_MTRPWR	0x10
 | 
			
		||||
#define REG02_FASTFED	0x08
 | 
			
		||||
#define REG02_MTRREV	0x04
 | 
			
		||||
#define REG02_HOMENEG	0x02
 | 
			
		||||
#define REG02_LONGCURV	0x01
 | 
			
		||||
 | 
			
		||||
#define REG03           0x03
 | 
			
		||||
#define REG03_LAMPDOG	0x80
 | 
			
		||||
#define REG03_AVEENB	0x40
 | 
			
		||||
#define REG03_XPASEL	0x20
 | 
			
		||||
#define REG03_LAMPPWR	0x10
 | 
			
		||||
#define REG03_LAMPTIM	0x0f
 | 
			
		||||
 | 
			
		||||
#define REG04        	0x04
 | 
			
		||||
#define REG04_LINEART	0x80
 | 
			
		||||
#define REG04_BITSET	0x40
 | 
			
		||||
#define REG04_AFEMOD	0x30
 | 
			
		||||
#define REG04_FILTER	0x0c
 | 
			
		||||
#define REG04_FESET	0x03
 | 
			
		||||
 | 
			
		||||
#define REG04S_AFEMOD   4
 | 
			
		||||
 | 
			
		||||
#define REG05 		0x05
 | 
			
		||||
#define REG05_DPIHW	0xc0
 | 
			
		||||
#define REG05_DPIHW_600	0x00
 | 
			
		||||
#define REG05_DPIHW_1200	0x40
 | 
			
		||||
#define REG05_DPIHW_2400	0x80
 | 
			
		||||
#define REG05_DPIHW_4800	0xc0
 | 
			
		||||
#define REG05_MTLLAMP	0x30
 | 
			
		||||
#define REG05_GMMENB	0x08
 | 
			
		||||
#define REG05_MTLBASE	0x03
 | 
			
		||||
 | 
			
		||||
#define REG06_SCANMOD	0xe0
 | 
			
		||||
#define REG06S_SCANMOD	5
 | 
			
		||||
#define REG06_PWRBIT	0x10
 | 
			
		||||
#define REG06_GAIN4	0x08
 | 
			
		||||
#define REG06_OPTEST	0x07
 | 
			
		||||
 | 
			
		||||
#define	REG07_LAMPSIM	0x80
 | 
			
		||||
 | 
			
		||||
#define REG08_DRAM2X  	0x80
 | 
			
		||||
#define REG08_MPENB     0x20
 | 
			
		||||
#define REG08_CIS_LINE  0x10
 | 
			
		||||
#define REG08_IR1ENB	0x08
 | 
			
		||||
#define REG08_IR2ENB    0x04
 | 
			
		||||
#define REG08_ENB24M    0x01
 | 
			
		||||
 | 
			
		||||
#define REG09_MCNTSET	0xc0
 | 
			
		||||
#define REG09_EVEN1ST   0x20
 | 
			
		||||
#define REG09_BLINE1ST  0x10
 | 
			
		||||
#define REG09_BACKSCAN	0x08
 | 
			
		||||
#define REG09_ENHANCE	0x04
 | 
			
		||||
#define REG09_SHORTTG	0x02
 | 
			
		||||
#define REG09_NWAIT	0x01
 | 
			
		||||
 | 
			
		||||
#define REG09S_MCNTSET  6
 | 
			
		||||
#define REG09S_CLKSET   4
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define REG0A_LPWMEN	0x10
 | 
			
		||||
 | 
			
		||||
#define REG0B           0x0b
 | 
			
		||||
#define REG0B_DRAMSEL   0x07
 | 
			
		||||
#define REG0B_ENBDRAM   0x08
 | 
			
		||||
#define REG0B_ENBDRAM   0x08
 | 
			
		||||
#define REG0B_RFHDIS    0x10
 | 
			
		||||
#define REG0B_CLKSET    0xe0
 | 
			
		||||
#define REG0B_24MHZ     0x00
 | 
			
		||||
#define REG0B_30MHZ     0x20
 | 
			
		||||
#define REG0B_40MHZ     0x40
 | 
			
		||||
#define REG0B_48MHZ     0x60
 | 
			
		||||
#define REG0B_60MHZ     0x80
 | 
			
		||||
 | 
			
		||||
#define REG0D 		0x0d
 | 
			
		||||
#define REG0D_FULLSTP   0x10
 | 
			
		||||
#define REG0D_SEND      0x80
 | 
			
		||||
#define REG0D_CLRMCNT   0x04
 | 
			
		||||
#define REG0D_CLRDOCJM  0x02
 | 
			
		||||
#define REG0D_CLRLNCNT	0x01
 | 
			
		||||
 | 
			
		||||
#define REG0F 		0x0f
 | 
			
		||||
 | 
			
		||||
#define REG16_CTRLHI	0x80
 | 
			
		||||
#define REG16_TOSHIBA	0x40
 | 
			
		||||
#define REG16_TGINV	0x20
 | 
			
		||||
#define REG16_CK1INV	0x10
 | 
			
		||||
#define REG16_CK2INV	0x08
 | 
			
		||||
#define REG16_CTRLINV	0x04
 | 
			
		||||
#define REG16_CKDIS	0x02
 | 
			
		||||
#define REG16_CTRLDIS	0x01
 | 
			
		||||
 | 
			
		||||
#define REG17_TGMODE	0xc0
 | 
			
		||||
#define REG17_TGMODE_NO_DUMMY	0x00
 | 
			
		||||
#define REG17_TGMODE_REF	0x40
 | 
			
		||||
#define REG17_TGMODE_XPA	0x80
 | 
			
		||||
#define REG17_TGW	0x3f
 | 
			
		||||
#define REG17S_TGW      0
 | 
			
		||||
 | 
			
		||||
#define REG18_CNSET	0x80
 | 
			
		||||
#define REG18_DCKSEL	0x60
 | 
			
		||||
#define REG18_CKTOGGLE	0x10
 | 
			
		||||
#define REG18_CKDELAY	0x0c
 | 
			
		||||
#define REG18_CKSEL	0x03
 | 
			
		||||
 | 
			
		||||
#define REG1A_SW2SET 	0x80
 | 
			
		||||
#define REG1A_SW1SET 	0x40
 | 
			
		||||
#define REG1A_MANUAL3	0x02
 | 
			
		||||
#define REG1A_MANUAL1	0x01
 | 
			
		||||
#define REG1A_CK4INV	0x08
 | 
			
		||||
#define REG1A_CK3INV	0x04
 | 
			
		||||
#define REG1A_LINECLP	0x02
 | 
			
		||||
 | 
			
		||||
#define REG1C_TGTIME    0x07
 | 
			
		||||
 | 
			
		||||
#define REG1D_CK4LOW	0x80
 | 
			
		||||
#define REG1D_CK3LOW	0x40
 | 
			
		||||
#define REG1D_CK1LOW	0x20
 | 
			
		||||
#define REG1D_TGSHLD	0x1f
 | 
			
		||||
#define REG1DS_TGSHLD   0
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define REG1E_WDTIME	0xf0
 | 
			
		||||
#define REG1ES_WDTIME   4
 | 
			
		||||
#define REG1E_LINESEL	0x0f
 | 
			
		||||
#define REG1ES_LINESEL  0
 | 
			
		||||
 | 
			
		||||
#define REG40           0x40
 | 
			
		||||
#define REG40_CHKVER    0x10
 | 
			
		||||
#define REG40_HISPDFLG  0x04
 | 
			
		||||
#define REG40_MOTMFLG   0x02
 | 
			
		||||
#define REG40_DATAENB   0x01
 | 
			
		||||
 | 
			
		||||
#define REG41_PWRBIT	0x80
 | 
			
		||||
#define REG41_BUFEMPTY	0x40
 | 
			
		||||
#define REG41_FEEDFSH	0x20
 | 
			
		||||
#define REG41_SCANFSH	0x10
 | 
			
		||||
#define REG41_HOMESNR	0x08
 | 
			
		||||
#define REG41_LAMPSTS	0x04
 | 
			
		||||
#define REG41_FEBUSY	0x02
 | 
			
		||||
#define REG41_MOTORENB	0x01
 | 
			
		||||
 | 
			
		||||
#define REG58_VSMP      0xf8
 | 
			
		||||
#define REG58S_VSMP     3
 | 
			
		||||
#define REG58_VSMPW     0x07
 | 
			
		||||
#define REG58S_VSMPW    0
 | 
			
		||||
 | 
			
		||||
#define REG59_BSMP      0xf8
 | 
			
		||||
#define REG59S_BSMP     3
 | 
			
		||||
#define REG59_BSMPW     0x07
 | 
			
		||||
#define REG59S_BSMPW    0
 | 
			
		||||
 | 
			
		||||
#define REG5A_ADCLKINV  0x80
 | 
			
		||||
#define REG5A_RLCSEL    0x40
 | 
			
		||||
#define REG5A_CDSREF    0x30
 | 
			
		||||
#define REG5AS_CDSREF   4
 | 
			
		||||
#define REG5A_RLC       0x0f
 | 
			
		||||
#define REG5AS_RLC      0
 | 
			
		||||
 | 
			
		||||
#define REG5E_DECSEL    0xe0
 | 
			
		||||
#define REG5ES_DECSEL   5
 | 
			
		||||
#define REG5E_STOPTIM   0x1f
 | 
			
		||||
#define REG5ES_STOPTIM  0
 | 
			
		||||
 | 
			
		||||
#define REG60           0x60
 | 
			
		||||
#define REG60_Z1MOD	0x1f
 | 
			
		||||
#define REG61           0x61
 | 
			
		||||
#define REG61_Z1MOD	0xff
 | 
			
		||||
#define REG62           0x62
 | 
			
		||||
#define REG62_Z1MOD	0xff
 | 
			
		||||
 | 
			
		||||
#define REG63           0x63
 | 
			
		||||
#define REG63_Z2MOD	0x1f
 | 
			
		||||
#define REG64           0x64
 | 
			
		||||
#define REG64_Z2MOD	0xff
 | 
			
		||||
#define REG65           0x65
 | 
			
		||||
#define REG65_Z2MOD	0xff
 | 
			
		||||
 | 
			
		||||
#define REG60S_STEPSEL      5
 | 
			
		||||
#define REG60_FSTPSEL	 0xe0
 | 
			
		||||
#define REG60_FULLSTEP	 0x00
 | 
			
		||||
#define REG60_HALFSTEP	 0x20
 | 
			
		||||
#define REG60_EIGHTHSTEP 0x60
 | 
			
		||||
#define REG60_16THSTEP   0x80
 | 
			
		||||
 | 
			
		||||
#define REG63S_STEPSEL      5
 | 
			
		||||
#define REG63_FSTPSEL	 0xe0
 | 
			
		||||
#define REG63_FULLSTEP	 0x00
 | 
			
		||||
#define REG63_HALFSTEP	 0x20
 | 
			
		||||
#define REG63_EIGHTHSTEP 0x60
 | 
			
		||||
#define REG63_16THSTEP   0x80
 | 
			
		||||
 | 
			
		||||
#define REG67 		0x67
 | 
			
		||||
#define REG67_MTRPWM	0x80
 | 
			
		||||
 | 
			
		||||
#define REG68 		0x68
 | 
			
		||||
#define REG68_FASTPWM	0x80
 | 
			
		||||
 | 
			
		||||
#define REG6B          	0x6b
 | 
			
		||||
#define REG6B_MULTFILM	0x80
 | 
			
		||||
#define REG6B_GPOM13	0x40
 | 
			
		||||
#define REG6B_GPOM12	0x20
 | 
			
		||||
#define REG6B_GPOM11	0x10
 | 
			
		||||
#define REG6B_GPO18	0x02
 | 
			
		||||
#define REG6B_GPO17	0x01
 | 
			
		||||
 | 
			
		||||
#define REG6C           0x6c
 | 
			
		||||
#define REG6C_GPIO16    0x80
 | 
			
		||||
#define REG6C_GPIO15    0x40
 | 
			
		||||
#define REG6C_GPIO14    0x20
 | 
			
		||||
#define REG6C_GPIO13    0x10
 | 
			
		||||
#define REG6C_GPIO12    0x08
 | 
			
		||||
#define REG6C_GPIO11    0x04
 | 
			
		||||
#define REG6C_GPIO10    0x02
 | 
			
		||||
#define REG6C_GPIO9     0x01
 | 
			
		||||
#define REG6C_GPIOH	0xff
 | 
			
		||||
#define REG6C_GPIOL	0xff
 | 
			
		||||
 | 
			
		||||
#define REG6D           0x6d
 | 
			
		||||
#define REG6E           0x6e
 | 
			
		||||
#define REG6F           0x6f
 | 
			
		||||
 | 
			
		||||
#define REG87_LEDADD    0x04
 | 
			
		||||
 | 
			
		||||
#define REGA6   	0xa6
 | 
			
		||||
#define REGA7 		0xa7
 | 
			
		||||
#define REGA9 		0xa9
 | 
			
		||||
 | 
			
		||||
#define SCAN_FLAG_SINGLE_LINE              0x01
 | 
			
		||||
#define SCAN_FLAG_DISABLE_SHADING          0x02
 | 
			
		||||
#define SCAN_FLAG_DISABLE_GAMMA            0x04
 | 
			
		||||
#define SCAN_FLAG_DISABLE_BUFFER_FULL_MOVE 0x08
 | 
			
		||||
#define SCAN_FLAG_IGNORE_LINE_DISTANCE     0x10
 | 
			
		||||
#define SCAN_FLAG_USE_OPTICAL_RES          0x20
 | 
			
		||||
#define SCAN_FLAG_DISABLE_LAMP             0x40
 | 
			
		||||
#define SCAN_FLAG_DYNAMIC_LINEART          0x80
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * writable scanner registers */
 | 
			
		||||
enum
 | 
			
		||||
{
 | 
			
		||||
  reg_0x01 = 0,
 | 
			
		||||
  reg_0x02,
 | 
			
		||||
  reg_0x03,
 | 
			
		||||
  reg_0x04,
 | 
			
		||||
  reg_0x05,
 | 
			
		||||
  reg_0x06,
 | 
			
		||||
  reg_0x08,
 | 
			
		||||
  reg_0x09,
 | 
			
		||||
  reg_0x0a,
 | 
			
		||||
  reg_0x0b,
 | 
			
		||||
  reg_0x0c,
 | 
			
		||||
  reg_0x0d,
 | 
			
		||||
  reg_0x0e,
 | 
			
		||||
  reg_0x0f,
 | 
			
		||||
  reg_0x10,
 | 
			
		||||
  reg_0x11,
 | 
			
		||||
  reg_0x12,
 | 
			
		||||
  reg_0x13,
 | 
			
		||||
  reg_0x14,
 | 
			
		||||
  reg_0x15,
 | 
			
		||||
  reg_0x16,
 | 
			
		||||
  reg_0x17,
 | 
			
		||||
  reg_0x18,
 | 
			
		||||
  reg_0x19,
 | 
			
		||||
  reg_0x1a,
 | 
			
		||||
  reg_0x1b,
 | 
			
		||||
  reg_0x1c,
 | 
			
		||||
  reg_0x1d,
 | 
			
		||||
  reg_0x1e,
 | 
			
		||||
  reg_0x1f,
 | 
			
		||||
  reg_0x20,
 | 
			
		||||
  reg_0x21,
 | 
			
		||||
  reg_0x22,
 | 
			
		||||
  reg_0x23,
 | 
			
		||||
  reg_0x24,
 | 
			
		||||
  reg_0x25,
 | 
			
		||||
  reg_0x26,
 | 
			
		||||
  reg_0x27,
 | 
			
		||||
  reg_0x2c,
 | 
			
		||||
  reg_0x2d,
 | 
			
		||||
  reg_0x2e,
 | 
			
		||||
  reg_0x2f,
 | 
			
		||||
  reg_0x30,
 | 
			
		||||
  reg_0x31,
 | 
			
		||||
  reg_0x32,
 | 
			
		||||
  reg_0x33,
 | 
			
		||||
  reg_0x34,
 | 
			
		||||
  reg_0x35,
 | 
			
		||||
  reg_0x36,
 | 
			
		||||
  reg_0x37,
 | 
			
		||||
  reg_0x38,
 | 
			
		||||
  reg_0x39,
 | 
			
		||||
  reg_0x3a,
 | 
			
		||||
  reg_0x3b,
 | 
			
		||||
  reg_0x3d,
 | 
			
		||||
  reg_0x3e,
 | 
			
		||||
  reg_0x3f,
 | 
			
		||||
  reg_0x51,
 | 
			
		||||
  reg_0x52,
 | 
			
		||||
  reg_0x53,
 | 
			
		||||
  reg_0x54,
 | 
			
		||||
  reg_0x55,
 | 
			
		||||
  reg_0x56,
 | 
			
		||||
  reg_0x57,
 | 
			
		||||
  reg_0x58,
 | 
			
		||||
  reg_0x59,
 | 
			
		||||
  reg_0x5a,
 | 
			
		||||
  reg_0x5e,
 | 
			
		||||
  reg_0x5f,
 | 
			
		||||
  reg_0x60,
 | 
			
		||||
  reg_0x61,
 | 
			
		||||
  reg_0x62,
 | 
			
		||||
  reg_0x63,
 | 
			
		||||
  reg_0x64,
 | 
			
		||||
  reg_0x65,
 | 
			
		||||
  reg_0x67,
 | 
			
		||||
  reg_0x68,
 | 
			
		||||
  reg_0x69,
 | 
			
		||||
  reg_0x6a,
 | 
			
		||||
  reg_0x6b,
 | 
			
		||||
  reg_0x6c,
 | 
			
		||||
  reg_0x6d,
 | 
			
		||||
  reg_0x6e,
 | 
			
		||||
  reg_0x6f,
 | 
			
		||||
  reg_0x74,
 | 
			
		||||
  reg_0x75,
 | 
			
		||||
  reg_0x76,
 | 
			
		||||
  reg_0x77,
 | 
			
		||||
  reg_0x78,
 | 
			
		||||
  reg_0x79,
 | 
			
		||||
  reg_0x7a,
 | 
			
		||||
  reg_0x7b,
 | 
			
		||||
  reg_0x7c,
 | 
			
		||||
  reg_0x7d,
 | 
			
		||||
  reg_0x87,
 | 
			
		||||
  reg_0x9d,
 | 
			
		||||
  reg_0xa2,
 | 
			
		||||
  reg_0xa6,
 | 
			
		||||
  reg_0xa7,
 | 
			
		||||
  reg_0xa8,
 | 
			
		||||
  reg_0xa9,
 | 
			
		||||
  reg_0xbd,
 | 
			
		||||
  reg_0xbe,
 | 
			
		||||
  reg_0xc5,
 | 
			
		||||
  reg_0xc6,
 | 
			
		||||
  reg_0xc7,
 | 
			
		||||
  reg_0xc8,
 | 
			
		||||
  reg_0xc9,
 | 
			
		||||
  reg_0xca,
 | 
			
		||||
  reg_0xd0,
 | 
			
		||||
  reg_0xd1,
 | 
			
		||||
  reg_0xd2,
 | 
			
		||||
  reg_0xe0,
 | 
			
		||||
  reg_0xe1,
 | 
			
		||||
  reg_0xe2,
 | 
			
		||||
  reg_0xe3,
 | 
			
		||||
  reg_0xe4,
 | 
			
		||||
  reg_0xe5,
 | 
			
		||||
  reg_0xe6,
 | 
			
		||||
  reg_0xe7,
 | 
			
		||||
  reg_0xe8,
 | 
			
		||||
  reg_0xe9,
 | 
			
		||||
  reg_0xea,
 | 
			
		||||
  reg_0xeb,
 | 
			
		||||
  reg_0xec,
 | 
			
		||||
  reg_0xed,
 | 
			
		||||
  reg_0xee,
 | 
			
		||||
  reg_0xef,
 | 
			
		||||
  reg_0xf0,
 | 
			
		||||
  reg_0xf1,
 | 
			
		||||
  reg_0xf2,
 | 
			
		||||
  reg_0xf3,
 | 
			
		||||
  reg_0xf4,
 | 
			
		||||
  reg_0xf5,
 | 
			
		||||
  reg_0xf6,
 | 
			
		||||
  reg_0xf7,
 | 
			
		||||
  reg_0xf8,
 | 
			
		||||
  reg_0xfe,
 | 
			
		||||
  GENESYS_GL847_MAX_REGS
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#define SETREG(adr,val) {dev->reg[reg_##adr].address=adr;dev->reg[reg_##adr].value=val;}
 | 
			
		||||
 | 
			
		||||
typedef struct
 | 
			
		||||
{
 | 
			
		||||
  uint8_t rd0;
 | 
			
		||||
  uint8_t rd1;
 | 
			
		||||
  uint8_t rd2;
 | 
			
		||||
  uint8_t re0;
 | 
			
		||||
  uint8_t re1;
 | 
			
		||||
  uint8_t re2;
 | 
			
		||||
  uint8_t re3;
 | 
			
		||||
  uint8_t re4;
 | 
			
		||||
  uint8_t re5;
 | 
			
		||||
  uint8_t re6;
 | 
			
		||||
  uint8_t re7;
 | 
			
		||||
} Memory_layout;
 | 
			
		||||
 | 
			
		||||
static Memory_layout layouts[]={
 | 
			
		||||
	/* LIDE 100 */
 | 
			
		||||
	{
 | 
			
		||||
		0x0a, 0x15, 0x20,
 | 
			
		||||
		0x00, 0xac, 0x02, 0x55, 0x02, 0x56, 0x03, 0xff
 | 
			
		||||
	},
 | 
			
		||||
	/* LIDE 200 */
 | 
			
		||||
	{
 | 
			
		||||
		0x0a, 0x1f, 0x34,
 | 
			
		||||
		0x01, 0x24, 0x02, 0x91, 0x02, 0x92, 0x03, 0xff
 | 
			
		||||
	}
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			@ -123,6 +123,8 @@
 | 
			
		|||
#define GPIO_OUTPUT_ENABLE	0x89
 | 
			
		||||
#define GPIO_READ		0x8a
 | 
			
		||||
#define GPIO_WRITE		0x8b
 | 
			
		||||
#define VALUE_BUF_ENDACCESS	0x8c
 | 
			
		||||
#define VALUE_GET_REGISTER	0x8e
 | 
			
		||||
#define INDEX			0x00
 | 
			
		||||
 | 
			
		||||
/* todo: used?
 | 
			
		||||
| 
						 | 
				
			
			@ -146,8 +148,8 @@
 | 
			
		|||
#define AFE_SET        2
 | 
			
		||||
#define AFE_POWER_SAVE 4
 | 
			
		||||
 | 
			
		||||
#define LOWORD(x)  ((uint16_t)(x & 0xffff))
 | 
			
		||||
#define HIWORD(x)  ((uint16_t)(x >> 16))
 | 
			
		||||
#define LOWORD(x)  ((uint16_t)((x) & 0xffff))
 | 
			
		||||
#define HIWORD(x)  ((uint16_t)((x) >> 16))
 | 
			
		||||
#define LOBYTE(x)  ((uint8_t)((x) & 0xFF))
 | 
			
		||||
#define HIBYTE(x)  ((uint8_t)((x) >> 8))
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -240,9 +242,11 @@ Genesys_Color_Order;
 | 
			
		|||
 | 
			
		||||
#define GENESYS_GL646	 646
 | 
			
		||||
#define GENESYS_GL841	 841
 | 
			
		||||
#define GENESYS_GL846	 846
 | 
			
		||||
#define GENESYS_GL847	 847
 | 
			
		||||
#define GENESYS_GL848	 848
 | 
			
		||||
 | 
			
		||||
/*135 registers for gl841 + 1 null-reg*/
 | 
			
		||||
#define GENESYS_MAX_REGS 136
 | 
			
		||||
#define GENESYS_MAX_REGS 256
 | 
			
		||||
 | 
			
		||||
#define DAC_WOLFSON_UMAX   0
 | 
			
		||||
#define DAC_WOLFSON_ST12   1
 | 
			
		||||
| 
						 | 
				
			
			@ -255,6 +259,7 @@ Genesys_Color_Order;
 | 
			
		|||
#define DAC_WOLFSON_XP300  8
 | 
			
		||||
#define DAC_WOLFSON_HP3670 9
 | 
			
		||||
#define DAC_WOLFSON_DSM600 10
 | 
			
		||||
#define DAC_CANONLIDE200   11
 | 
			
		||||
 | 
			
		||||
#define CCD_UMAX         0
 | 
			
		||||
#define CCD_ST12         1	/* SONY ILX548: 5340 Pixel  ??? */
 | 
			
		||||
| 
						 | 
				
			
			@ -271,6 +276,8 @@ Genesys_Color_Order;
 | 
			
		|||
#define CCD_DSMOBILE600  12
 | 
			
		||||
#define CCD_XP300        13
 | 
			
		||||
#define CCD_DP685        14
 | 
			
		||||
#define CIS_CANONLIDE200 15
 | 
			
		||||
#define CIS_CANONLIDE100 16
 | 
			
		||||
 | 
			
		||||
#define GPO_UMAX         0
 | 
			
		||||
#define GPO_ST12         1
 | 
			
		||||
| 
						 | 
				
			
			@ -284,6 +291,7 @@ Genesys_Color_Order;
 | 
			
		|||
#define GPO_HP3670       9
 | 
			
		||||
#define GPO_DP665        10
 | 
			
		||||
#define GPO_DP685        11
 | 
			
		||||
#define GPO_CANONLIDE200 12
 | 
			
		||||
 | 
			
		||||
#define MOTOR_UMAX       0
 | 
			
		||||
#define MOTOR_5345       1
 | 
			
		||||
| 
						 | 
				
			
			@ -297,6 +305,8 @@ Genesys_Color_Order;
 | 
			
		|||
#define MOTOR_DP665      10
 | 
			
		||||
#define MOTOR_ROADWARRIOR 11
 | 
			
		||||
#define MOTOR_DSMOBILE_600 12
 | 
			
		||||
#define MOTOR_CANONLIDE200 13
 | 
			
		||||
#define MOTOR_CANONLIDE100 14
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* Forward typedefs */
 | 
			
		||||
| 
						 | 
				
			
			@ -416,6 +426,12 @@ typedef struct Genesys_Command_Set
 | 
			
		|||
     * move scanning head to transparency adapter
 | 
			
		||||
     */
 | 
			
		||||
    SANE_Status (*move_to_ta) (Genesys_Device * dev);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * write shading data calibration to ASIC
 | 
			
		||||
     */
 | 
			
		||||
    SANE_Status (*send_shading_data) (Genesys_Device * dev, uint8_t * data, int size);
 | 
			
		||||
 | 
			
		||||
} Genesys_Command_Set;
 | 
			
		||||
 | 
			
		||||
typedef struct Genesys_Model
 | 
			
		||||
| 
						 | 
				
			
			@ -567,8 +583,8 @@ struct Genesys_Device
 | 
			
		|||
  SANE_String calib_file;
 | 
			
		||||
  Genesys_Model *model;
 | 
			
		||||
 | 
			
		||||
  Genesys_Register_Set reg[GENESYS_MAX_REGS];
 | 
			
		||||
  Genesys_Register_Set calib_reg[GENESYS_MAX_REGS];
 | 
			
		||||
  Genesys_Register_Set reg[256];
 | 
			
		||||
  Genesys_Register_Set calib_reg[256];
 | 
			
		||||
  Genesys_Settings settings;
 | 
			
		||||
  Genesys_Frontend frontend;
 | 
			
		||||
  Genesys_Sensor sensor;
 | 
			
		||||
| 
						 | 
				
			
			@ -769,5 +785,6 @@ sanei_genesys_buffer_consume(Genesys_Buffer * buf, size_t size);
 | 
			
		|||
/*---------------------------------------------------------------------------*/
 | 
			
		||||
extern SANE_Status sanei_gl646_init_cmd_set (Genesys_Device * dev);
 | 
			
		||||
extern SANE_Status sanei_gl841_init_cmd_set (Genesys_Device * dev);
 | 
			
		||||
extern SANE_Status sanei_gl847_init_cmd_set (Genesys_Device * dev);
 | 
			
		||||
 | 
			
		||||
#endif /* not GENESYS_LOW_H */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -278,6 +278,12 @@ extern SANE_Status sanei_usb_clear_halt (SANE_Int dn);
 | 
			
		|||
 */
 | 
			
		||||
#define HAVE_SANEI_USB_CLEAR_HALT
 | 
			
		||||
 | 
			
		||||
/** Reset device
 | 
			
		||||
 * 
 | 
			
		||||
 * @param dn device number
 | 
			
		||||
 */
 | 
			
		||||
extern SANE_Status sanei_usb_reset (SANE_Int dn);
 | 
			
		||||
 | 
			
		||||
/** Initiate a bulk transfer read.
 | 
			
		||||
 *
 | 
			
		||||
 * Read up to size bytes from the device to buffer. After the read, size
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2014,6 +2014,34 @@ sanei_usb_clear_halt (SANE_Int dn)
 | 
			
		|||
  return SANE_STATUS_GOOD;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SANE_Status
 | 
			
		||||
sanei_usb_reset (SANE_Int dn)
 | 
			
		||||
{
 | 
			
		||||
#ifdef HAVE_LIBUSB
 | 
			
		||||
  int ret;
 | 
			
		||||
 | 
			
		||||
  ret = usb_reset (devices[dn].libusb_handle);
 | 
			
		||||
  if (ret){
 | 
			
		||||
    DBG (1, "sanei_usb_reset: ret=%d\n", ret);
 | 
			
		||||
    return SANE_STATUS_INVAL;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
#elif defined(HAVE_LIBUSB_1_0)
 | 
			
		||||
  int ret;
 | 
			
		||||
 | 
			
		||||
  ret = libusb_reset_device (devices[dn].lu_handle);
 | 
			
		||||
  if (ret){
 | 
			
		||||
    DBG (1, "sanei_usb_reset: ret=%d\n", ret);
 | 
			
		||||
    return SANE_STATUS_INVAL;
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
#else /* not HAVE_LIBUSB && not HAVE_LIBUSB_1_0 */
 | 
			
		||||
  DBG (1, "sanei_usb_reset: libusb support missing\n");
 | 
			
		||||
#endif /* HAVE_LIBUSB || HAVE_LIBUSB_1_0 */
 | 
			
		||||
 | 
			
		||||
  return SANE_STATUS_GOOD;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SANE_Status
 | 
			
		||||
sanei_usb_read_bulk (SANE_Int dn, SANE_Byte * buffer, size_t * size)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Ładowanie…
	
		Reference in New Issue