[sane-devel] [PATCH 3/3] canon: Add support for Canon IX-4015 scanner

Ondrej Zary linux at rainbow-software.org
Fri Jul 20 14:30:23 UTC 2012


This adds support for Canon IX-4015 scanner. The difference from other scanners
supported by this backend is that it has no highlight and shadow settings - the
corresponding bytes in set_window command must be zero or it will fail.

IX-4015 has optical resolution of 400 dpi, can interpolate up to 800 dpi (color)
or 1200 dpi (grayscale).

diff --git a/backend/canon-sane.c b/backend/canon-sane.c
index 85f2c40..79ce0ba 100644
--- a/backend/canon-sane.c
+++ b/backend/canon-sane.c
@@ -1404,6 +1404,20 @@ sane_start (SANE_Handle handle)
       wbuf[57] = 1;
       wbuf[58] = 1;
     }
+  else if (s->hw->info.model == IX4015) /* modification for IX-4015 */
+    {
+      wbuf[36] = 0;
+      wbuf[37] = (s->RIF << 7);
+      wbuf[57] = 0;
+      wbuf[58] = 0;
+      /* no highlight and shadow control */
+      wbuf[59] = 0;
+      wbuf[60] = 0;
+      wbuf[62] = 0;
+      wbuf[64] = 0;
+      wbuf[70] = 0;
+      wbuf[71] = 0;
+    }
 
   buf_size = sizeof (wbuf);
   status = set_window (s->fd, wbuf);
diff --git a/backend/canon.c b/backend/canon.c
index cf45d42..96a5fe9 100644
--- a/backend/canon.c
+++ b/backend/canon.c
@@ -906,6 +906,21 @@ attach (const char *devnam, CANON_Device ** devp)
       dev->info.is_filmscanner = SANE_FALSE;
       dev->info.has_fixed_resolutions = SANE_TRUE;
     }
+  else if (!strncmp (str, "IX-4015", 7))	/* IX-4015 */
+    {
+      dev->info.model = IX4015;
+      dev->sane.type = SANE_I18N("flatbed scanner");
+      dev->adf.Status = ADF_STAT_INACTIVE;
+      dev->tpu.Status = TPU_STAT_INACTIVE;
+      dev->info.can_focus = SANE_FALSE;
+      dev->info.can_autoexpose = SANE_TRUE;
+      dev->info.can_calibrate = SANE_FALSE;
+      dev->info.can_diagnose = SANE_TRUE;
+      dev->info.can_eject = SANE_FALSE;
+      dev->info.can_mirror = SANE_TRUE;
+      dev->info.is_filmscanner = SANE_FALSE;
+      dev->info.has_fixed_resolutions = SANE_FALSE;
+    }
   else						/* CS300, CS600 */
     {
       dev->info.model = CS3_600;
@@ -1406,8 +1421,8 @@ init_options (CANON_Scanner * s)
   s->opt[OPT_BIND_HILO].title = SANE_TITLE_RGB_BIND;
   s->opt[OPT_BIND_HILO].desc = SANE_DESC_RGB_BIND;
   s->opt[OPT_BIND_HILO].type = SANE_TYPE_BOOL;
-  s->opt[OPT_BIND_HILO].cap |=
-    (s->hw->info.model == FB620) ? SANE_CAP_INACTIVE : 0;
+  s->opt[OPT_BIND_HILO].cap |= (s->hw->info.model == FB620 ||
+    s->hw->info.model == IX4015) ? SANE_CAP_INACTIVE : 0;
   s->val[OPT_BIND_HILO].w = SANE_TRUE;
 
   /* highlight point for red   */
@@ -1440,6 +1455,8 @@ init_options (CANON_Scanner * s)
   s->opt[OPT_HILITE_G].unit = SANE_UNIT_NONE;
   s->opt[OPT_HILITE_G].constraint_type = SANE_CONSTRAINT_RANGE;
   s->opt[OPT_HILITE_G].constraint.range = &s->hw->info.HiliteG_range;
+  s->opt[OPT_HILITE_G].cap |=
+    (s->hw->info.model == IX4015) ? SANE_CAP_INACTIVE : 0;
   s->val[OPT_HILITE_G].w = 255;
 
   /* shadow point for green */
@@ -1450,6 +1467,8 @@ init_options (CANON_Scanner * s)
   s->opt[OPT_SHADOW_G].unit = SANE_UNIT_NONE;
   s->opt[OPT_SHADOW_G].constraint_type = SANE_CONSTRAINT_RANGE;
   s->opt[OPT_SHADOW_G].constraint.range = &s->hw->info.ShadowG_range;
+  s->opt[OPT_SHADOW_G].cap |=
+    (s->hw->info.model == IX4015) ? SANE_CAP_INACTIVE : 0;
   s->val[OPT_SHADOW_G].w = 0;
 
   /* highlight point for blue  */
diff --git a/backend/canon.h b/backend/canon.h
index b8ccabb..34f527b 100644
--- a/backend/canon.h
+++ b/backend/canon.h
@@ -97,6 +97,7 @@
 #define FB620    2		/* CanoScan FB620S */
 #define FS2710   3		/* CanoScan FS2710S */
 #define FB1200   4		/* CanoScan FB1200S */
+#define IX4015   5		/* IX-4015 */
 
 #ifndef MAX
 #define MAX(A,B)	(((A) > (B))? (A) : (B))
diff --git a/doc/descriptions/canon.desc b/doc/descriptions/canon.desc
index 8fc51e8..c6db616 100644
--- a/doc/descriptions/canon.desc
+++ b/doc/descriptions/canon.desc
@@ -50,6 +50,11 @@
 :comment "1 pass; 36bit film scanner"
 :status :good
 
+:model "IX-4015"		; name models for above-specified mfg.
+:interface "SCSI"
+:comment "1 pass; flatbed scanner"
+:status :good
+
 :mfg "Apple"			; name a manufacturer
 :url "http://www.apple.com/"
 


-- 
Ondrej Zary



More information about the sane-devel mailing list