1 diff -ru sane-pre1.01-4/ChangeLog sane-pre1.01-4-pere/ChangeLog
2 --- sane-pre1.01-4/ChangeLog Sun Apr 4 01:17:20 1999
3 +++ sane-pre1.01-4-pere/ChangeLog Sun Apr 4 22:54:36 1999
5 +1999-04-04 Petter Reinholdtsen <pere@td.org.uit.no>
6 + * backend/snapscan.c (sane_snapscan_*): Changed API entries from
7 + sane_snapscan_* to sane_*.
9 +1999-03-10 Petter Reinholdtsen <pere@td.org.uit.no>
10 + * backend/snapscan.c (add_device init_options inquiry
11 + sane_snapscan_get_parameters sane_snapscan_start
12 + sane_snapscan_set_io_mode sane_snapscan_read) backend/snapscan.h
13 + backend/snapscan.desc: Rewrote scanner detection code to loop over
14 + array of supported SCSI names. Added AGFA SnapScan 1236s support.
15 + It seems to be compatible with SnapScan 600.
16 + Make sure to not add the same device more then once to the device
17 + list. Bugfix in sane_snapscan_read() triggered on EOF.
19 1999-04-03 David Mosberger-Tang <David.Mosberger@acm.org>
21 * include/sane/sanei_debug.h: Define sanei_debug_BACKEND_NAME only
22 diff -ru sane-pre1.01-4/backend/snapscan.c sane-pre1.01-4-pere/backend/snapscan.c
23 --- sane-pre1.01-4/backend/snapscan.c Sun Feb 28 21:34:05 1999
24 +++ sane-pre1.01-4-pere/backend/snapscan.c Sun Apr 4 22:52:20 1999
27 /*----- internal scanner operations -----*/
29 +#define DEFAULT_DEVICE "/dev/scanner" /* Check this if config is missing */
31 /* hardware configuration byte masks */
33 #define HCFG_ADC 0x80 /* AD converter 1 ==> 10bit, 0 ==> 8bit */
35 #define DEFAULT_BRX (x_range.max)
36 #define DEFAULT_BRY (y_range.max)
40 static const SANE_Range percent_range =
47 case VUEGO310S: /* WG changed */
48 po[OPT_MODE].constraint.string_list = names_310;
55 case VUEGO310S: /* WG changed */
56 po[OPT_PREVIEW_MODE].constraint.string_list = names_310;
63 case VUEGO310S: /* WG changed */
64 rgb_buf_set_diff (pss,
65 pss->buf[INQUIRY_G2R_DIFF],
66 @@ -1530,6 +1534,15 @@
67 static SnapScan_Device *first_device = NULL; /* device list head */
68 static int n_devices = 0; /* the device count */
71 +device_already_in_list(SnapScan_Device *current, SANE_String_Const name)
73 + for ( ;NULL != current; current = current->pnext )
74 + if (0 == strcmp(name, current->dev.name))
80 add_device (SANE_String_Const name)
82 @@ -1537,10 +1550,16 @@
83 static const char me[] = "add_device";
86 - SnapScan_Model model_num;
87 + SnapScan_Model model_num = UNKNOWN;
88 char vendor[8], model[17];
89 + int i, vendor_ok = 0;
91 - DBG (DL_CALL_TRACE, "%s\n", me);
92 + DBG (DL_CALL_TRACE, "%s(%s)\n", me, name);
94 + /* Avoid adding the same device more then once */
95 + if (device_already_in_list(first_device, name)) {
96 + return SANE_STATUS_GOOD;
99 vendor[0] = model[0] = '\0';
101 @@ -1561,38 +1580,39 @@
105 - if ((strncasecmp (vendor, SNAPSCAN_VENDOR, strlen (SNAPSCAN_VENDOR)) == 0)
107 - (strncasecmp (vendor, VUEGO_VENDOR, strlen (VUEGO_VENDOR)) == 0)) /* WG changed */
109 - /* original SnapScan */
110 - if (strncasecmp (model, SNAPSCAN_MODEL310,
111 - strlen (SNAPSCAN_MODEL310)) == 0)
112 - model_num = SNAPSCAN310;
113 - else if (strncasecmp (model, SNAPSCAN_MODEL600,
114 - strlen (SNAPSCAN_MODEL600)) == 0)
115 - model_num = SNAPSCAN600;
116 - else if (strncasecmp (model, SNAPSCAN_MODEL300,
117 - strlen (SNAPSCAN_MODEL300)) == 0)
118 - model_num = SNAPSCAN300;
119 - else if (strncasecmp (model, VUEGO_MODEL310S, /* WG changed */
120 - strlen (VUEGO_MODEL310S)) == 0)
121 - model_num = VUEGO310S;
123 + /* check if this is one of our supported vendors */
124 + for (i = 0; i < known_vendors; i++)
125 + if (0 == strncasecmp (vendor, vendors[i], strlen(vendors[i])))
132 + DBG (DL_MINOR_ERROR, "%s: \"%s %s\" is not an %s\n",
134 + "AGFA SnapScan model 300, 310, 600 and 1236s"
135 + " or VUEGO model 310S"); /* WG changed */
136 + sanei_scsi_close (fd);
137 + return SANE_STATUS_INVAL;
140 + /* Known vendor. Check if it is one of our supported models */
141 + for (i = 0; i < known_scanners; i++)
143 + if (0 == strncasecmp (model, scanners[i].scsi_name,
144 + strlen(scanners[i].scsi_name)))
146 - DBG (DL_INFO, "%s: sorry, model %s is not supported.\n"
147 - "Currently supported models are the SnapScan 300 and 310.\n",
149 - sanei_scsi_close (fd);
150 - return SANE_STATUS_INVAL;
151 + model_num = scanners[i].id;
156 + if (UNKNOWN == model_num)
158 - DBG (DL_MINOR_ERROR, "%s: \"%s %s\" is not an %s %s\n",
161 - "AGFA SnapScan model 300, 310, and 600 or VUEGO model 310S"); /* WG changed */
162 + DBG (DL_INFO, "%s: sorry, model %s is not supported.\n"
163 + "Currently supported models are AGFA SnapScan model 300, 310, 600\n"
164 + "and 1236s and VUEGO model 310S\n",
166 sanei_scsi_close (fd);
167 return SANE_STATUS_INVAL;
169 @@ -1666,7 +1686,7 @@
173 -sane_snapscan_init (SANE_Int * version_code,
174 +sane_init (SANE_Int * version_code,
175 SANE_Auth_Callback authorize)
177 static const char me[] = "sane_snapscan_init";
178 @@ -1706,10 +1726,10 @@
182 - "%s: configuration file not found, defaulting to /dev/scanner.\n",
184 + "%s: configuration file not found, defaulting to %s.\n",
185 + me, DEFAULT_DEVICE);
186 /* default to /dev/scanner instead of insisting on config file */
187 - status = add_device ("/dev/scanner");
188 + status = add_device (DEFAULT_DEVICE);
189 if (status != SANE_STATUS_GOOD)
191 DBG (DL_MINOR_ERROR, "%s: failed to add device \"%s\"\n",
192 @@ -1752,7 +1772,7 @@
196 -sane_snapscan_exit (void)
199 DBG (DL_CALL_TRACE, "sane_snapscan_exit\n");
201 @@ -1761,7 +1781,7 @@
205 -sane_snapscan_get_devices (const SANE_Device *** device_list,
206 +sane_get_devices (const SANE_Device *** device_list,
207 SANE_Bool local_only)
209 static const char *me = "sane_snapscan_get_devices";
210 @@ -1793,7 +1813,7 @@
211 #define TMP_FILE "snapscan-tmp"
214 -sane_snapscan_open (SANE_String_Const name, SANE_Handle * h)
215 +sane_open (SANE_String_Const name, SANE_Handle * h)
217 static const char *me = "sane_snapscan_open";
218 SnapScan_Device *psd;
219 @@ -1905,7 +1925,7 @@
223 -sane_snapscan_close (SANE_Handle h)
224 +sane_close (SANE_Handle h)
226 SnapScan_Scanner *pss = (SnapScan_Scanner *) h;
227 DBG (DL_CALL_TRACE, "sane_snapscan_close (%p)\n", (void *) h);
228 @@ -1925,7 +1945,7 @@
231 const SANE_Option_Descriptor *
232 -sane_snapscan_get_option_descriptor (SANE_Handle h, SANE_Int n)
233 +sane_get_option_descriptor (SANE_Handle h, SANE_Int n)
235 DBG (DL_CALL_TRACE, "sane_snapscan_get_option_descriptor (%p, %ld)\n",
236 (void *) h, (long) n);
237 @@ -1938,7 +1958,7 @@
241 -sane_snapscan_control_option (SANE_Handle h, SANE_Int n,
242 +sane_control_option (SANE_Handle h, SANE_Int n,
243 SANE_Action a, void *v,
246 @@ -2621,7 +2641,7 @@
250 -sane_snapscan_get_parameters (SANE_Handle h,
251 +sane_get_parameters (SANE_Handle h,
254 static const char *me = "sane_snapscan_get_parameters";
255 @@ -2673,6 +2693,7 @@
259 + case SNAPSCAN1236S:
260 case VUEGO310S: /* WG changed */
263 @@ -2699,6 +2720,7 @@
267 + case SNAPSCAN1236S:
268 case VUEGO310S: /* WG changed */
269 pss->lines += line_offset;
270 p->lines -= line_offset;
271 @@ -2960,7 +2982,7 @@
275 -sane_snapscan_start (SANE_Handle h)
276 +sane_start (SANE_Handle h)
278 static const char *me = "sane_snapscan_start";
280 @@ -3114,6 +3136,7 @@
284 + case SNAPSCAN1236S:
285 case VUEGO310S: /* WG changed */
286 if (SANE_STATUS_GOOD != rgb_buf_init (pss))
287 return SANE_STATUS_NO_MEM;
288 @@ -3134,6 +3157,7 @@
292 + case SNAPSCAN1236S:
293 case VUEGO310S: /* WG changed */
296 @@ -3153,6 +3177,7 @@
300 + case SNAPSCAN1236S:
301 case VUEGO310S: /* WG changed */
302 transfer_data_diff (other_buf, pss);
304 @@ -3186,6 +3211,7 @@
308 + case SNAPSCAN1236S:
309 case VUEGO310S: /* WG changed */
312 @@ -3231,13 +3257,14 @@
313 pss->bytes_per_line / pss->ms_per_line);
315 /* allocate and initialize rgb ring buffer if the device is
316 - a snapscan 310 or 600 model, in colour mode */
317 + a snapscan 310, 600 or 1236s model, in colour mode */
320 switch (pss->pdev->model)
324 + case SNAPSCAN1236S:
325 case VUEGO310S: /* WG changed */
328 @@ -3268,7 +3295,7 @@
332 -sane_snapscan_read (SANE_Handle h, SANE_Byte * buf,
333 +sane_read (SANE_Handle h, SANE_Byte * buf,
334 SANE_Int maxlen, SANE_Int * plen)
336 static const char *me = "sane_snapscan_read";
337 @@ -3279,6 +3306,8 @@
338 DBG (DL_CALL_TRACE, "%s (%p, %p, %ld, %p)\n",
339 me, (void *) h, (void *) buf, (long) maxlen, (void *) plen);
343 if (!pss->expected_data_len)
346 @@ -3292,8 +3321,6 @@
347 return SANE_STATUS_EOF;
353 mode = pss->preview_mode;
355 @@ -3413,6 +3440,7 @@
359 + case SNAPSCAN1236S:
360 case VUEGO310S: /* WG changed */
361 transferred_bytes = transfer_data_diff (buf, pss);
363 @@ -3466,7 +3494,7 @@
367 -sane_snapscan_cancel (SANE_Handle h)
368 +sane_cancel (SANE_Handle h)
370 char *me = "sane_snapscan_cancel";
371 SnapScan_Scanner *pss = (SnapScan_Scanner *) h;
372 @@ -3486,6 +3514,7 @@
376 + case SNAPSCAN1236S:
377 case VUEGO310S: /* WG changed */
380 @@ -3506,7 +3535,7 @@
384 -sane_snapscan_set_io_mode (SANE_Handle h, SANE_Bool m)
385 +sane_set_io_mode (SANE_Handle h, SANE_Bool m)
387 static char me[] = "sane_snapscan_set_io_mode";
388 SnapScan_Scanner *pss = (SnapScan_Scanner *) h;
389 @@ -3541,7 +3570,7 @@
393 -sane_snapscan_get_select_fd (SANE_Handle h, SANE_Int * fd)
394 +sane_get_select_fd (SANE_Handle h, SANE_Int * fd)
396 static char me[] = "sane_snapscan_get_select_fd";
397 SnapScan_Scanner *pss = (SnapScan_Scanner *) h;
398 diff -ru sane-pre1.01-4/backend/snapscan.desc sane-pre1.01-4-pere/backend/snapscan.desc
399 --- sane-pre1.01-4/backend/snapscan.desc Mon Sep 7 09:28:57 1998
400 +++ sane-pre1.01-4-pere/backend/snapscan.desc Sun Apr 4 18:44:11 1999
403 :model "SnapScan 600"
405 +:model "SnapScan 1236s"
409 :comment "Close SnapScan 310 compatible."
410 diff -ru sane-pre1.01-4/backend/snapscan.h sane-pre1.01-4-pere/backend/snapscan.h
411 --- sane-pre1.01-4/backend/snapscan.h Sun Feb 28 00:59:10 1999
412 +++ sane-pre1.01-4-pere/backend/snapscan.h Sun Apr 4 18:45:44 1999
414 /* snapscan device field values */
416 #define SNAPSCAN_NAME "/dev/sga"
417 -#define SNAPSCAN_VENDOR "AGFA"
418 -#define VUEGO_VENDOR "COLOR"
419 -#define SNAPSCAN_MODEL300 "SnapScan"
420 -#define SNAPSCAN_MODEL310 "SNAPSCAN 310"
421 -#define VUEGO_MODEL310S "FlatbedScanner_4"
422 -#define SNAPSCAN_MODEL600 "SNAPSCAN 600"
423 #define SNAPSCAN_TYPE "flatbed scanner"
424 /*#define INOPERATIVE*/
429 SNAPSCAN300, /* the original SnapScan or SnapScan 300 */
430 SNAPSCAN310, /* the SnapScan 310 */
431 SNAPSCAN600, /* the SnapScan 600 */
432 + SNAPSCAN1236S, /* the SnapScan 1236s */
433 VUEGO310S /* Vuego-Version of SnapScan 310 WG changed */
436 +struct SnapScan_Model_desc
442 +static struct SnapScan_Model_desc scanners[] =
444 + { "FlatbedScanner_4", VUEGO310S },
445 + { "SNAPSCAN 1236s", SNAPSCAN1236S },
446 + { "SNAPSCAN 310", SNAPSCAN310 },
447 + { "SNAPSCAN 600", SNAPSCAN600 },
448 + { "SnapScan", SNAPSCAN300 },
450 +#define known_scanners (sizeof(scanners)/sizeof(struct SnapScan_Model_desc))
452 +static char *vendors[] =
457 +#define known_vendors (sizeof(vendors)/sizeof(char*))