Hm, seems like it was an easier task then expected. :-)
Here are the patch. It is also available from
<URL:http://www.student.uit.no/~pere/linux/>.
Please test, and let me know if it breaks anything.
scanimage -T does not work. Almost all tests fails. Did it use to?
I have not tested this backend before, so I don't know. :-(
diff -ru /store/store/joseph/sane/src-pre1.01r3/ChangeLog src-pre1.01r3-allarchs/ChangeLog
--- /store/store/joseph/sane/src-pre1.01r3/ChangeLog Fri Mar 5 07:20:00 1999
+++ src-pre1.01r3-allarchs/ChangeLog Wed Mar 10 22:12:55 1999
@@ -1,3 +1,12 @@
+1999-03-10 Petter Reinholdtsen <pere@td.org.uit.no>
+
+ * backend/snapscan.c (add_device init_options inquiry
+ sane_snapscan_get_parameters sane_snapscan_start
+ sane_snapscan_set_io_mode) backend/snapscan.h
+ backend/snapscan.desc: Rewrote scanner detection code to loop over
+ array of supported SCSI names. Added AGFA SnapScan 1236 support.
+ It seems to be compatible with SnapScan 600.
+
1999-03-04 David Mosberger-Tang <David.Mosberger@acm.org>
* backend/canon.c (adjust_hilo_points): Print values of type
diff -ru /store/store/joseph/sane/src-pre1.01r3/backend/snapscan.desc src-pre1.01r3-allarchs/backend/snapscan.desc
--- /store/store/joseph/sane/src-pre1.01r3/backend/snapscan.desc Mon Sep 7 09:28:57 1998
+++ src-pre1.01r3-allarchs/backend/snapscan.desc Wed Mar 10 21:14:10 1999
@@ -28,6 +28,8 @@
:comment "Ditto"
:model "SnapScan 600"
:comment "Ditto"
+:model "SnapScan 1236"
+:comment "Ditto"
:mfg "Vuego"
:model "310S"
:comment "Close SnapScan 310 compatible."
diff -ru /store/store/joseph/sane/src-pre1.01r3/backend/snapscan.h src-pre1.01r3-allarchs/backend/snapscan.h
--- /store/store/joseph/sane/src-pre1.01r3/backend/snapscan.h Sun Feb 28 00:59:10 1999
+++ src-pre1.01r3-allarchs/backend/snapscan.h Wed Mar 10 22:19:16 1999
@@ -54,22 +54,41 @@
/* snapscan device field values */
#define SNAPSCAN_NAME "/dev/sga"
-#define SNAPSCAN_VENDOR "AGFA"
-#define VUEGO_VENDOR "COLOR"
-#define SNAPSCAN_MODEL300 "SnapScan"
-#define SNAPSCAN_MODEL310 "SNAPSCAN 310"
-#define VUEGO_MODEL310S "FlatbedScanner_4"
-#define SNAPSCAN_MODEL600 "SNAPSCAN 600"
#define SNAPSCAN_TYPE "flatbed scanner"
/*#define INOPERATIVE*/
typedef enum
{
+ UNKNOWN,
SNAPSCAN300, /* the original SnapScan or SnapScan 300 */
SNAPSCAN310, /* the SnapScan 310 */
SNAPSCAN600, /* the SnapScan 600 */
+ SNAPSCAN1236, /* the SnapScan 1236 */
VUEGO310S /* Vuego-Version of SnapScan 310 WG changed */
} SnapScan_Model;
+
+struct SnapScan_Model_desc
+{
+ char *scsi_name;
+ SnapScan_Model id;
+};
+
+static struct SnapScan_Model_desc scanners[] =
+{
+ { "FlatbedScanner_4", VUEGO310S },
+ { "SNAPSCAN 1236", SNAPSCAN1236 },
+ { "SNAPSCAN 310", SNAPSCAN310 },
+ { "SNAPSCAN 600", SNAPSCAN600 },
+ { "SnapScan", SNAPSCAN300 },
+};
+#define known_scanners (sizeof(scanners)/sizeof(struct SnapScan_Model_desc))
+
+static char *vendors[] =
+{
+ "AGFA",
+ "COLOR",
+};
+#define known_vendors (sizeof(vendors)/sizeof(char*))
typedef enum
{
diff -ru /store/store/joseph/sane/src-pre1.01r3/backend/snapscan.c src-pre1.01r3-allarchs/backend/snapscan.c
--- /store/store/joseph/sane/src-pre1.01r3/backend/snapscan.c Sun Feb 28 21:34:05 1999
+++ src-pre1.01r3-allarchs/backend/snapscan.c Wed Mar 10 22:17:56 1999
@@ -276,7 +276,9 @@
break;
case SNAPSCAN600:
- DBG (DL_MINOR_INFO, "600 dpi mode untested on SnapScan 600\nPlease report bugs\n");
+ case SNAPSCAN1236:
+ DBG (DL_MINOR_INFO, "600 dpi mode untested on SnapScan 600 and 1236\n"
+ "Please report bugs\n");
default:
po[OPT_SCANRES].constraint.word_list = resolutions_300;
break;
@@ -339,6 +341,7 @@
{
case SNAPSCAN310:
case SNAPSCAN600:
+ case SNAPSCAN1236:
case VUEGO310S: /* WG changed */
po[OPT_MODE].constraint.string_list = names_310;
break;
@@ -370,6 +373,7 @@
{
case SNAPSCAN310:
case SNAPSCAN600:
+ case SNAPSCAN1236:
case VUEGO310S: /* WG changed */
po[OPT_PREVIEW_MODE].constraint.string_list = names_310;
break;
@@ -995,6 +999,7 @@
{
case SNAPSCAN310:
case SNAPSCAN600:
+ case SNAPSCAN1236:
case VUEGO310S: /* WG changed */
rgb_buf_set_diff (pss,
pss->buf[INQUIRY_G2R_DIFF],
@@ -1537,8 +1542,9 @@
static const char me[] = "add_device";
SANE_Status status;
SnapScan_Device *pd;
- SnapScan_Model model_num;
+ SnapScan_Model model_num = UNKNOWN;
char vendor[8], model[17];
+ int i, vendor_ok = 0;
DBG (DL_CALL_TRACE, "%s\n", me);
@@ -1561,38 +1567,38 @@
return status;
}
- if ((strncasecmp (vendor, SNAPSCAN_VENDOR, strlen (SNAPSCAN_VENDOR)) == 0)
- ||
- (strncasecmp (vendor, VUEGO_VENDOR, strlen (VUEGO_VENDOR)) == 0)) /* WG changed */
- {
- /* original SnapScan */
- if (strncasecmp (model, SNAPSCAN_MODEL310,
- strlen (SNAPSCAN_MODEL310)) == 0)
- model_num = SNAPSCAN310;
- else if (strncasecmp (model, SNAPSCAN_MODEL600,
- strlen (SNAPSCAN_MODEL600)) == 0)
- model_num = SNAPSCAN600;
- else if (strncasecmp (model, SNAPSCAN_MODEL300,
- strlen (SNAPSCAN_MODEL300)) == 0)
- model_num = SNAPSCAN300;
- else if (strncasecmp (model, VUEGO_MODEL310S, /* WG changed */
- strlen (VUEGO_MODEL310S)) == 0)
- model_num = VUEGO310S;
- else
+ /* check if this is one of our supported vendors */
+ for (i = 0; i < known_vendors; i++)
+ if (0 == strncasecmp (vendor, vendors[i], strlen(vendors[i])))
+ {
+ vendor_ok = 1;
+ break;
+ }
+ if (!vendor_ok)
+ {
+ DBG (DL_MINOR_ERROR, "%s: \"%s %s\" is not an %s\n",
+ me, vendor, model,
+ "AGFA SnapScan model 300, 310, 600 and 1236"
+ " or VUEGO model 310S"); /* WG changed */
+ sanei_scsi_close (fd);
+ return SANE_STATUS_INVAL;
+ }
+
+ /* Known vendor. Check if it is one of our supported models */
+ for (i = 0; i < known_scanners; i++)
+ {
+ if (0 == strncasecmp (model, scanners[i].scsi_name,
+ strlen(scanners[i].scsi_name)))
{
- DBG (DL_INFO, "%s: sorry, model %s is not supported.\n"
- "Currently supported models are the SnapScan 300 and 310.\n",
- me, model);
- sanei_scsi_close (fd);
- return SANE_STATUS_INVAL;
+ model_num = scanners[i].id;
+ break;
}
}
- else
+ if (UNKNOWN == model_num)
{
- DBG (DL_MINOR_ERROR, "%s: \"%s %s\" is not an %s %s\n",
- me, vendor, model,
- SNAPSCAN_VENDOR,
- "AGFA SnapScan model 300, 310, and 600 or VUEGO model 310S"); /* WG changed */
+ DBG (DL_INFO, "%s: sorry, model %s is not supported.\n"
+ "Currently supported models are the SnapScan 300 and 310.\n",
+ me, model);
sanei_scsi_close (fd);
return SANE_STATUS_INVAL;
}
@@ -2673,6 +2679,7 @@
{
case SNAPSCAN310:
case SNAPSCAN600:
+ case SNAPSCAN1236:
case VUEGO310S: /* WG changed */
if (!pss->preview)
{
@@ -2699,6 +2706,7 @@
{
case SNAPSCAN310:
case SNAPSCAN600:
+ case SNAPSCAN1236:
case VUEGO310S: /* WG changed */
pss->lines += line_offset;
p->lines -= line_offset;
@@ -3114,6 +3122,7 @@
{
case SNAPSCAN310:
case SNAPSCAN600:
+ case SNAPSCAN1236:
case VUEGO310S: /* WG changed */
if (SANE_STATUS_GOOD != rgb_buf_init (pss))
return SANE_STATUS_NO_MEM;
@@ -3134,6 +3143,7 @@
{
case SNAPSCAN310:
case SNAPSCAN600:
+ case SNAPSCAN1236:
case VUEGO310S: /* WG changed */
rgb_buf_clean (pss);
break;
@@ -3153,6 +3163,7 @@
{
case SNAPSCAN310:
case SNAPSCAN600:
+ case SNAPSCAN1236:
case VUEGO310S: /* WG changed */
transfer_data_diff (other_buf, pss);
break;
@@ -3186,6 +3197,7 @@
{
case SNAPSCAN310:
case SNAPSCAN600:
+ case SNAPSCAN1236:
case VUEGO310S: /* WG changed */
rgb_buf_clean (pss);
break;
@@ -3231,13 +3243,14 @@
pss->bytes_per_line / pss->ms_per_line);
/* allocate and initialize rgb ring buffer if the device is
- a snapscan 310 or 600 model, in colour mode */
+ a snapscan 310, 600 or 1236 model, in colour mode */
if (colour)
{
switch (pss->pdev->model)
{
case SNAPSCAN310:
case SNAPSCAN600:
+ case SNAPSCAN1236:
case VUEGO310S: /* WG changed */
rgb_buf_init (pss);
break;
@@ -3413,6 +3426,7 @@
{
case SNAPSCAN310:
case SNAPSCAN600:
+ case SNAPSCAN1236:
case VUEGO310S: /* WG changed */
transferred_bytes = transfer_data_diff (buf, pss);
break;
@@ -3486,6 +3500,7 @@
{
case SNAPSCAN310:
case SNAPSCAN600:
+ case SNAPSCAN1236:
case VUEGO310S: /* WG changed */
rgb_buf_clean (pss);
break;
-- ##> Petter Reinholdtsen <## | pere@td.org.uit.no O- <SCRIPT Language="Javascript">window.close()</SCRIPT> http://www.hungry.com/~pere/ | Go Mozilla, go! Go!
-- Source code, list archive, and docs: http://www.mostang.com/sane/ To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com