diff -ru sane-pre1.01-4/ChangeLog sane-pre1.01-4-pere/ChangeLog
--- sane-pre1.01-4/ChangeLog	Sun Apr  4 01:17:20 1999
+++ sane-pre1.01-4-pere/ChangeLog	Sun Apr  4 22:54:36 1999
@@ -1,3 +1,17 @@
+1999-04-04  Petter Reinholdtsen <pere@td.org.uit.no>
+	* backend/snapscan.c (sane_snapscan_*): Changed API entries from
+	sane_snapscan_* to sane_*.
+
+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 sane_snapscan_read) backend/snapscan.h
+ 	backend/snapscan.desc: Rewrote scanner detection code to loop over
+ 	array of supported SCSI names.  Added AGFA SnapScan 1236s support.
+  	It seems to be compatible with SnapScan 600.
+	Make sure to not add the same device more then once to the device
+ 	list.  Bugfix in sane_snapscan_read() triggered on EOF.
+
 1999-04-03  David Mosberger-Tang  <David.Mosberger@acm.org>
 
 	* include/sane/sanei_debug.h: Define sanei_debug_BACKEND_NAME only
diff -ru sane-pre1.01-4/backend/snapscan.c sane-pre1.01-4-pere/backend/snapscan.c
--- sane-pre1.01-4/backend/snapscan.c	Sun Feb 28 21:34:05 1999
+++ sane-pre1.01-4-pere/backend/snapscan.c	Sun Apr  4 22:52:20 1999
@@ -111,6 +111,8 @@
 
 /*----- internal scanner operations -----*/
 
+#define DEFAULT_DEVICE "/dev/scanner" /* Check this if config is missing */
+
 /* hardware configuration byte masks */
 
 #define HCFG_ADC  0x80		/* AD converter 1 ==> 10bit, 0 ==> 8bit */
@@ -161,7 +163,6 @@
 #define DEFAULT_BRX  (x_range.max)
 #define DEFAULT_BRY  (y_range.max)
 
