[sane-devel] Epson Perfetion 2480 scanner

Julien BLACHE jb@jblache.org
Mon, 30 Aug 2004 16:04:45 +0200


--=-=-=

Karsten Festag <karsten.festag@gmx.de> wrote:

Hi,

> I also have an Epson2480 and after your suggestions I made the modifications 
> in the attached diff file. Scanning works fine, I can scan the whole glass 

Your patch is missing an important bit; in
snapscan-scsi.c::download_firmware(), you need to add a case for the
PERFECTION2480, otherwise the firmware won't load properly (enters an
infinite loop).

New patch attached, diff'ed with -u this time.

Scanning works fine, however it seems the scanner locks after the
first scan :/

JB.

-- 
Julien BLACHE                                   <http://www.jblache.org> 
<jb@jblache.org>                                  GPG KeyID 0xF5D65169


--=-=-=
Content-Disposition: attachment; filename=snapscan-epson2480.diff
Content-Description: SnapScan backend, patch for Epson Perfection 2480

Index: snapscan-options.c
===================================================================
RCS file: /cvsroot/sane/sane-backends/backend/snapscan-options.c,v
retrieving revision 1.16
diff -u -r1.16 snapscan-options.c
--- snapscan-options.c	8 Apr 2004 21:53:10 -0000	1.16
+++ snapscan-options.c	30 Aug 2004 13:59:07 -0000
@@ -154,6 +154,16 @@
     SANE_FIX (0.0), SANE_FIX (228.0), 0
 };        /* mm */
 
+/* TPO range for the Epson 2480 */
+static const SANE_Range x_range_tpo_2480 =
+{
+    SANE_FIX (0.0), SANE_FIX (55.0), 0
+};        /* mm */
+static const SANE_Range y_range_tpo_2480 =
+{
+    SANE_FIX (0.0), SANE_FIX (125.0), 0
+};        /* mm */
+
 static SANE_Range x_range_tpo;
 static SANE_Range y_range_tpo;
 static const SANE_Range gamma_range =
@@ -209,6 +219,8 @@
         {10, 50, 75, 100, 150, 200, 300, 450, 600, 900, 1200};
     static SANE_Word resolutions_1600[] =
         {10, 50, 75, 100, 150, 200, 300, 400, 600, 800, 1600};
+    static SANE_Word resolutions_2400[] =
+        {10, 50, 75, 100, 150, 200, 300, 400, 600, 1200, 2400};
     static SANE_String_Const names_all[] =
         {md_colour, md_bilevelcolour, md_greyscale, md_lineart, NULL};
     static SANE_String_Const names_basic[] =
@@ -236,6 +248,10 @@
         x_range_tpo = x_range_tpo_1670;
         y_range_tpo = y_range_tpo_1670;
         break;
+    case PERFECTION2480:
+        x_range_tpo = x_range_tpo_2480;
+        y_range_tpo = y_range_tpo_2480;
+        break;
     default:
         x_range_tpo = x_range_tpo_default;
         y_range_tpo = y_range_tpo_default;
@@ -289,6 +305,9 @@
     case PERFECTION1670:
         po[OPT_SCANRES].constraint.word_list = resolutions_1600;
         break;
+    case PERFECTION2480:
+        po[OPT_SCANRES].constraint.word_list = resolutions_2400;
+        break;
     default:
         po[OPT_SCANRES].constraint.word_list = resolutions_600;
         break;
@@ -506,6 +525,7 @@
     if ((!(ps->hconfig & HCFG_CAL_ALLOWED))
         || (ps->pdev->model == SNAPSCANE52)
         || (ps->pdev->model == PERFECTION1670)
+        || (ps->pdev->model == PERFECTION2480)
         || (ps->pdev->model == PRISA5300)) {
         po[OPT_QUALITY_CAL].cap |= SANE_CAP_INACTIVE;
         ps->val[OPT_QUALITY_CAL].b = SANE_FALSE;
Index: snapscan-scsi.c
===================================================================
RCS file: /cvsroot/sane/sane-backends/backend/snapscan-scsi.c,v
retrieving revision 1.27
diff -u -r1.27 snapscan-scsi.c
--- snapscan-scsi.c	2 Apr 2004 20:19:24 -0000	1.27
+++ snapscan-scsi.c	30 Aug 2004 13:59:10 -0000
@@ -505,6 +505,9 @@
     case PERFECTION1670:
         pss->bpp = 14;
         break;
+    case PERFECTION2480:
+        pss->bpp = 14;
+        break;
     default:
         if (pss->hconfig & HCFG_ADC)
             pss->bpp = 10;
@@ -768,6 +771,9 @@
         case PERFECTION1670:
             pos_factor = (pss->res > 800) ?  1600 : 800;
             break;
+        case PERFECTION2480:
+            pos_factor = (pss->res > 1200) ?  2400 : 1200;
+            break;
         default:
             break;
     }
@@ -1169,6 +1175,7 @@
                 fseek(fd, 0, SEEK_SET);
                 break;
             case PERFECTION1670:
