]> pere.pagekite.me Git - homepage.git/blob - linux/sane/agfa-snapscan-1236-4.diff
Generated.
[homepage.git] / linux / sane / agfa-snapscan-1236-4.diff
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
4 @@ -1,3 +1,17 @@
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_*.
8 +
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.
18 +
19 1999-04-03 David Mosberger-Tang <David.Mosberger@acm.org>
20
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
25 @@ -111,6 +111,8 @@
26
27 /*----- internal scanner operations -----*/
28
29 +#define DEFAULT_DEVICE "/dev/scanner" /* Check this if config is missing */
30 +
31 /* hardware configuration byte masks */
32
33 #define HCFG_ADC 0x80 /* AD converter 1 ==> 10bit, 0 ==> 8bit */
34 @@ -161,7 +163,6 @@
35 #define DEFAULT_BRX (x_range.max)
36 #define DEFAULT_BRY (y_range.max)
37
38 -
39 #ifdef INOPERATIVE
40 static const SANE_Range percent_range =
41 {
42 @@ -339,6 +340,7 @@
43 {
44 case SNAPSCAN310:
45 case SNAPSCAN600:
46 + case SNAPSCAN1236S:
47 case VUEGO310S: /* WG changed */
48 po[OPT_MODE].constraint.string_list = names_310;
49 break;
50 @@ -370,6 +372,7 @@
51 {
52 case SNAPSCAN310:
53 case SNAPSCAN600:
54 + case SNAPSCAN1236S:
55 case VUEGO310S: /* WG changed */
56 po[OPT_PREVIEW_MODE].constraint.string_list = names_310;
57 break;
58 @@ -995,6 +998,7 @@
59 {
60 case SNAPSCAN310:
61 case SNAPSCAN600:
62 + case SNAPSCAN1236S:
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 */
69
70 +static SANE_Bool
71 +device_already_in_list(SnapScan_Device *current, SANE_String_Const name)
72 +{
73 + for ( ;NULL != current; current = current->pnext )
74 + if (0 == strcmp(name, current->dev.name))
75 + return SANE_TRUE;
76 + return SANE_FALSE;
77 +}
78 +
79 static SANE_Status
80 add_device (SANE_String_Const name)
81 {
82 @@ -1537,10 +1550,16 @@
83 static const char me[] = "add_device";
84 SANE_Status status;
85 SnapScan_Device *pd;
86 - SnapScan_Model model_num;
87 + SnapScan_Model model_num = UNKNOWN;
88 char vendor[8], model[17];
89 + int i, vendor_ok = 0;
90
91 - DBG (DL_CALL_TRACE, "%s\n", me);
92 + DBG (DL_CALL_TRACE, "%s(%s)\n", me, name);
93 +
94 + /* Avoid adding the same device more then once */
95 + if (device_already_in_list(first_device, name)) {
96 + return SANE_STATUS_GOOD;
97 + }
98
99 vendor[0] = model[0] = '\0';
100
101 @@ -1561,38 +1580,39 @@
102 return status;
103 }
104
105 - if ((strncasecmp (vendor, SNAPSCAN_VENDOR, strlen (SNAPSCAN_VENDOR)) == 0)
106 - ||
107 - (strncasecmp (vendor, VUEGO_VENDOR, strlen (VUEGO_VENDOR)) == 0)) /* WG changed */
108 - {
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;
122 - else
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])))
126 + {
127 + vendor_ok = 1;
128 + break;
129 + }
130 + if (!vendor_ok)
131 + {
132 + DBG (DL_MINOR_ERROR, "%s: \"%s %s\" is not an %s\n",
133 + me, vendor, model,
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;
138 + }
139 +
140 + /* Known vendor. Check if it is one of our supported models */
141 + for (i = 0; i < known_scanners; i++)
142 + {
143 + if (0 == strncasecmp (model, scanners[i].scsi_name,
144 + strlen(scanners[i].scsi_name)))
145 {
146 - DBG (DL_INFO, "%s: sorry, model %s is not supported.\n"
147 - "Currently supported models are the SnapScan 300 and 310.\n",
148 - me, model);
149 - sanei_scsi_close (fd);
150 - return SANE_STATUS_INVAL;
151 + model_num = scanners[i].id;
152 + break;
153 }
154 }
155 - else
156 + if (UNKNOWN == model_num)
157 {
158 - DBG (DL_MINOR_ERROR, "%s: \"%s %s\" is not an %s %s\n",
159 - me, vendor, model,
160 - SNAPSCAN_VENDOR,
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",
165 + me, model);
166 sanei_scsi_close (fd);
167 return SANE_STATUS_INVAL;
168 }
169 @@ -1666,7 +1686,7 @@
170
171
172 SANE_Status
173 -sane_snapscan_init (SANE_Int * version_code,
174 +sane_init (SANE_Int * version_code,
175 SANE_Auth_Callback authorize)
176 {
177 static const char me[] = "sane_snapscan_init";
178 @@ -1706,10 +1726,10 @@
179 if (!fp)
180 {
181 DBG (DL_INFO,
182 - "%s: configuration file not found, defaulting to /dev/scanner.\n",
183 - me);
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)
190 {
191 DBG (DL_MINOR_ERROR, "%s: failed to add device \"%s\"\n",
192 @@ -1752,7 +1772,7 @@
193 }
194
195 void
196 -sane_snapscan_exit (void)
197 +sane_exit (void)
198 {
199 DBG (DL_CALL_TRACE, "sane_snapscan_exit\n");
200
201 @@ -1761,7 +1781,7 @@
202 }
203
204 SANE_Status
205 -sane_snapscan_get_devices (const SANE_Device *** device_list,
206 +sane_get_devices (const SANE_Device *** device_list,
207 SANE_Bool local_only)
208 {
209 static const char *me = "sane_snapscan_get_devices";
210 @@ -1793,7 +1813,7 @@
211 #define TMP_FILE "snapscan-tmp"
212
213 SANE_Status
214 -sane_snapscan_open (SANE_String_Const name, SANE_Handle * h)
215 +sane_open (SANE_String_Const name, SANE_Handle * h)
216 {
217 static const char *me = "sane_snapscan_open";
218 SnapScan_Device *psd;
219 @@ -1905,7 +1925,7 @@
220 }
221
222 void
223 -sane_snapscan_close (SANE_Handle h)
224 +sane_close (SANE_Handle h)
225 {
226 SnapScan_Scanner *pss = (SnapScan_Scanner *) h;
227 DBG (DL_CALL_TRACE, "sane_snapscan_close (%p)\n", (void *) h);
228 @@ -1925,7 +1945,7 @@
229 }
230
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)
234 {
235 DBG (DL_CALL_TRACE, "sane_snapscan_get_option_descriptor (%p, %ld)\n",
236 (void *) h, (long) n);
237 @@ -1938,7 +1958,7 @@
238 }
239
240 SANE_Status
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,
244 SANE_Int * i)
245 {
246 @@ -2621,7 +2641,7 @@
247 }
248
249 SANE_Status
250 -sane_snapscan_get_parameters (SANE_Handle h,
251 +sane_get_parameters (SANE_Handle h,
252 SANE_Parameters * p)
253 {
254 static const char *me = "sane_snapscan_get_parameters";
255 @@ -2673,6 +2693,7 @@
256 {
257 case SNAPSCAN310:
258 case SNAPSCAN600:
259 + case SNAPSCAN1236S:
260 case VUEGO310S: /* WG changed */
261 if (!pss->preview)
262 {
263 @@ -2699,6 +2720,7 @@
264 {
265 case SNAPSCAN310:
266 case SNAPSCAN600:
267 + case SNAPSCAN1236S:
268 case VUEGO310S: /* WG changed */
269 pss->lines += line_offset;
270 p->lines -= line_offset;
271 @@ -2960,7 +2982,7 @@
272 }
273
274 SANE_Status
275 -sane_snapscan_start (SANE_Handle h)
276 +sane_start (SANE_Handle h)
277 {
278 static const char *me = "sane_snapscan_start";
279 SANE_Status status;
280 @@ -3114,6 +3136,7 @@
281 {
282 case SNAPSCAN310:
283 case SNAPSCAN600:
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 @@
289 {
290 case SNAPSCAN310:
291 case SNAPSCAN600:
292 + case SNAPSCAN1236S:
293 case VUEGO310S: /* WG changed */
294 rgb_buf_clean (pss);
295 break;
296 @@ -3153,6 +3177,7 @@
297 {
298 case SNAPSCAN310:
299 case SNAPSCAN600:
300 + case SNAPSCAN1236S:
301 case VUEGO310S: /* WG changed */
302 transfer_data_diff (other_buf, pss);
303 break;
304 @@ -3186,6 +3211,7 @@
305 {
306 case SNAPSCAN310:
307 case SNAPSCAN600:
308 + case SNAPSCAN1236S:
309 case VUEGO310S: /* WG changed */
310 rgb_buf_clean (pss);
311 break;
312 @@ -3231,13 +3257,14 @@
313 pss->bytes_per_line / pss->ms_per_line);
314
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 */
318 if (colour)
319 {
320 switch (pss->pdev->model)
321 {
322 case SNAPSCAN310:
323 case SNAPSCAN600:
324 + case SNAPSCAN1236S:
325 case VUEGO310S: /* WG changed */
326 rgb_buf_init (pss);
327 break;
328 @@ -3268,7 +3295,7 @@
329
330
331 SANE_Status
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)
335 {
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);
340
341 + *plen = 0;
342 +
343 if (!pss->expected_data_len)
344 {
345 if (pss->child > 0)
346 @@ -3292,8 +3321,6 @@
347 return SANE_STATUS_EOF;
348 }
349
350 - *plen = 0;
351 -
352 if (pss->preview)
353 mode = pss->preview_mode;
354
355 @@ -3413,6 +3440,7 @@
356 {
357 case SNAPSCAN310:
358 case SNAPSCAN600:
359 + case SNAPSCAN1236S:
360 case VUEGO310S: /* WG changed */
361 transferred_bytes = transfer_data_diff (buf, pss);
362 break;
363 @@ -3466,7 +3494,7 @@
364 }
365
366 void
367 -sane_snapscan_cancel (SANE_Handle h)
368 +sane_cancel (SANE_Handle h)
369 {
370 char *me = "sane_snapscan_cancel";
371 SnapScan_Scanner *pss = (SnapScan_Scanner *) h;
372 @@ -3486,6 +3514,7 @@
373 {
374 case SNAPSCAN310:
375 case SNAPSCAN600:
376 + case SNAPSCAN1236S:
377 case VUEGO310S: /* WG changed */
378 rgb_buf_clean (pss);
379 break;
380 @@ -3506,7 +3535,7 @@
381 }
382
383 SANE_Status
384 -sane_snapscan_set_io_mode (SANE_Handle h, SANE_Bool m)
385 +sane_set_io_mode (SANE_Handle h, SANE_Bool m)
386 {
387 static char me[] = "sane_snapscan_set_io_mode";
388 SnapScan_Scanner *pss = (SnapScan_Scanner *) h;
389 @@ -3541,7 +3570,7 @@
390 }
391
392 SANE_Status
393 -sane_snapscan_get_select_fd (SANE_Handle h, SANE_Int * fd)
394 +sane_get_select_fd (SANE_Handle h, SANE_Int * fd)
395 {
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
401 @@ -28,6 +28,8 @@
402 :comment "Ditto"
403 :model "SnapScan 600"
404 :comment "Ditto"
405 +:model "SnapScan 1236s"
406 +:comment "Ditto"
407 :mfg "Vuego"
408 :model "310S"
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
413 @@ -54,22 +54,41 @@
414 /* snapscan device field values */
415
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*/
425
426 typedef enum
427 {
428 + UNKNOWN,
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 */
434 } SnapScan_Model;
435 +
436 +struct SnapScan_Model_desc
437 +{
438 + char *scsi_name;
439 + SnapScan_Model id;
440 +};
441 +
442 +static struct SnapScan_Model_desc scanners[] =
443 +{
444 + { "FlatbedScanner_4", VUEGO310S },
445 + { "SNAPSCAN 1236s", SNAPSCAN1236S },
446 + { "SNAPSCAN 310", SNAPSCAN310 },
447 + { "SNAPSCAN 600", SNAPSCAN600 },
448 + { "SnapScan", SNAPSCAN300 },
449 +};
450 +#define known_scanners (sizeof(scanners)/sizeof(struct SnapScan_Model_desc))
451 +
452 +static char *vendors[] =
453 +{
454 + "AGFA",
455 + "COLOR",
456 +};
457 +#define known_vendors (sizeof(vendors)/sizeof(char*))
458
459 typedef enum
460 {