1141cc406Sopenharmony_ci/* --------------------------------------------------------------------------------------------------------- */
2141cc406Sopenharmony_ci
3141cc406Sopenharmony_ci/* umax.h - headerfile for SANE-backend for umax scanners
4141cc406Sopenharmony_ci
5141cc406Sopenharmony_ci   (C) 1997-2002 Oliver Rauch
6141cc406Sopenharmony_ci
7141cc406Sopenharmony_ci   This program is free software; you can redistribute it and/or
8141cc406Sopenharmony_ci   modify it under the terms of the GNU General Public License as
9141cc406Sopenharmony_ci   published by the Free Software Foundation; either version 2 of the
10141cc406Sopenharmony_ci   License, or (at your option) any later version.
11141cc406Sopenharmony_ci
12141cc406Sopenharmony_ci   This program is distributed in the hope that it will be useful, but
13141cc406Sopenharmony_ci   WITHOUT ANY WARRANTY; without even the implied warranty of
14141cc406Sopenharmony_ci   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15141cc406Sopenharmony_ci   General Public License for more details.
16141cc406Sopenharmony_ci
17141cc406Sopenharmony_ci   You should have received a copy of the GNU General Public License
18141cc406Sopenharmony_ci   along with this program.  If not, see <https://www.gnu.org/licenses/>.
19141cc406Sopenharmony_ci
20141cc406Sopenharmony_ci   As a special exception, the authors of SANE give permission for
21141cc406Sopenharmony_ci   additional uses of the libraries contained in this release of SANE.
22141cc406Sopenharmony_ci
23141cc406Sopenharmony_ci   The exception is that, if you link a SANE library with other files
24141cc406Sopenharmony_ci   to produce an executable, this does not by itself cause the
25141cc406Sopenharmony_ci   resulting executable to be covered by the GNU General Public
26141cc406Sopenharmony_ci   License.  Your use of that executable is in no way restricted on
27141cc406Sopenharmony_ci   account of linking the SANE library code into it.
28141cc406Sopenharmony_ci
29141cc406Sopenharmony_ci   This exception does not, however, invalidate any other reasons why
30141cc406Sopenharmony_ci   the executable file might be covered by the GNU General Public
31141cc406Sopenharmony_ci   License.
32141cc406Sopenharmony_ci
33141cc406Sopenharmony_ci   If you submit changes to SANE to the maintainers to be included in
34141cc406Sopenharmony_ci   a subsequent release, you agree by submitting the changes that
35141cc406Sopenharmony_ci   those changes may be distributed with this exception intact.
36141cc406Sopenharmony_ci
37141cc406Sopenharmony_ci   If you write modifications of your own for SANE, it is your choice
38141cc406Sopenharmony_ci   whether to permit this exception to apply to your modifications.
39141cc406Sopenharmony_ci   If you do not wish that, delete this exception notice.
40141cc406Sopenharmony_ci
41141cc406Sopenharmony_ci */
42141cc406Sopenharmony_ci
43141cc406Sopenharmony_ci/* --------------------------------------------------------------------------------------------------------- */
44141cc406Sopenharmony_ci
45141cc406Sopenharmony_ci
46141cc406Sopenharmony_ci#ifndef umax_h
47141cc406Sopenharmony_ci#define umax_h
48141cc406Sopenharmony_ci
49141cc406Sopenharmony_ci#include "sys/types.h"
50141cc406Sopenharmony_ci
51141cc406Sopenharmony_ci/* --------------------------------------------------------------------------------------------------------- */
52141cc406Sopenharmony_ci/* COMPILER OPTIONS: */
53141cc406Sopenharmony_ci
54141cc406Sopenharmony_ci#define UMAX_ENABLE_USB
55141cc406Sopenharmony_ci#define UMAX_HIDE_UNUSED
56141cc406Sopenharmony_ci
57141cc406Sopenharmony_ci/* #define SANE_UMAX_DEBUG_S12 */
58141cc406Sopenharmony_ci/* #define UMAX_CALIBRATION_MODE_SELECTABLE */
59141cc406Sopenharmony_ci
60141cc406Sopenharmony_ci/* --------------------------------------------------------------------------------------------------------- */
61141cc406Sopenharmony_ci
62141cc406Sopenharmony_ci#define SANE_UMAX_SCSI_MAXQUEUE 		8
63141cc406Sopenharmony_ci
64141cc406Sopenharmony_ci/* --------------------------------------------------------------------------------------------------------- */
65141cc406Sopenharmony_ci
66141cc406Sopenharmony_ci#define SANE_UMAX_FIX_ROUND(val) ((SANE_Word) ((val) * (1 << SANE_FIXED_SCALE_SHIFT) + 1.0 / (1 << (SANE_FIXED_SCALE_SHIFT+1))))
67141cc406Sopenharmony_ci
68141cc406Sopenharmony_ci/* --------------------------------------------------------------------------------------------------------- */
69141cc406Sopenharmony_ci
70141cc406Sopenharmony_cienum Umax_Option
71141cc406Sopenharmony_ci{
72141cc406Sopenharmony_ci    OPT_NUM_OPTS = 0,
73141cc406Sopenharmony_ci
74141cc406Sopenharmony_ci    /* ------------------------------------------- */
75141cc406Sopenharmony_ci
76141cc406Sopenharmony_ci    OPT_MODE_GROUP,
77141cc406Sopenharmony_ci    OPT_MODE,
78141cc406Sopenharmony_ci    OPT_SOURCE,
79141cc406Sopenharmony_ci    OPT_X_RESOLUTION,
80141cc406Sopenharmony_ci    OPT_Y_RESOLUTION,
81141cc406Sopenharmony_ci
82141cc406Sopenharmony_ci    OPT_RESOLUTION_BIND,							  /* bind x and y resolution */
83141cc406Sopenharmony_ci    OPT_NEGATIVE,
84141cc406Sopenharmony_ci
85141cc406Sopenharmony_ci    /* ------------------------------------------- */
86141cc406Sopenharmony_ci
87141cc406Sopenharmony_ci    OPT_GEOMETRY_GROUP,
88141cc406Sopenharmony_ci    OPT_TL_X,										       /* top-left x */
89141cc406Sopenharmony_ci    OPT_TL_Y,										       /* top-left y */
90141cc406Sopenharmony_ci    OPT_BR_X,										   /* bottom-right x */
91141cc406Sopenharmony_ci    OPT_BR_Y,										   /* bottom-right y */
92141cc406Sopenharmony_ci
93141cc406Sopenharmony_ci    /* ------------------------------------------- */
94141cc406Sopenharmony_ci
95141cc406Sopenharmony_ci    OPT_ENHANCEMENT_GROUP,
96141cc406Sopenharmony_ci
97141cc406Sopenharmony_ci    OPT_BIT_DEPTH,								         /* output bit depth */
98141cc406Sopenharmony_ci    OPT_QUALITY,								      /* quality calibration */
99141cc406Sopenharmony_ci    OPT_DOR,									/* double optical resolution */
100141cc406Sopenharmony_ci    OPT_WARMUP,
101141cc406Sopenharmony_ci    OPT_RGB_BIND,					 /* use same rgb-values for each color in color-mode */
102141cc406Sopenharmony_ci
103141cc406Sopenharmony_ci    OPT_BRIGHTNESS,
104141cc406Sopenharmony_ci    OPT_CONTRAST,
105141cc406Sopenharmony_ci    OPT_THRESHOLD,
106141cc406Sopenharmony_ci
107141cc406Sopenharmony_ci    OPT_HIGHLIGHT,										/* highlight */
108141cc406Sopenharmony_ci    OPT_HIGHLIGHT_R,
109141cc406Sopenharmony_ci    OPT_HIGHLIGHT_G,
110141cc406Sopenharmony_ci    OPT_HIGHLIGHT_B,
111141cc406Sopenharmony_ci
112141cc406Sopenharmony_ci    OPT_SHADOW,										 	   /* shadow */
113141cc406Sopenharmony_ci    OPT_SHADOW_R,
114141cc406Sopenharmony_ci    OPT_SHADOW_G,
115141cc406Sopenharmony_ci    OPT_SHADOW_B,
116141cc406Sopenharmony_ci
117141cc406Sopenharmony_ci    OPT_ANALOG_GAMMA,									     /* analog gamma */
118141cc406Sopenharmony_ci    OPT_ANALOG_GAMMA_R,
119141cc406Sopenharmony_ci    OPT_ANALOG_GAMMA_G,
120141cc406Sopenharmony_ci    OPT_ANALOG_GAMMA_B,
121141cc406Sopenharmony_ci
122141cc406Sopenharmony_ci    OPT_CUSTOM_GAMMA,								  /* use custom gamma tables */
123141cc406Sopenharmony_ci    				       /* The gamma vectors MUST appear in the order gray, red, green, blue. */
124141cc406Sopenharmony_ci    OPT_GAMMA_VECTOR,
125141cc406Sopenharmony_ci    OPT_GAMMA_VECTOR_R,
126141cc406Sopenharmony_ci    OPT_GAMMA_VECTOR_G,
127141cc406Sopenharmony_ci    OPT_GAMMA_VECTOR_B,
128141cc406Sopenharmony_ci
129141cc406Sopenharmony_ci    OPT_HALFTONE_DIMENSION,
130141cc406Sopenharmony_ci    OPT_HALFTONE_PATTERN,
131141cc406Sopenharmony_ci
132141cc406Sopenharmony_ci    /* ------------------------------------------- */
133141cc406Sopenharmony_ci
134141cc406Sopenharmony_ci    OPT_ADVANCED_GROUP,
135141cc406Sopenharmony_ci
136141cc406Sopenharmony_ci    OPT_CAL_EXPOS_TIME,							    /* exposure time for calibration */
137141cc406Sopenharmony_ci    OPT_CAL_EXPOS_TIME_R,
138141cc406Sopenharmony_ci    OPT_CAL_EXPOS_TIME_G,
139141cc406Sopenharmony_ci    OPT_CAL_EXPOS_TIME_B,
140141cc406Sopenharmony_ci    OPT_SCAN_EXPOS_TIME,							   /* exposure time for scan */
141141cc406Sopenharmony_ci    OPT_SCAN_EXPOS_TIME_R,
142141cc406Sopenharmony_ci    OPT_SCAN_EXPOS_TIME_G,
143141cc406Sopenharmony_ci    OPT_SCAN_EXPOS_TIME_B,
144141cc406Sopenharmony_ci
145141cc406Sopenharmony_ci    OPT_DISABLE_PRE_FOCUS,
146141cc406Sopenharmony_ci    OPT_MANUAL_PRE_FOCUS,
147141cc406Sopenharmony_ci    OPT_FIX_FOCUS_POSITION,
148141cc406Sopenharmony_ci    OPT_LENS_CALIBRATION_DOC_POS,
149141cc406Sopenharmony_ci    OPT_HOLDER_FOCUS_POS_0MM,
150141cc406Sopenharmony_ci
151141cc406Sopenharmony_ci    OPT_CAL_LAMP_DEN,
152141cc406Sopenharmony_ci    OPT_SCAN_LAMP_DEN,
153141cc406Sopenharmony_ci
154141cc406Sopenharmony_ci    OPT_SELECT_EXPOSURE_TIME,
155141cc406Sopenharmony_ci    OPT_SELECT_CAL_EXPOSURE_TIME,
156141cc406Sopenharmony_ci    OPT_SELECT_LAMP_DENSITY,
157141cc406Sopenharmony_ci
158141cc406Sopenharmony_ci    OPT_LAMP_ON,
159141cc406Sopenharmony_ci    OPT_LAMP_OFF,
160141cc406Sopenharmony_ci    OPT_LAMP_OFF_AT_EXIT,
161141cc406Sopenharmony_ci
162141cc406Sopenharmony_ci    OPT_BATCH_SCAN_START,							/* start batch scan function */
163141cc406Sopenharmony_ci    OPT_BATCH_SCAN_LOOP,							 /* loop batch scan function */
164141cc406Sopenharmony_ci    OPT_BATCH_SCAN_END,								  /* end batch scan function */
165141cc406Sopenharmony_ci    OPT_BATCH_NEXT_TL_Y,						      /* batch scan function next y position */
166141cc406Sopenharmony_ci
167141cc406Sopenharmony_ci#ifdef UMAX_CALIBRATION_MODE_SELECTABLE
168141cc406Sopenharmony_ci    OPT_CALIB_MODE,
169141cc406Sopenharmony_ci#endif
170141cc406Sopenharmony_ci
171141cc406Sopenharmony_ci    OPT_PREVIEW,					/* preview, sets preview-bit and bind x/y-resolution */
172141cc406Sopenharmony_ci
173141cc406Sopenharmony_ci    /* must come last: */
174141cc406Sopenharmony_ci    NUM_OPTIONS
175141cc406Sopenharmony_ci};
176141cc406Sopenharmony_ci
177141cc406Sopenharmony_ci
178141cc406Sopenharmony_ci/* -------------------------------------------------------------------------------------------------------- */
179141cc406Sopenharmony_ci
180141cc406Sopenharmony_ci
181141cc406Sopenharmony_ci/* LIST OF AVAILABLE SCANNERS, THE VALUES LISTED HERE ARE THE SAME FOR DIFFERENT APPLICATIONS
182141cc406Sopenharmony_ci   THAT USE THE SAME DEVICE */
183141cc406Sopenharmony_ci
184141cc406Sopenharmony_ci/* Umax_Device contains values relevant for the device that are not interesting for the sane interface */
185141cc406Sopenharmony_ci
186141cc406Sopenharmony_citypedef struct Umax_Device
187141cc406Sopenharmony_ci{
188141cc406Sopenharmony_ci  struct Umax_Device	*next;
189141cc406Sopenharmony_ci  SANE_Device		sane;
190141cc406Sopenharmony_ci
191141cc406Sopenharmony_ci  int connection_type;
192141cc406Sopenharmony_ci#define SANE_UMAX_UNKNOWN 0
193141cc406Sopenharmony_ci#define SANE_UMAX_SCSI 1
194141cc406Sopenharmony_ci#define SANE_UMAX_USB 2
195141cc406Sopenharmony_ci
196141cc406Sopenharmony_ci  SANE_Range		x_dpi_range;
197141cc406Sopenharmony_ci  SANE_Range		y_dpi_range;
198141cc406Sopenharmony_ci  SANE_Range		x_range;
199141cc406Sopenharmony_ci  SANE_Range		y_range;
200141cc406Sopenharmony_ci  SANE_Range		analog_gamma_range;
201141cc406Sopenharmony_ci  unsigned		flags;
202141cc406Sopenharmony_ci
203141cc406Sopenharmony_ci  unsigned char		*buffer[SANE_UMAX_SCSI_MAXQUEUE];		    /* buffer used for scsi-transfer */
204141cc406Sopenharmony_ci  void                  *queue_id[SANE_UMAX_SCSI_MAXQUEUE];				    /* scsi queue id */
205141cc406Sopenharmony_ci  size_t		length_queued[SANE_UMAX_SCSI_MAXQUEUE];			    /* length of queued data */
206141cc406Sopenharmony_ci  size_t		length_read[SANE_UMAX_SCSI_MAXQUEUE];			  /* length of returned data */
207141cc406Sopenharmony_ci  unsigned int		bufsize;
208141cc406Sopenharmony_ci  unsigned int		row_bufsize;
209141cc406Sopenharmony_ci  unsigned int		request_scsi_maxqueue;
210141cc406Sopenharmony_ci  unsigned int		request_preview_lines;
211141cc406Sopenharmony_ci  unsigned int		request_scan_lines;
212141cc406Sopenharmony_ci  unsigned int		handle_bad_sense_error;
213141cc406Sopenharmony_ci  unsigned int		execute_request_sense;
214141cc406Sopenharmony_ci  unsigned int		force_preview_bit_rgb;
215141cc406Sopenharmony_ci  unsigned int		scsi_buffer_size_min;
216141cc406Sopenharmony_ci  unsigned int		scsi_buffer_size_max;
217141cc406Sopenharmony_ci  unsigned int		scsi_maxqueue;
218141cc406Sopenharmony_ci
219141cc406Sopenharmony_ci  unsigned char		*pixelbuffer;					   /* buffer used for pixel ordering */
220141cc406Sopenharmony_ci  unsigned int		pixelline_max;				/* number of lines that fit into pixelbuffer */
221141cc406Sopenharmony_ci  unsigned int		pixelline_ready[3];			    /* finished absolute line for each color */
222141cc406Sopenharmony_ci  unsigned int		pixelline_next[3];				/* next line to write for each color */
223141cc406Sopenharmony_ci  unsigned int		pixelline_del[3];			   /* next line to delete in opt_res for col */
224141cc406Sopenharmony_ci  unsigned int		pixelline_optic[3];			   /* scanned line in opt_res for each color */
225141cc406Sopenharmony_ci  unsigned int		pixelline_opt_res;			    /* number of scanned line in optical res */
226141cc406Sopenharmony_ci  unsigned int		pixelline_read;					       /* number of read pixel-lines */
227141cc406Sopenharmony_ci  unsigned int		pixelline_written;				    /* number of written pixel-lines */
228141cc406Sopenharmony_ci  unsigned int		CCD_distance;				/* color line distance in optical resolution */
229141cc406Sopenharmony_ci  unsigned int		CCD_color[9];							      /* color order */
230141cc406Sopenharmony_ci										/* 0 / 1 2 / 3 4 5 / 6 7 / 8 */
231141cc406Sopenharmony_ci#  define CCD_color_red   0
232141cc406Sopenharmony_ci#  define CCD_color_green 1
233141cc406Sopenharmony_ci#  define CCD_color_blue  2
234141cc406Sopenharmony_ci
235141cc406Sopenharmony_ci  char			*devicename;					       /* name of the scanner device */
236141cc406Sopenharmony_ci  int			sfd;					   /* output file descriptor, scanner device */
237141cc406Sopenharmony_ci
238141cc406Sopenharmony_ci  char			vendor[9];							     /* will be UMAX */
239141cc406Sopenharmony_ci  char			product[17];					      /* e.g. "SuperVista_S12" or so */
240141cc406Sopenharmony_ci  char			version[5];								/* e.g. V1.3 */
241141cc406Sopenharmony_ci
242141cc406Sopenharmony_ci  int			three_pass;					  /* used in RGB-mode if 3-pass => 1 */
243141cc406Sopenharmony_ci  int			three_pass_color;			  /* select color for scanning in 3pass mode */
244141cc406Sopenharmony_ci  unsigned int		row_len;					    /* len of one scan-line in bytes */
245141cc406Sopenharmony_ci  unsigned int		lines_max;					  /* maximum number of lines to scan */
246141cc406Sopenharmony_ci  unsigned int		max_value;							/* used for pnm-file */
247141cc406Sopenharmony_ci
248141cc406Sopenharmony_ci  /* data defined by inquiry */
249141cc406Sopenharmony_ci  int			inquiry_len;					   /* length of inquiry return block */
250141cc406Sopenharmony_ci  int			inquiry_wdb_len;				/* length of window descriptor block */
251141cc406Sopenharmony_ci  int			inquiry_vidmem;			     			     /* size of video memory */
252141cc406Sopenharmony_ci  int			inquiry_optical_res;			     		       /* optical resolution */
253141cc406Sopenharmony_ci  int			inquiry_x_res;						     /* maximum x-resolution */
254141cc406Sopenharmony_ci  int			inquiry_y_res;						     /* maximum y-resolution */
255141cc406Sopenharmony_ci  int			inquiry_dor_optical_res;			  /* optical resolution for dor mode */
256141cc406Sopenharmony_ci  int			inquiry_dor_x_res;				/* maximum x-resolution for dor mode */
257141cc406Sopenharmony_ci  int			inquiry_dor_y_res;				/* maximum y-resolution for dor mode */
258141cc406Sopenharmony_ci  double		inquiry_fb_width;					  /* flatbed width in inches */
259141cc406Sopenharmony_ci  double		inquiry_fb_length;					 /* flatbed length in inches */
260141cc406Sopenharmony_ci  double		inquiry_uta_width;				     /* transparency width in inches */
261141cc406Sopenharmony_ci  double		inquiry_uta_length;				    /* transparency length in inches */
262141cc406Sopenharmony_ci  double		inquiry_uta_x_off;				  /* transparency x offset in inches */
263141cc406Sopenharmony_ci  double		inquiry_uta_y_off;				  /* transparency y offset in inches */
264141cc406Sopenharmony_ci  double		inquiry_dor_width;				/* double resolution width in inches */
265141cc406Sopenharmony_ci  double		inquiry_dor_length;			       /* double resolution length in inches */
266141cc406Sopenharmony_ci  double		inquiry_dor_x_off;			     /* double resolution x offset in inches */
267141cc406Sopenharmony_ci  double		inquiry_dor_y_off;			     /* double resolution y offset in inches */
268141cc406Sopenharmony_ci
269141cc406Sopenharmony_ci  int			inquiry_exposure_adj;				/* 1 if exposure adjust is supported */
270141cc406Sopenharmony_ci  int			inquiry_exposure_time_step_unit;		  /* exposure time unit in micro sec */
271141cc406Sopenharmony_ci  int			inquiry_exposure_time_max;				    /* exposure time maximum */
272141cc406Sopenharmony_ci  int			inquiry_exposure_time_l_min;			/* exposure tine minimum for lineart */
273141cc406Sopenharmony_ci  int			inquiry_exposure_time_l_fb_def;		/* exposure time default for lineart/flatbed */
274141cc406Sopenharmony_ci  int			inquiry_exposure_time_l_uta_def;	    /* exposure time default for lineart/uta */
275141cc406Sopenharmony_ci  int			inquiry_exposure_time_h_min;		       /* exposure tine minimum for halftone */
276141cc406Sopenharmony_ci  int			inquiry_exposure_time_h_fb_def;	       /* exposure time default for halftone/flatbed */
277141cc406Sopenharmony_ci  int			inquiry_exposure_time_h_uta_def;	   /* exposure time default for halftone/uta */
278141cc406Sopenharmony_ci  int			inquiry_exposure_time_g_min;		      /* exposure tine minimum for grayscale */
279141cc406Sopenharmony_ci  int			inquiry_exposure_time_g_fb_def;	      /* exposure time default for grayscale/flatbed */
280141cc406Sopenharmony_ci  int			inquiry_exposure_time_g_uta_def;	  /* exposure time default for grayscale/uta */
281141cc406Sopenharmony_ci  int			inquiry_exposure_time_c_min;			  /* exposure tine minimum for color */
282141cc406Sopenharmony_ci  int			inquiry_exposure_time_c_fb_def_r;     /* exposure time default for color red/flatbed */
283141cc406Sopenharmony_ci  int			inquiry_exposure_time_c_fb_def_g;   /* exposure time default for color green/flatbed */
284141cc406Sopenharmony_ci  int			inquiry_exposure_time_c_fb_def_b;    /* exposure time default for color blue/flatbed */
285141cc406Sopenharmony_ci  int			inquiry_exposure_time_c_uta_def_r;        /* exposure time default for color red/uta */
286141cc406Sopenharmony_ci  int			inquiry_exposure_time_c_uta_def_g;      /* exposure time default for color green/uta */
287141cc406Sopenharmony_ci  int			inquiry_exposure_time_c_uta_def_b;       /* exposure time default for color blue/uta */
288141cc406Sopenharmony_ci
289141cc406Sopenharmony_ci  int			inquiry_max_warmup_time;			  /* maximum lamp warmup time in sec */
290141cc406Sopenharmony_ci  int			inquiry_cbhs;						    /* 50, 255, 255+autoexp. */
291141cc406Sopenharmony_ci  int			inquiry_cbhs_min;					   /* minimum value for cbhs */
292141cc406Sopenharmony_ci  int			inquiry_cbhs_max;					   /* maximum value for cbhs */
293141cc406Sopenharmony_ci  int			inquiry_contrast_min;					      /* minimum value for c */
294141cc406Sopenharmony_ci  int			inquiry_contrast_max;					      /* maximum value for c */
295141cc406Sopenharmony_ci  int			inquiry_brightness_min;					      /* minimum value for b */
296141cc406Sopenharmony_ci  int			inquiry_brightness_max;					      /* maximum value for b */
297141cc406Sopenharmony_ci  int			inquiry_threshold_min;					      /* minimum value for t */
298141cc406Sopenharmony_ci  int			inquiry_threshold_max;					      /* maximum value for t */
299141cc406Sopenharmony_ci  int			inquiry_highlight_min;					      /* minimum value for h */
300141cc406Sopenharmony_ci  int			inquiry_highlight_max;					      /* maximum value for h */
301141cc406Sopenharmony_ci  int			inquiry_shadow_min;					      /* minimum value for s */
302141cc406Sopenharmony_ci  int			inquiry_shadow_max;					      /* maximum value for s */
303141cc406Sopenharmony_ci
304141cc406Sopenharmony_ci  int			inquiry_quality_ctrl;						    /* 1 = supported */
305141cc406Sopenharmony_ci  int			inquiry_batch_scan;						    /* 1 = supported */
306141cc406Sopenharmony_ci  int			inquiry_preview;						    /* 1 = supported */
307141cc406Sopenharmony_ci  int			inquiry_lamp_ctrl;						    /* 1 = supported */
308141cc406Sopenharmony_ci  int			inquiry_transavail;						/* 1 = uta available */
309141cc406Sopenharmony_ci  int			inquiry_adfmode;						/* 1 = adf available */
310141cc406Sopenharmony_ci  int			inquiry_uta;							/* 1 = uta supported */
311141cc406Sopenharmony_ci  int			inquiry_adf;							/* 1 = adf supported */
312141cc406Sopenharmony_ci  int			inquiry_dor;							/* 1 = dor supported */
313141cc406Sopenharmony_ci  int			inquiry_reverse;				      /* 1 = 1 bit reverse supported */
314141cc406Sopenharmony_ci  int			inquiry_reverse_multi;				  /* 1 = multi bit reverse supported */
315141cc406Sopenharmony_ci  int			inquiry_analog_gamma;				       /* 1 = analog gamma supported */
316141cc406Sopenharmony_ci  int			inquiry_lineart_order;				     /* 1 = LSB first, 0 = MSB first */
317141cc406Sopenharmony_ci
318141cc406Sopenharmony_ci  int			inquiry_lens_cal_in_doc_pos;		/* 1 = lens calibration in doc pos supported */
319141cc406Sopenharmony_ci  int			inquiry_manual_focus;				       /* 1 = manual focus supported */
320141cc406Sopenharmony_ci  int			inquiry_sel_uta_lens_cal_pos;   /* 1 = selection of lens calib pos for uta supported */
321141cc406Sopenharmony_ci
322141cc406Sopenharmony_ci  int			inquiry_gamma_dwload;				     /* 1 = gamma download supported */
323141cc406Sopenharmony_ci  int			inquiry_gamma_DCF;				      /* gamma download curve format */
324141cc406Sopenharmony_ci
325141cc406Sopenharmony_ci  int			inquiry_one_pass_color;					     /* 1 = 1 pass supported */
326141cc406Sopenharmony_ci  int			inquiry_three_pass_color;				     /* 1 = 3 pass supported */
327141cc406Sopenharmony_ci  int			inquiry_color;						 /* 1 = color mode supported */
328141cc406Sopenharmony_ci  int			inquiry_gray;					     /* 1 = grayscale mode supported */
329141cc406Sopenharmony_ci  int			inquiry_halftone;				      /* 1 = halftone mode supported */
330141cc406Sopenharmony_ci  int			inquiry_lineart;				       /* 1 = lineart mode supported */
331141cc406Sopenharmony_ci
332141cc406Sopenharmony_ci  int			inquiry_calibration;			   /* 1 = calibration mode control supported */
333141cc406Sopenharmony_ci  int			inquiry_highlight;					  /* 1 = highlight supported */
334141cc406Sopenharmony_ci  int			inquiry_shadow;						     /* 1 = shadow supported */
335141cc406Sopenharmony_ci  int			inquiry_GIB;							 /* gamma input bits */
336141cc406Sopenharmony_ci  int			inquiry_GOB;						        /* gamma output bits */
337141cc406Sopenharmony_ci  int			inquiry_max_calib_lines;				/* maximum calibration lines */
338141cc406Sopenharmony_ci  int			inquiry_color_order;					   /* color ordering support */
339141cc406Sopenharmony_ci  int			inquiry_CCD_line_distance;				      /* color line distance */
340141cc406Sopenharmony_ci  int			inquiry_fb_uta_color_arrangement;		    /* line arrangement for fb & uta */
341141cc406Sopenharmony_ci  int			inquiry_adf_color_arrangement;				 /* line arrangement for adf */
342141cc406Sopenharmony_ci
343141cc406Sopenharmony_ci  unsigned int		relevant_optical_res;			     		       /* optical resolution */
344141cc406Sopenharmony_ci  unsigned int		relevant_max_x_res;					     /* maximum x-resolution */
345141cc406Sopenharmony_ci  unsigned int		relevant_max_y_res;					     /* maximum y-resolution */
346141cc406Sopenharmony_ci
347141cc406Sopenharmony_ci  /* selected data */
348141cc406Sopenharmony_ci
349141cc406Sopenharmony_ci  int			use_exposure_time_min;					   /*  exposure tine minimum */
350141cc406Sopenharmony_ci  int			use_exposure_time_def_r;				    /* exposure time default */
351141cc406Sopenharmony_ci  int			use_exposure_time_def_g;				    /* exposure time default */
352141cc406Sopenharmony_ci  int			use_exposure_time_def_b;				    /* exposure time default */
353141cc406Sopenharmony_ci
354141cc406Sopenharmony_ci  int			wdb_len;						   /* use this length of WDB */
355141cc406Sopenharmony_ci  unsigned int		width_in_pixels;				 /* that's the wanted width in pixels */
356141cc406Sopenharmony_ci  unsigned int		length_in_pixels;				/* that's the wanted length in pixels */
357141cc406Sopenharmony_ci  unsigned int		scanwidth;		       /* that's the width in pixels at x_coordinate_base dpi */
358141cc406Sopenharmony_ci  unsigned int		scanlength;		      /* that's the length in pixels at y_coordinate_base dpi */
359141cc406Sopenharmony_ci  unsigned int		bytes_per_color;					     /* bytes per each color */
360141cc406Sopenharmony_ci
361141cc406Sopenharmony_ci  unsigned int		x_resolution;					     /* scan-resolution for x in dpi */
362141cc406Sopenharmony_ci  unsigned int		y_resolution;					     /* scan-resolution for y in dpi */
363141cc406Sopenharmony_ci  double		scale_x;					  /* x-scaling of optical resolution */
364141cc406Sopenharmony_ci  double		scale_y;					  /* y-scaling of optical resolution */
365141cc406Sopenharmony_ci  int			upper_left_x;			     /* that's the left edge in points at 1200pt/inch */
366141cc406Sopenharmony_ci  int			upper_left_y;			      /* that's the top edge in points at 1200pt/inch */
367141cc406Sopenharmony_ci
368141cc406Sopenharmony_ci  unsigned int		x_coordinate_base;			      /* x base in pixels/inch, normally 1200 */
369141cc406Sopenharmony_ci  unsigned int		y_coordinate_base;			      /* y base in pixels/inch, normally 1200 */
370141cc406Sopenharmony_ci
371141cc406Sopenharmony_ci  unsigned int		bits_per_pixel;						 /* number of bits per pixel */
372141cc406Sopenharmony_ci  int			bits_per_pixel_code;				/* 1 = 24bpp, 4 = 30 bpp, 8 = 36 bpp */
373141cc406Sopenharmony_ci  int			gamma_input_bits_code;				/* 1 = 24bpp, 4 = 30 bpp, 8 = 36 bpp */
374141cc406Sopenharmony_ci  int			set_auto;					    /* 0 or 1, don't know what it is */
375141cc406Sopenharmony_ci  int			preview;							     /* 1 if preview */
376141cc406Sopenharmony_ci  int			batch_scan;					  /* 1 = batch scan, 0 = normal scan */
377141cc406Sopenharmony_ci  int			batch_end;						  /* 1 = reposition scanhead */
378141cc406Sopenharmony_ci  int			batch_next_tl_y;			  /* top left y position for next batch scan */
379141cc406Sopenharmony_ci  int			quality;					/* 1 = quality_calibration, 0 = fast */
380141cc406Sopenharmony_ci  int			reverse;					      /* 1: exchange black and white */
381141cc406Sopenharmony_ci  int			reverse_multi;						   /* 1: invert color values */
382141cc406Sopenharmony_ci  int			WD_speed;				       /* is a combination of slow and smear */
383141cc406Sopenharmony_ci  int			slow;							       /* 1: slow scan speed */
384141cc406Sopenharmony_ci  int			smear;				       /* 1: don't care about image smearing problem */
385141cc406Sopenharmony_ci  int			dor;								/* double resolution */
386141cc406Sopenharmony_ci  int			cbhs_range;					       /* 50,255 or 255+autoexposure */
387141cc406Sopenharmony_ci  int			fix_focus_position;					       /* fix focus position */
388141cc406Sopenharmony_ci  int			lens_cal_in_doc_pos;			    /* lens calibration in document position */
389141cc406Sopenharmony_ci  int			disable_pre_focus;						/* disable pre focus */
390141cc406Sopenharmony_ci  int			holder_focus_pos_0mm;			    /* 0.6mm <-> 0.0mm holder focus position */
391141cc406Sopenharmony_ci  int			manual_focus;					       /* automatic <-> manual focus */
392141cc406Sopenharmony_ci  int			warmup;								 /* 1=set warmup-bit */
393141cc406Sopenharmony_ci  int			module;							  /* flatbed or transparency */
394141cc406Sopenharmony_ci  int			adf;							       /* 1 if ADF turned on */
395141cc406Sopenharmony_ci  int			uta;							       /* 1 if UTA turned on */
396141cc406Sopenharmony_ci  int			calibration;			      /* calibration :0=ignore, 1=driver, 2=by image */
397141cc406Sopenharmony_ci  int			low_byte_first;			 /* 10 bit mode: 0=high byte first, 1=low byte first */
398141cc406Sopenharmony_ci  int			colormode;				     /* LINEART, HALFTONE, GRAYSCALE or RGB  */
399141cc406Sopenharmony_ci#  define LINEART             1
400141cc406Sopenharmony_ci#  define HALFTONE            2
401141cc406Sopenharmony_ci#  define GRAYSCALE           3
402141cc406Sopenharmony_ci#  define RGB_LINEART         4
403141cc406Sopenharmony_ci#  define RGB_HALFTONE        5
404141cc406Sopenharmony_ci#  define RGB                 6
405141cc406Sopenharmony_ci
406141cc406Sopenharmony_ci  int			exposure_time_calibration_r;			/* red exposure time for calibration */
407141cc406Sopenharmony_ci  int			exposure_time_calibration_g;		      /* green exposure time for calibration */
408141cc406Sopenharmony_ci  int			exposure_time_calibration_b;		       /* blue exposure time for calibration */
409141cc406Sopenharmony_ci  int			exposure_time_scan_r;				       /* red exposure time for scan */
410141cc406Sopenharmony_ci  int			exposure_time_scan_g;				     /* green exposure time for scan */
411141cc406Sopenharmony_ci  int			exposure_time_scan_b;				       /* bue exposure time for scan */
412141cc406Sopenharmony_ci
413141cc406Sopenharmony_ci  int			c_density;					    /* next calibration lamp density */
414141cc406Sopenharmony_ci  int			s_density;						   /* next scan lamp density */
415141cc406Sopenharmony_ci
416141cc406Sopenharmony_ci  int			threshold;						/* (128) 0-255, lineart mode */
417141cc406Sopenharmony_ci  int			brightness;				    /* (128) cbhs_range 0-255, halftone mode */
418141cc406Sopenharmony_ci  int			contrast;				    /* (128) cbhs_range 0-255, halftone-mode */
419141cc406Sopenharmony_ci  int			highlight_r;					/* (255) cbhs_range 1-255, each mode */
420141cc406Sopenharmony_ci  int			highlight_g;					/* (255) cbhs_range 1-255, each mode */
421141cc406Sopenharmony_ci  int			highlight_b;					/* (255) cbhs_range 1-255, each mode */
422141cc406Sopenharmony_ci  int			shadow_r;					  /* (0) cbhs_range 0-254, each mode */
423141cc406Sopenharmony_ci  int			shadow_g;					  /* (0) cbhs_range 0-254, each mode */
424141cc406Sopenharmony_ci  int			shadow_b;					  /* (0) cbhs_range 0-254, each mode */
425141cc406Sopenharmony_ci  int			halftone;						  /* halftone pattern select */
426141cc406Sopenharmony_ci
427141cc406Sopenharmony_ci  int			digital_gamma_r;				    /* gamma-select for red and gray */
428141cc406Sopenharmony_ci  int			digital_gamma_g;				     /* gamma-select value for green */
429141cc406Sopenharmony_ci  int			digital_gamma_b;				      /* gamma-select value for blue */
430141cc406Sopenharmony_ci
431141cc406Sopenharmony_ci  int			analog_gamma_r;						/* analog gamma red and gray */
432141cc406Sopenharmony_ci  int			analog_gamma_g;						       /* analog gamma green */
433141cc406Sopenharmony_ci  int			analog_gamma_b;							/* analog gamma blue */
434141cc406Sopenharmony_ci
435141cc406Sopenharmony_ci  int			calib_lines;						/* request calibration lines */
436141cc406Sopenharmony_ci
437141cc406Sopenharmony_ci  int			do_calibration;					      /* 1: do calibration by driver */
438141cc406Sopenharmony_ci  int			do_color_ordering;				 /* 1: order line-mode to pixel-mode */
439141cc406Sopenharmony_ci
440141cc406Sopenharmony_ci  int			button0_pressed;			 /* scan-button 0 on scanner is pressed => 1 */
441141cc406Sopenharmony_ci  int			button1_pressed;			 /* scan-button 1 on scanner is pressed => 1 */
442141cc406Sopenharmony_ci  int			button2_pressed;			 /* scan-button 2 on scanner is pressed => 1 */
443141cc406Sopenharmony_ci
444141cc406Sopenharmony_ci  int			calibration_area;		      /* define calibration area if no area is given */
445141cc406Sopenharmony_ci  int                   calibration_width_offset;  /* some scanners do calibrate with some additional pixels */
446141cc406Sopenharmony_ci  int                   calibration_width_offset_batch;			      /* the same for batch scanning */
447141cc406Sopenharmony_ci  int                   calibration_bytespp;		   /* correction of bytespp if driver knows about it */
448141cc406Sopenharmony_ci  int                   exposure_time_rgb_bind;		  /* exposure time can not be defined for each color */
449141cc406Sopenharmony_ci  int			invert_shading_data;	     /* invert shading data before sending it to the scanner */
450141cc406Sopenharmony_ci  int                   common_xy_resolutions;			/* do not allow different x and y resolution */
451141cc406Sopenharmony_ci  int			pause_for_color_calibration;	/* pause between start_scan and do_calibration in ms */
452141cc406Sopenharmony_ci  int			pause_for_gray_calibration;	/* pause between start_scan and do_calibration in ms */
453141cc406Sopenharmony_ci  int			pause_after_calibration;	 /* pause between do_calibration and read data in ms */
454141cc406Sopenharmony_ci  int			pause_after_reposition;				    /* pause for repositioning in ms */
455141cc406Sopenharmony_ci  int			pause_for_moving;	       /* pause for moving scanhead over full scanarea in ms */
456141cc406Sopenharmony_ci  int			lamp_control_available;		       /* is set when scanner supportes lamp control */
457141cc406Sopenharmony_ci  int			gamma_lsb_padded;                              /* 16 bit gamma data is padded to lsb */
458141cc406Sopenharmony_ci  int			force_quality_calibration;			   /* always set quality calibration */
459141cc406Sopenharmony_ci} Umax_Device;
460141cc406Sopenharmony_ci
461141cc406Sopenharmony_ci
462141cc406Sopenharmony_ci/* --------------------------------------------------------------------------------------------------------- */
463141cc406Sopenharmony_ci
464141cc406Sopenharmony_ci
465141cc406Sopenharmony_ci/* LIST OF OPEND DEVICES, A DEVICE MAY BE OPEND TWICE, ALL VALUES LISTED HERE MAY BE
466141cc406Sopenharmony_ci   DIFFERENT FOR DIFFERENT APPLICATIONS */
467141cc406Sopenharmony_ci
468141cc406Sopenharmony_ci/* Umax_Scanner contains values relevant for the sane interface */
469141cc406Sopenharmony_ci
470141cc406Sopenharmony_citypedef struct Umax_Scanner
471141cc406Sopenharmony_ci{
472141cc406Sopenharmony_ci  struct Umax_Scanner		*next;
473141cc406Sopenharmony_ci  Umax_Device			*device;
474141cc406Sopenharmony_ci
475141cc406Sopenharmony_ci  SANE_Option_Descriptor	opt[NUM_OPTIONS];
476141cc406Sopenharmony_ci  Option_Value			val[NUM_OPTIONS];
477141cc406Sopenharmony_ci  SANE_Int			*gamma_table[4];
478141cc406Sopenharmony_ci  SANE_Int			halftone_pattern[64];
479141cc406Sopenharmony_ci  SANE_Range			gamma_range;
480141cc406Sopenharmony_ci  unsigned int			gamma_length;
481141cc406Sopenharmony_ci  SANE_Range			output_range;
482141cc406Sopenharmony_ci  unsigned int			output_bytes;
483141cc406Sopenharmony_ci  SANE_Range			exposure_time_range;
484141cc406Sopenharmony_ci
485141cc406Sopenharmony_ci  int				scanning;
486141cc406Sopenharmony_ci  SANE_Parameters		params;
487141cc406Sopenharmony_ci
488141cc406Sopenharmony_ci  SANE_Pid			reader_pid;
489141cc406Sopenharmony_ci  int				pipe_read_fd;
490141cc406Sopenharmony_ci  int				pipe_write_fd;
491141cc406Sopenharmony_ci} Umax_Scanner;
492141cc406Sopenharmony_ci
493141cc406Sopenharmony_ci
494141cc406Sopenharmony_ci/* --------------------------------------------------------------------------------------------------------- */
495141cc406Sopenharmony_ci
496141cc406Sopenharmony_ci
497141cc406Sopenharmony_ci#endif /* umax-sane_h */
498