[sane-devel] Epson perfection 4990 photo/GT-X800 patch for 4800 dpi
Claus Boje
claus at egehuset.dk
Thu Mar 23 15:00:53 UTC 2006
Hello
This scanner has a bug, it only reports maximum 3200 dpi back.
Here is a patch there will let this scanner be seen as a 4800 dpi
How do I get this patch in the next version of sane backends ?
This patch is make from sane-backends-1.0.17 and the the file needed to be
patch is backend/epson.c
patch --->
--- backend/epson.c 2005-01-10 20:23:08.000000000 +0100
+++ backend_4990/epson_4990.c 2006-03-22 17:56:08.000000000 +0100
@@ -14,6 +14,7 @@
Copyright (C) 2000 Mike Porter <mike at udel.edu> (mjp)
Copyright (C) 2003 EPSON KOWA Corporation
Copyright (C) 1999-2005 Karl Heinz Kremer <khk at khk.net>
+ Copyright (C) 2006 Claus Boje <claus at egehuset.dk>
*/
#define SANE_EPSON_VERSION "SANE Epson Backend v0.2.45 -
2000-01-09"
@@ -59,6 +60,7 @@
If you do not wish that, delete this exception notice. */
/*
+ 2006-03-12 Added support for perfetion 4990 photo 4800 dpi
2005-01-09 "flaming hack to get USB scanners working without timeouts
under linux"
submitted by "Steve" (in comment to bug #300830)
2004-12-18 Added USB IDs for CX-4600 and CX-3650
@@ -2478,6 +2480,21 @@
SANE_FIX ((buf[10] << 8 | buf[9]) * 25.4 / dev->dpi_range.max);
dev->tpu_y_range.quant = 0;
+ /*
+ * Check for Perfection 4990 photo/GT-X800 scanner.
+ * This scanner only report 3200 dpi back.
+ * The scanner fysical supports 4800 dpi.
+ * This is simulated here...
+ * Futher details read:
+ * EPSON Programming guide for EPSON Color Image Scanner Perfection
4990
+ */
+ if (strncmp(&buf[0x1A],"GT-X800",7) == 0)
+ {
+ dev->tpu_x_range.max = (dev->tpu_x_range.max/32)*48;
+ dev->tpu_y_range.max = (dev->tpu_y_range.max/32)*48;
+ DBG (5, "dpi_range.max %x \n", dev->dpi_range.max);
+ }
+
DBG (5, "tpu tlx %f tly %f brx %f bry %f [mm]\n",
SANE_UNFIX (dev->tpu_x_range.min),
SANE_UNFIX (dev->tpu_y_range.min),
@@ -5949,7 +5966,6 @@
/* we need to correct for the difference in size between
the EpsonIdentRec and the EpsonHdrRec */
int correction = sizeof (EpsonIdentRec) - sizeof (EpsonHdrRec);
-
for (n = (count - correction), buf = ident->buf; n; n -= k, buf += k)
{
switch (*buf)
@@ -5982,6 +5998,53 @@
DBG (1, "maximum scan area: x %d y %d\n", x, y);
k = 5;
+
+ /*
+ * Check for Perfection 4990 photo/GT-X800 scanner.
+ * This scanner only report 3200 dpi back.
+ * The scanner fysical supports 4800 dpi.
+ * This is simulated here...
+ * Futher details read:
+ * EPSON Programming guide for EPSON Color Image Scanner
Perfection 4990
+ */
+ if (s->hw->cmd->request_extended_status != 0)
+ {
+ u_char *buf;
+ u_char params[2];
+ EpsonHdr head;
+
+ params[0] = ESC;
+ params[1] = s->hw->cmd->request_extended_status;
+
+ if (NULL != (head = (EpsonHdr) command (s, params, 2,
&status)))
+ {
+ buf = &head->buf[0x1A];
+ DBG (1, "product name %x %x %x %x %x %x %x %x \n", buf[0],
buf[1],buf[2],buf[3],buf[4], buf[5],buf[6], buf[7] );
+ if (strncmp(buf,"GT-X800",7) == 0)
+ {
+ int val = 0x12 << 8 | 0xC0;
+
+ s->hw->res_list_size++;
+ s->hw->res_list =
+ (SANE_Int *) realloc (s->hw->res_list,
+ s->hw->res_list_size * sizeof
(SANE_Int));
+
+ if (NULL == s->hw->res_list)
+ {
+ DBG (1, "out of memory (line %d)\n", __LINE__);
+ return SANE_STATUS_NO_MEM;
+ }
+
+ s->hw->res_list[s->hw->res_list_size - 1] = (SANE_Int) val;
+ x = (x/32)*48;
+ y = (y/32)*48;
+
+ DBG (1, "resolution (dpi): %d\n", val);
+ DBG (1, "maximum scan area GT-X800: x %d y %d\n", x, y);
+ }
+ }
+ }
+
continue;
}
default:
----
Claus Boje
More information about the sane-devel
mailing list