-
 #ifdef INOPERATIVE
 static const SANE_Range percent_range =
 {
@@ -339,6 +340,7 @@
       {
       case SNAPSCAN310:
       case SNAPSCAN600:
+      case SNAPSCAN1236S:
       case VUEGO310S:		/* WG changed */
 	po[OPT_MODE].constraint.string_list = names_310;
 	break;
@@ -370,6 +372,7 @@
       {
       case SNAPSCAN310:
       case SNAPSCAN600:
+      case SNAPSCAN1236S:
       case VUEGO310S:		/* WG changed */
 	po[OPT_PREVIEW_MODE].constraint.string_list = names_310;
 	break;
@@ -995,6 +998,7 @@
     {
     case SNAPSCAN310:
     case SNAPSCAN600:
+    case SNAPSCAN1236S:
     case VUEGO310S:		/* WG changed */
       rgb_buf_set_diff (pss,
 			pss->buf[INQUIRY_G2R_DIFF],
@@ -1530,6 +1534,15 @@
 static SnapScan_Device *first_device = NULL;	/* device list head */
 static int n_devices = 0;	/* the device count */
 
+static SANE_Bool
+device_already_in_list(SnapScan_Device *current, SANE_String_Const name)
+{
+  for ( ;NULL != current; current = current->pnext )
+    if (0 == strcmp(name, current->dev.name))
+      return SANE_TRUE;
+  return SANE_FALSE;
+}
+
 static SANE_Status
 add_device (SANE_String_Const name)
 {
@@ -1537,10 +1550,16 @@
   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);
+  DBG (DL_CALL_TRACE, "%s(%s)\n", me, name);
+
+  /* Avoid adding the same device more then once */
+  if (device_already_in_list(first_device, name)) {
+    return SANE_STATUS_GOOD;
+  }
 
   vendor[0] = model[0] = '\0';
 
@@ -1561,38 +1580,39 @@
       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 1236s"
+	   " 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 AGFA SnapScan model 300, 310, 600\n"
+	   "and 1236s and VUEGO model 310S\n",
+	   me, model);
       sanei_scsi_close (fd);
       return SANE_STATUS_INVAL;
     }
@@ -1666,7 +1686,7 @@
 
 
 SANE_Status
-sane_snapscan_init (SANE_Int * version_code,
+sane_init (SANE_Int * version_code,
 		    SANE_Auth_Callback authorize)
 {
   static const char me[] = "sane_snapscan_init";
@@ -1706,10 +1726,10 @@
   if (!fp)
     {
       DBG (DL_INFO,
-	   "%s: configuration file not found, defaulting to /dev/scanner.\n",
-	   me);
+	   "%s: configuration file not found, defaulting to %s.\n",
+	   me, DEFAULT_DEVICE);
       /* default to /dev/scanner instead of insisting on config file */
-      status = add_device ("/dev/scanner");
+      status = add_device (DEFAULT_DEVICE);
       if (status != SANE_STATUS_GOOD)
 	{
 	  DBG (DL_MINOR_ERROR, "%s: failed to add device \"%s\"\n",
@@ -1752,7 +1772,7 @@
 }
 
 void
-sane_snapscan_exit (void)
+sane_exit (void)
 {
   DBG (DL_CALL_TRACE, "sane_snapscan_exit\n");
 
@@ -1761,7 +1781,7 @@
 }
 
 SANE_Status
-sane_snapscan_get_devices (const SANE_Device *** device_list,
+sane_get_devices (const SANE_Device *** device_list,
 			   SANE_Bool local_only)
 {
   static const char *me = "sane_snapscan_get_devices";
@@ -1793,7 +1813,7 @@
 #define TMP_FILE "snapscan-tmp"
 
 SANE_Status
-sane_snapscan_open (SANE_String_Const name, SANE_Handle * h)
+sane_open (SANE_String_Const name, SANE_Handle * h)
 {
   static const char *me = "sane_snapscan_open";
   SnapScan_Device *psd;
@@ -1905,7 +1925,7 @@
 }
 
 void
-sane_snapscan_close (SANE_Handle h)
+sane_close (SANE_Handle h)
 {
   SnapScan_Scanner *pss = (SnapScan_Scanner *) h;
   DBG (DL_CALL_TRACE, "sane_snapscan_close (%p)\n", (void *) h);
@@ -1925,7 +1945,7 @@
 }
 
 const SANE_Option_Descriptor *
-sane_snapscan_get_option_descriptor (SANE_Handle h, SANE_Int n)
+sane_get_option_descriptor (SANE_Handle h, SANE_Int n)
 {
   DBG (DL_CALL_TRACE, "sane_snapscan_get_option_descriptor (%p, %ld)\n",
        (void *) h, (long) n);
@@ -1938,7 +1958,7 @@
 }
 
 SANE_Status
-sane_snapscan_control_option (SANE_Handle h, SANE_Int n,
+sane_control_option (SANE_Handle h, SANE_Int n,
 			      SANE_Action a, void *v,
 			      SANE_Int * i)
 {
@@ -2621,7 +2641,7 @@
 }
 
 SANE_Status
-sane_snapscan_get_parameters (SANE_Handle h,
+sane_get_parameters (SANE_Handle h,
 			      SANE_Parameters * p)
 {
   static const char *me = "sane_snapscan_get_parameters";
@@ -2673,6 +2693,7 @@
 	  {
 	  case SNAPSCAN310:
 	  case SNAPSCAN600:
+	  case SNAPSCAN1236S:
 	  case VUEGO310S:	/* WG changed */
 	    if (!pss->preview)
 	      {
@@ -2699,6 +2720,7 @@
 	  {
 	  case SNAPSCAN310:
 	  case SNAPSCAN600:
+	  case SNAPSCAN1236S:
 	  case VUEGO310S:	/* WG changed */
 	    pss->lines += line_offset;
 	    p->lines -= line_offset;
@@ -2960,7 +2982,7 @@
 }
 
 SANE_Status
-sane_snapscan_start (SANE_Handle h)
+sane_start (SANE_Handle h)
 {
   static const char *me = "sane_snapscan_start";
   SANE_Status status;
@@ -3114,6 +3136,7 @@
 	      {
 	      case SNAPSCAN310:
 	      case SNAPSCAN600:
+	      case SNAPSCAN1236S:
 	      case VUEGO310S:	/* WG changed */
 		if (SANE_STATUS_GOOD != rgb_buf_init (pss))
 		  return SANE_STATUS_NO_MEM;
@@ -3134,6 +3157,7 @@
 		  {
 		  case SNAPSCAN310:
 		  case SNAPSCAN600:
+	          case SNAPSCAN1236S:
 		  case VUEGO310S:	/* WG changed */
 		    rgb_buf_clean (pss);
 		    break;
@@ -3153,6 +3177,7 @@
 	      {
 	      case SNAPSCAN310:
 	      case SNAPSCAN600:
+	      case SNAPSCAN1236S:
 	      case VUEGO310S:	/* WG changed */
 		transfer_data_diff (other_buf, pss);
 		break;
@@ -3186,6 +3211,7 @@
 	      {
 	      case SNAPSCAN310:
 	      case SNAPSCAN600:
+	      case SNAPSCAN1236S:
 	      case VUEGO310S:	/* WG changed */
 		rgb_buf_clean (pss);
 		break;
@@ -3231,13 +3257,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 1236s model, in colour mode               */
   if (colour)
     {
       switch (pss->pdev->model)
 	{
 	case SNAPSCAN310:
 	case SNAPSCAN600:
+	case SNAPSCAN1236S:
 	case VUEGO310S:	/* WG changed */
 	  rgb_buf_init (pss);
 	  break;
@@ -3268,7 +3295,7 @@
 
 
 SANE_Status
-sane_snapscan_read (SANE_Handle h, SANE_Byte * buf,
+sane_read (SANE_Handle h, SANE_Byte * buf,
 		    SANE_Int maxlen, SANE_Int * plen)
 {
   static const char *me = "sane_snapscan_read";
@@ -3279,6 +3306,8 @@
   DBG (DL_CALL_TRACE, "%s (%p, %p, %ld, %p)\n",
        me, (void *) h, (void *) buf, (long) maxlen, (void *) plen);
 
+  *plen = 0;
+
   if (!pss->expected_data_len)
     {
       if (pss->child > 0)
@@ -3292,8 +3321,6 @@
       return SANE_STATUS_EOF;
     }
 
-  *plen = 0;
-
   if (pss->preview)
     mode = pss->preview_mode;
 
@@ -3413,6 +3440,7 @@
 	      {
 	      case SNAPSCAN310:
 	      case SNAPSCAN600:
+	      case SNAPSCAN1236S:
 	      case VUEGO310S:	/* WG changed */
 		transferred_bytes = transfer_data_diff (buf, pss);
 		break;
@@ -3466,7 +3494,7 @@
 }
 
 void
-sane_snapscan_cancel (SANE_Handle h)
+sane_cancel (SANE_Handle h)
 {
   char *me = "sane_snapscan_cancel";
   SnapScan_Scanner *pss = (SnapScan_Scanner *) h;
@@ -3486,6 +3514,7 @@
 	    {
 	    case SNAPSCAN310:
 	    case SNAPSCAN600:
+	    case SNAPSCAN1236S:
 	    case VUEGO310S:	/* WG changed */
 	      rgb_buf_clean (pss);
 	      break;
@@ -3506,7 +3535,7 @@
 }
 
 SANE_Status
-sane_snapscan_set_io_mode (SANE_Handle h, SANE_Bool m)
+sane_set_io_mode (SANE_Handle h, SANE_Bool m)
 {
   static char me[] = "sane_snapscan_set_io_mode";
   SnapScan_Scanner *pss = (SnapScan_Scanner *) h;
@@ -3541,7 +3570,7 @@
 }
 
 SANE_Status
-sane_snapscan_get_select_fd (SANE_Handle h, SANE_Int * fd)
+sane_get_select_fd (SANE_Handle h, SANE_Int * fd)
 {
   static char me[] = "sane_snapscan_get_select_fd";
   SnapScan_Scanner *pss = (SnapScan_Scanner *) h;
diff -ru sane-pre1.01-4/backend/snapscan.desc sane-pre1.01-4-pere/backend/snapscan.desc
--- sane-pre1.01-4/backend/snapscan.desc	Mon Sep  7 09:28:57 1998
+++ sane-pre1.01-4-pere/backend/snapscan.desc	Sun Apr  4 18:44:11 1999
@@ -28,6 +28,8 @@
 :comment "Ditto"
 :model "SnapScan 600"
 :comment "Ditto"
+:model "SnapScan 1236s"
+:comment "Ditto"
 :mfg "Vuego"
 :model "310S"
 :comment "Close SnapScan 310 compatible."
diff -ru sane-pre1.01-4/backend/snapscan.h sane-pre1.01-4-pere/backend/snapscan.h
--- sane-pre1.01-4/backend/snapscan.h	Sun Feb 28 00:59:10 1999
+++ sane-pre1.01-4-pere/backend/snapscan.h	Sun Apr  4 18:45:44 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 */
+  SNAPSCAN1236S,		/* the SnapScan 1236s */
   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 1236s",	SNAPSCAN1236S },
+  { "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
   {