+	    case PERFECTION2480:
                 /* Epson firmware files contain an info block which
                    specifies the length of the firmware data. The
                    length information is stored at offset 0x64 from
Index: snapscan.c
===================================================================
RCS file: /cvsroot/sane/sane-backends/backend/snapscan.c,v
retrieving revision 1.43
diff -u -r1.43 snapscan.c
--- snapscan.c	16 Jun 2004 19:52:26 -0000	1.43
+++ snapscan.c	30 Aug 2004 13:59:17 -0000
@@ -179,6 +179,9 @@
     case PERFECTION1670:
         pos_factor = 800;
         break;
+    case PERFECTION2480:
+        pos_factor = 800;
+        break;
     default:
         break;
     }
@@ -1258,7 +1261,7 @@
     SANE_Status status = SANE_STATUS_GOOD;
     status = send (pss, dtc, dtcq);
     CHECK_STATUS (status, me, "send");
-    if (pss->pdev->model == PERFECTION1670)
+    if ((pss->pdev->model == PERFECTION1670) || (pss->pdev->model == PERFECTION2480))
     {
         /* Epson Perfection 1670 needs an extra invitation */
         status = send (pss, dtc, dtcq);
@@ -1564,7 +1567,7 @@
 
     status = download_gamma_tables(pss);
     CHECK_STATUS (status, me, "download_gamma_tables");
-    if (pss->pdev->model == PERFECTION1670)
+    if ((pss->pdev->model == PERFECTION1670) || (pss->pdev->model == PERFECTION2480))
     {
         /* Epson Perfections needs the gamma table twice */
         status = download_gamma_tables(pss);
Index: snapscan.conf
===================================================================
RCS file: /cvsroot/sane/sane-backends/backend/snapscan.conf,v
retrieving revision 1.15
diff -u -r1.15 snapscan.conf
--- snapscan.conf	29 Apr 2004 15:56:48 -0000	1.15
+++ snapscan.conf	30 Aug 2004 13:59:17 -0000
@@ -98,3 +98,6 @@
 
 # Epson Perfection 1670
 usb 0x04b8 0x011f
+
+# Epson Perfection 2480
+usb 0x04b8 0x0121
Index: snapscan.h
===================================================================
RCS file: /cvsroot/sane/sane-backends/backend/snapscan.h,v
retrieving revision 1.29
diff -u -r1.29 snapscan.h
--- snapscan.h	16 Jun 2004 19:52:27 -0000	1.29
+++ snapscan.h	30 Aug 2004 13:59:17 -0000
@@ -101,6 +101,7 @@
     PRISA5300,          /* Acer ScanPrisa 5300 - 1200 DPI */
     PERFECTION660,      /* Epson Perfection 660 - 1200 DPI */
     PERFECTION1670,     /* Epson Perfection 1670 - 1600 DPI */
+    PERFECTION2480,
     ARCUS1200		/* Agfa Arcus 1200 - 1200 DPI (rebadged Acer?) */
 } SnapScan_Model;
 
@@ -134,7 +135,8 @@
     {PRISA5300,      "Acer5300"},
     {ARCUS1200,      "Arcus1200"},
     {PERFECTION660,  "Perfection 660"},
-    {PERFECTION1670, "Perfection 1670"}
+    {PERFECTION1670, "Perfection 1670"},
+    {PERFECTION2480, "Perfection 2480"}
 };
 
 #define known_drivers ((int) (sizeof(drivers)/sizeof(drivers[0])))
@@ -183,8 +185,10 @@
     {"ACERSCAN_A4____1",    ACER300F},
     {"Perfection 660",      PERFECTION660},
     {"EPSON Scanner",       PERFECTION1670}, /* dummy entry to detect scanner */
+    {"EPSON Scanner1",      PERFECTION2480}, /* dummy entry to detect scanner */
     {"ARCUS 1200",          ARCUS1200}
 };
+
 #define known_scanners ((int) (sizeof(scanners)/sizeof(scanners[0])))
 
 static char *vendors[] =
@@ -209,7 +213,9 @@
 #define USB_PRODUCT_PRISA310 0x12a0
 #define USB_PRODUCT_PRISA320 0x2022
 /* Epson product IDs */
-#define USB_PRODUCT_PERFECTION660 0x0114
+#define USB_PRODUCT_PERFECTION660  0x0114
+#define USB_PRODUCT_PERFECTION1670 0x011f
+#define USB_PRODUCT_PERFECTION2480 0x0121
 
 static SANE_Word usb_vendor_ids[] =
 {
@@ -231,7 +237,9 @@
 {
     {USB_VENDOR_ACER, USB_PRODUCT_PRISA310, PRISA310},  /* Acer 310U */
     {USB_VENDOR_ACER, USB_PRODUCT_PRISA320, PRISA310},  /* Acer 320U */
-    {USB_VENDOR_EPSON, USB_PRODUCT_PERFECTION660, PERFECTION660} /* Epson Perfection 660 */
+    {USB_VENDOR_EPSON, USB_PRODUCT_PERFECTION660, PERFECTION660}, /* Epson Perfection 660 */
+    {USB_VENDOR_EPSON, USB_PRODUCT_PERFECTION1670, PERFECTION1670}, /* Epson Perfection 1670 */
+    {USB_VENDOR_EPSON, USB_PRODUCT_PERFECTION2480, PERFECTION2480} /* Epson Perfection 2480 */
 };
 #define known_usb_scanners ((int) (sizeof(usb_scanners)/sizeof(usb_scanners[0])))
 

--=-=-=--