1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
|
/* --------------------------------------------------------------------- */
/* coolscan.h - headerfile for SANE-backend for coolscan scanners
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
As a special exception, the authors of SANE give permission for
additional uses of the libraries contained in this release of SANE.
The exception is that, if you link a SANE library with other files
to produce an executable, this does not by itself cause the
resulting executable to be covered by the GNU General Public
License. Your use of that executable is in no way restricted on
account of linking the SANE library code into it.
This exception does not, however, invalidate any other reasons why
the executable file might be covered by the GNU General Public
License.
If you submit changes to SANE to the maintainers to be included in
a subsequent release, you agree by submitting the changes that
those changes may be distributed with this exception intact.
If you write modifications of your own for SANE, it is your choice
whether to permit this exception to apply to your modifications.
If you do not wish that, delete this exception notice.
*/
/* --------------------------------------------------------------------- */
#ifndef coolscan_h
#define coolscan_h
#include "sys/types.h"
enum Coolscan_Option
{
OPT_NUM_OPTS = 0,
OPT_MODE_GROUP,
OPT_MODE,
OPT_SOURCE,
OPT_RESOLUTION,
OPT_PREVIEW_RESOLUTION,
OPT_TYPE,
OPT_BIT_DEPTH,
OPT_PRESCAN,
OPT_PRESCAN_NOW,
OPT_GEOMETRY_GROUP,
OPT_TL_X, /* top-left x */
OPT_TL_Y, /* top-left y */
OPT_BR_X, /* bottom-right x */
OPT_BR_Y, /* bottom-right y */
OPT_ENHANCEMENT_GROUP,
OPT_GAMMA_BIND,
OPT_ANALOG_GAMMA,
OPT_AVERAGING,
OPT_RGB_CONTROL,
OPT_BRIGHTNESS,
OPT_R_BRIGHTNESS,
OPT_G_BRIGHTNESS,
OPT_B_BRIGHTNESS,
OPT_CONTRAST,
OPT_R_CONTRAST,
OPT_G_CONTRAST,
OPT_B_CONTRAST,
OPT_EXPOSURE,
OPT_R_EXPOSURE,
OPT_G_EXPOSURE,
OPT_B_EXPOSURE,
OPT_R_SHIFT,
OPT_G_SHIFT,
OPT_B_SHIFT,
OPT_ADVANCED_GROUP,
OPT_PREVIEW, /* preview */
OPT_AUTOFOCUS, /* autofocus */
OPT_IRED_RED,
OPT_GAMMA_VECTOR,
OPT_GAMMA_VECTOR_R,
OPT_GAMMA_VECTOR_G,
OPT_GAMMA_VECTOR_B,
/* must come last: */
NUM_OPTIONS
};
typedef struct Image_Pos
{ int start; /* start position of image on film strip */
int end; /* end position of image on film strip */
int offset /* always 0 */;
int height; /* image height always 2591 */
} Image_Pos_t;
typedef struct Coolscan
{
struct Coolscan *next;
SANE_Option_Descriptor opt[NUM_OPTIONS];
SANE_Pid reader_pid;
int reader_fds;
int pipe;
int scanning;
/*--------------------------*/
SANE_Device sane;
SANE_Range dpi_range;
SANE_Range x_range;
SANE_Range y_range;
/*--------------------------*/
/* buffer used for scsi-transfer and writing*/
unsigned char *buffer;
unsigned char *obuffer;
unsigned int row_bufsize;
char *devicename; /* name of the scanner device */
int sfd; /* output file descriptor, scanner device */
char vendor[9]; /* will be Nikon */
char product[17]; /* e.g. "LS-1000 " or so */
char version[5]; /* e.g. V1.6 */
int LS; /* index in scanner_str */
int cont; /* continue although scanner is unknown */
int verbose; /* 1,2=output information */
int asf; /* Automatic Slide Feeder enabled? */
int MUD; /* Measurement Unit Divisor (1200 or 2700) */
int inquiry_len; /* length of inquiry return block [36] */
int inquiry_wdb_len; /* length of window descriptor block [117] */
int wdb_len; /* use this length of WDB */
double width; /* use this width of scan-area */
double length; /* use this length of scan-area */
int x_nres;
int y_nres;
int x_p_nres; /* same as above, but apply to preview */
int y_p_nres;
int tlx; /* Left edge in 'Internal Length Units'. */
int tly; /* Top edge in ILU */
int brx; /* Right edge in ILU. */
int bry; /* Bottom edge in ILU. */
int bits_per_color; /* bits per color (8/10/12) */
int bits_per_pixel; /* bits per pixel (24/30/40) */
int negative; /* Negative/positive object */
int dropoutcolor; /* Which color to scan when gray */
int transfermode; /**/
int gammaselection; /* Linear/Monitor*/
int shading;
int averaging;
int brightness_R;
int brightness_G;
int brightness_B;
int contrast_R;
int contrast_G;
int contrast_B;
int exposure_R;
int exposure_G;
int exposure_B;
int shift_R;
int shift_G;
int shift_B;
int set_auto; /* 0 or 1, don't know what it is */
int preview; /* 1 if preview */
int autofocus; /* when to do autofocus */
#define AF_NEVER 0x00
#define AF_PREVIEW 0x01
#define AF_SCAN 0x02
#define AF_PREANDSCAN 0x03
int colormode; /* GREYSCALE or RGB */
int colormode_p; /* GREYSCALE or RGB for preview */
#define GREYSCALE 0x01
#define RGB 0x07
#define IRED 0x08
#define RGBI 0x0f
int low_byte_first; /* 1 if little-endian - 0 if big-endian */
/* Internal information */
int adbits; /* Number of A/D bits [8 or 12] */
int outputbits; /* Number of output image data bits [8] */
int maxres; /* Maximum resolution [2700] (dpi) */
int xmax; /* X-axis coordinate maximum value
(basic measurement unit when measurement
unit divisor = 1200) [1151] */
int ymax; /* Y-axis coordinate maximum value
(basic measurement unit when measurement
unit divisor = 1200) [1727] */
int xmaxpix; /* X-axis coordinate maximum value (pixel
address value) [2591] */
int ymaxpix; /* Y-axis coordinate maximum value (pixel
address value) [3887] */
int ycurrent; /* Current stage position (Y-axis direction
pixel address) [0-7652] */
int currentfocus; /* Current focus position (focus direction
address) [0-200] */
int currentscanpitch; /* Current scan pitch [1-25] */
int autofeeder; /* Provision of auto feeder [Yes: 1, No: 0] */
int analoggamma; /* Analog gamma support [Yes: 1, No: 0] */
int derr[8]; /* Device error code (0 is latest, 7 oldest) */
int wbetr_r; /* White balance exposure time variable (R) */
int webtr_g; /* White balance exposure time variable (G) */
int webtr_b; /* White balance exposure time variable (B) */
int pretv_r; /* Prescan result exposure time variable (R) */
int pretv_g; /* Prescan result exposure time variable (G) */
int pretv_b; /* Prescan result exposure time variable (B) */
int cetv_r; /* Current exposure time variable (R) */
int cetv_g; /* Current exposure time variable (G) */
int cetv_b; /* Current exposure time variable (B) */
int ietu_r; /* Internal exposure time unit (R) */
int ietu_g; /* Internal exposure time unit (G) */
int ietu_b; /* Internal exposure time unit (B) */
int limitcondition; /* Condition of each limit SW, DIP SW, etc. */
int offsetdata_r; /* Offset data (R) */
int offsetdata_g; /* Offset data (G) */
int offsetdata_b; /* Offset data (B) */
char power_on_errors[8]; /* Records of error code at power on */
/* End of internal information */
int brightness; /* (128) cbhs_range 0-255, halftone mode */
int contrast; /* (128) cbhs_range 0-255, halftone-mode */
int prescan; /* */
int rgb_control; /* */
int gamma_bind; /* TRUE -> RGB */
int lutlength; /* length of gamma table */
int max_lut_val; /* maximum value in lut */
SANE_Word gamma[4096]; /* gamma value for RGB */
SANE_Word gamma_r[4096]; /* gamma value for red */
SANE_Word gamma_g[4096]; /* gamma value for green */
SANE_Word gamma_b[4096]; /* gamma value for blue */
int luti[4096]; /* lut value for infrared */
int lutr[4096]; /* lut value for red */
int lutg[4096]; /* lut value for green */
int lutb[4096]; /* lut value for blue */
char *gamma_file_r; /* file for gamma download */
char *gamma_file_g; /* file for gamma download */
char *gamma_file_b; /* file for gamma download */
int analog_gamma_r; /* analog gamma red and grey */
int analog_gamma_g; /* analog gamma green */
int analog_gamma_b; /* analog gamma blue */
/* Infrared correction values */
int ired_red;
int ired_green;
int ired_blue;
int feeder; /* type of feeder used */
int numima; /* number of images on film strip */
int posima; /* current image */
Image_Pos_t ipos[6]; /* positions for 6 images */
#define STRIP_FEEDER 1
#define MOUNT_FEEDER 2
}
Coolscan_t;
typedef struct
{
char *scanner;
char *inquiry;
int inquiry_len;
}
inquiry_blk;
/* ==================================================================== */
/* names of scanners that are supported because */
/* the inquiry_return_block is ok and driver is tested */
static char *scanner_str[] =
{
"COOLSCAN II ",
"LS-1000 ",
"COOLSCANIII ",
"LS-2000 ",
};
#define known_scanners 4
/* Comment this line if you haven't patched sane.h to include
SANE_FRAME_RGBA */
/* #define HAS_IRED 1 */
#endif /* coolscan-sane_h */
|