1 /* HP Scanjet 3900 series - RTS8822 internal config
2 
3    Copyright (C) 2005-2009 Jonathan Bravo Lopez <jkdsoft@gmail.com>
4 
5    This file is part of the SANE package.
6 
7    This program is free software; you can redistribute it and/or
8    modify it under the terms of the GNU General Public License
9    as published by the Free Software Foundation; either version 2
10    of the License, or (at your option) any later version.
11 
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16 
17    You should have received a copy of the GNU General Public License
18    along with this program.  If not, see <https://www.gnu.org/licenses/>.
19 
20    As a special exception, the authors of SANE give permission for
21    additional uses of the libraries contained in this release of SANE.
22 
23    The exception is that, if you link a SANE library with other files
24    to produce an executable, this does not by itself cause the
25    resulting executable to be covered by the GNU General Public
26    License.  Your use of that executable is in no way restricted on
27    account of linking the SANE library code into it.
28 
29    This exception does not, however, invalidate any other reasons why
30    the executable file might be covered by the GNU General Public
31    License.
32 
33    If you submit changes to SANE to the maintainers to be included in
34    a subsequent release, you agree by submitting the changes that
35    those changes may be distributed with this exception intact.
36 
37    If you write modifications of your own for SANE, it is your choice
38    whether to permit this exception to apply to your modifications.
39    If you do not wish that, delete this exception notice.
40 */
41 
42 /* returns device model according to given product and vendor id's */
43 static SANE_Int cfg_device_get(SANE_Int product, SANE_Int vendor);
44 
45 /* returns information and capabilities about selected chipset model */
46 static SANE_Int cfg_chipset_get(SANE_Int model, struct st_chip *chipset);
47 
48 /* returns the chipset model for each scanner */
49 static SANE_Int cfg_chipset_model_get(SANE_Int device);
50 
51 /* buttons for each scanner */
52 static SANE_Int cfg_buttons_get(struct st_buttons *reg);
53 
54 /* area constraints for each scanner */
55 static SANE_Int cfg_constrains_get(struct st_constrains *constrain);
56 
57 /* spectrum clock generator for each scanner */
58 static SANE_Int cfg_sscg_get(SANE_Int *enable, SANE_Int *mode, SANE_Int *clock);
59 
60 /* motor general configuration for each scanner */
61 static SANE_Int cfg_motor_get(struct st_motorcfg *reg);
62 
63 /* motor resource for each scanner */
64 static SANE_Byte *cfg_motor_resource_get(SANE_Byte *size);
65 
66 /* sensor general configuration for each scanner */
67 static SANE_Int cfg_sensor_get(struct st_sensorcfg *reg);
68 
69 /* reference voltages for each scanner */
70 static void cfg_refvoltages_get(SANE_Int sensortype, SANE_Byte *vrts, SANE_Byte *vrms, SANE_Byte *vrbs);
71 static void hp3800_refvoltages(SANE_Int usb, SANE_Int sensor, SANE_Byte *vrts, SANE_Byte *vrms, SANE_Byte *vrbs);
72 static void hp3970_refvoltages(SANE_Int usb, SANE_Int sensor, SANE_Byte *vrts, SANE_Byte *vrms, SANE_Byte *vrbs);
73 
74 /* offset calibration start and length */
75 static void cfg_offset_get(SANE_Int sensortype, SANE_Int resolution, SANE_Int scantype, SANE_Int *left, SANE_Int *width);
76 static void ua4900_offset(SANE_Int resolution, SANE_Int scantype, SANE_Int *left, SANE_Int *width);
77 static void hp3800_offset(SANE_Int resolution, SANE_Int scantype, SANE_Int *left, SANE_Int *width);
78 static void hp3970_offset(SANE_Int sensor, SANE_Int resolution, SANE_Int scantype, SANE_Int *left, SANE_Int *width);
79 static void hp4370_offset(SANE_Int resolution, SANE_Int scantype, SANE_Int *left, SANE_Int *width);
80 
81 /* autoref configuration */
82 static void cfg_autoref_get(struct st_autoref *reg);
83 
84 /* autoref start effective pixel */
85 static SANE_Int cfg_effectivepixel_get(SANE_Int sensortype, SANE_Int resolution);
86 static SANE_Int ua4900_effectivepixel(SANE_Int resolution);
87 static SANE_Int hp3800_effectivepixel(SANE_Int resolution);
88 static SANE_Int hp3970_effectivepixel(SANE_Int sensor, SANE_Int resolution);
89 static SANE_Int hp4370_effectivepixel(SANE_Int resolution);
90 
91 /* default values for gain and offset */
92 static SANE_Int cfg_gainoffset_get(SANE_Int sensortype, struct st_gain_offset *reg);
93 static SANE_Int bq5550_gainoffset(SANE_Int usb, struct st_gain_offset *myreg);
94 static SANE_Int ua4900_gainoffset(SANE_Int usb, struct st_gain_offset *myreg);
95 static SANE_Int hp3800_gainoffset(SANE_Int usb, struct st_gain_offset *myreg);
96 static SANE_Int hp3970_gainoffset(SANE_Int usb, SANE_Int sensor, struct st_gain_offset *myreg);
97 static SANE_Int hp4370_gainoffset(SANE_Int usb, struct st_gain_offset *myreg);
98 
99 /* values to detect optimum pulse-width modulation */
100 static SANE_Int cfg_checkstable_get(SANE_Int lamp, struct st_checkstable *check);
101 static SANE_Int ua4900_checkstable(SANE_Int lamp, struct st_checkstable *check);
102 static SANE_Int hp3800_checkstable(SANE_Int lamp, struct st_checkstable *check);
103 static SANE_Int hp3970_checkstable(SANE_Int lamp, struct st_checkstable *check);
104 static SANE_Int hp4370_checkstable(SANE_Int lamp, struct st_checkstable *check);
105 
106 /* fixed pulse-width modulation values */
107 static SANE_Int cfg_fixedpwm_get(SANE_Int sensortype, SANE_Int scantype);
108 static SANE_Int ua4900_fixedpwm(SANE_Int scantype, SANE_Int usb);
109 static SANE_Int hp3800_fixedpwm(SANE_Int scantype, SANE_Int usb);
110 static SANE_Int hp3970_fixedpwm(SANE_Int scantype, SANE_Int usb, SANE_Int sensor);
111 static SANE_Int hp4370_fixedpwm(SANE_Int scantype, SANE_Int usb);
112 
113 /* virtual origin (ser and ler references) */
114 static void cfg_vrefs_get(SANE_Int sensortype, SANE_Int res, SANE_Int *ser, SANE_Int *ler);
115 static void hp3800_vrefs(SANE_Int res, SANE_Int *ser, SANE_Int *ler);
116 static void hp3970_vrefs(SANE_Int usb, SANE_Int sensor, SANE_Int res, SANE_Int *ser, SANE_Int *ler);
117 static void hp4370_vrefs(SANE_Int res, SANE_Int *ser, SANE_Int *ler);
118 
119 /* scanmodes supported by each scanner */
120 static SANE_Int cfg_scanmode_get(SANE_Int sensortype, SANE_Int sm, struct st_scanmode *mymode);
121 static SANE_Int bq5550_scanmodes(SANE_Int usb, SANE_Int sm, struct st_scanmode *mymode);
122 static SANE_Int ua4900_scanmodes(SANE_Int usb, SANE_Int sm, struct st_scanmode *mymode);
123 static SANE_Int hp3800_scanmodes(SANE_Int usb, SANE_Int sm, struct st_scanmode *mymode);
124 static SANE_Int hp3970_scanmodes(SANE_Int usb, SANE_Int ccd, SANE_Int sm, struct st_scanmode *mymode);
125 static SANE_Int hp4370_scanmodes(SANE_Int usb, SANE_Int sm, struct st_scanmode *mymode);
126 
127 /* timing values for ccd sensors */
128 static SANE_Int cfg_timing_get(SANE_Int sensortype, SANE_Int tm, struct st_timing *reg);
129 static SANE_Int bq5550_timing_get(SANE_Int tm, struct st_timing *reg);
130 static SANE_Int ua4900_timing_get(SANE_Int tm, struct st_timing *reg);
131 static SANE_Int hp3800_timing_get(SANE_Int tm, struct st_timing *reg);
132 static SANE_Int hp3970_timing_get(SANE_Int sensortype, SANE_Int tm, struct st_timing *reg);
133 static SANE_Int hp4370_timing_get(SANE_Int tm, struct st_timing *reg);
134 
135 /* motor movements */
136 static SANE_Int cfg_motormove_get(SANE_Int sensortype, SANE_Int mm, struct st_motormove *reg);
137 static SANE_Int bq5550_motormove(SANE_Int item, struct st_motormove *reg);
138 static SANE_Int hp3800_motormove(SANE_Int item, struct st_motormove *reg);
139 static SANE_Int hp3970_motormove(SANE_Int usb, SANE_Int ccd, SANE_Int item, struct st_motormove *reg);
140 
141 /* motor curves */
142 static SANE_Int *cfg_motorcurve_get(void);
143 static SANE_Int *bq5550_motor(void);
144 static SANE_Int *hp3800_motor(void);
145 static SANE_Int *hp3970_motor(void);
146 static SANE_Int *hp4370_motor(void);
147 
148 /* shading cut values */
149 static void cfg_shading_cut_get(SANE_Int sensortype, SANE_Int depth, SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue);
150 static void ua4900_shading_cut(SANE_Int usb, SANE_Int depth, SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue);
151 static void hp3800_shading_cut(SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue);
152 static void hp3970_shading_cut(SANE_Int usb, SANE_Int ccd, SANE_Int depth, SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue);
153 static void hp4370_shading_cut(SANE_Int depth, SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue);
154 
155 /* wrefs values */
156 static void cfg_wrefs_get(SANE_Int sensortype, SANE_Int depth, SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue);
157 static void ua4900_wrefs(SANE_Int usb, SANE_Int depth, SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue);
158 static void hp3800_wrefs(SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue);
159 static void hp3970_wrefs(SANE_Int usb, SANE_Int ccd, SANE_Int depth, SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue);
160 static void hp4370_wrefs(SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue);
161 
162 
163 /* DEPRECATED FUNCTIONS !!!!!!!!!!!!!!!!!!! */
164 
165 
166 static int get_value(int section, int option, int defvalue, int file);
167 
168 /* HP Scanjet 3800 */
169 static int hp3800_calibreflective(int option, int defvalue);
170 static int hp3800_calibtransparent(int option, int defvalue);
171 static int hp3800_calibnegative(int option, int defvalue);
172 static int srt_hp3800_scanparam_get(int option, int defvalue);
173 
174 /* UMAX Astra 4900 */
175 static int ua4900_calibreflective(int option, int defvalue);
176 static int ua4900_calibtransparent(int option, int defvalue);
177 static int ua4900_calibnegative(int option, int defvalue);
178 
179 /* HP Scanjet 3970 */
180 static int hp3970_calibreflective(int option, int defvalue);
181 static int hp3970_calibtransparent(int option, int defvalue);
182 static int hp3970_calibnegative(int option, int defvalue);
183 static int srt_hp3970_scanparam_get(int file, int option, int defvalue);
184 static int srt_hp3970_platform_get(int option, int defvalue);
185 
186 /* HP Scanjet 4370 */
187 static int hp4370_calibreflective(int option, int defvalue);
188 static int hp4370_calibtransparent(int option, int defvalue);
189 static int hp4370_calibnegative(int option, int defvalue);
190 static int srt_hp4370_scanparam_get(int file, int option, int defvalue);
191 
192 /* HP Scanjet g3110 */
193 static int hpg3110_calibnegative(int option, int defvalue);
194 static int hpg3110_calibtransparent(int option, int defvalue);
195 
196 /* ----- Implementation ----- */
197 
198 /* DEPRECATED enumerations */
199 
200 enum ConfigFiles
201 {
202 	FITCALIBRATE=0,
203 
204 	T_RTINIFILE, T_USB1INIFILE,
205 	S_RTINIFILE, S_USB1INIFILE
206 };
207 
208 enum fcsec6
209 {
210 	CALIBREFLECTIVE = 0, CALIBTRANSPARENT, CALIBNEGATIVEFILM,
211 
212 	SCANINFO,
213 	SCAN_CALI,
214 
215 	WSTRIPXPOS, WSTRIPYPOS,
216 	BSTRIPXPOS, BSTRIPYPOS,
217 
218 	BREFR, BREFG, BREFB,
219 
220 	REFBITDEPTH,
221 	OFFSETHEIGHT,
222 
223 	OFFSETNSIGMA, OFFSETTARGETMAX, OFFSETTARGETMIN,
224 	OFFSETAVGTARGETR, OFFSETAVGTARGETG, OFFSETAVGTARGETB,
225 
226 	ADCOFFEVENODD,
227 	CALIBOFFSET1ON,
228 
229 	ADCOFFQUICKWAY, ADCOFFPREDICTSTART, ADCOFFPREDICTEND,
230 
231 	OFFSETTUNESTEP1, OFFSETBOUNDARYRATIO1, OFFSETAVGRATIO1,
232 
233 	OFFSETEVEN1R, OFFSETEVEN1G, OFFSETEVEN1B,
234 	OFFSETODD1R,  OFFSETODD1G,  OFFSETODD1B,
235 
236 	ADCOFFPREDICTR,   ADCOFFPREDICTG,   ADCOFFPREDICTB,
237 	ADCOFFEVEN1R_1ST, ADCOFFEVEN1G_1ST, ADCOFFEVEN1B_1ST,
238 	ADCOFFODD1R_1ST,	ADCOFFODD1G_1ST,	ADCOFFODD1B_1ST,
239 
240 	PEAKR, PEAKG, PEAKB,
241 	MINR, MING, MINB,
242 
243 	CALIBOFFSET2ON,
244 	OFFSETTUNESTEP2, OFFSETBOUNDARYRATIO2, OFFSETAVGRATIO2,
245 
246 	OFFSETEVEN2R, OFFSETEVEN2G, OFFSETEVEN2B,
247 	OFFSETODD2R,  OFFSETODD2G,  OFFSETODD2B,
248 
249 	GAINHEIGHT, GAINTARGETFACTOR,
250 
251 	CALIBPAGON,
252 
253 	HIPAGR, HIPAGG, HIPAGB,
254 	LOPAGR, LOPAGG, LOPAGB,
255 	PAGR, PAGG, PAGB,
256 
257 	CALIBGAIN1ON, GAIN1R, GAIN1G, GAIN1B,
258 	CALIBGAIN2ON, GAIN2R, GAIN2G, GAIN2B,
259 
260 	TOTSHADING,
261 
262 	BSHADINGON, BSHADINGHEIGHT, BSHADINGPREDIFFR, BSHADINGPREDIFFG, BSHADINGPREDIFFB,
263 	BSHADINGDEFCUTOFF,
264 	WSHADINGON, WSHADINGHEIGHT, WSHADINGPREDIFFR, WSHADINGPREDIFFG, WSHADINGPREDIFFB,
265 
266 	PARKHOMEAFTERCALIB,
267 
268 	SHADINGTIME_16BIT, SHADOWTIME_16BIT, SHADINGTIME_8BIT, SHADOWTIME_8BIT,
269 	PREVIEWDPI,
270 
271 	FIRSTDCOFFSETEVEN0, FIRSTDCOFFSETODD0, FIRSTDCOFFSETEVEN1,
272 	FIRSTDCOFFSETODD1, FIRSTDCOFFSETEVEN2, FIRSTDCOFFSETODD2,
273 
274 	CALIBOFFSET10N, CALIBOFFSET20N,
275 	CALIBGAIN10N, CALIBGAIN20N,
276 	ARRANGELINE,
277 	COMPRESSION,
278 
279 	TA_X_START, TA_Y_START,
280 
281 	DPIGAINCONTROL600,
282 	DPIGAINCONTROL_TA600,
283 	DPIGAINCONTROL_NEG600,
284 
285 	CRVS, MLOCK,
286 	ENABLEWARMUP,
287 
288 	NMAXTARGET, NMINTARGET,
289 	NMAXTARGETTA, NMINTARGETTA,
290 	NMAXTARGETNEG, NMINTARGETNEG,
291 
292 	STABLEDIFF,
293 	DELTAPWM,
294 
295 	PWMLAMPLEVEL,
296 
297 	TMAPWMDUTY,
298 
299 	PAG1, PAG2, PAG3,
300 
301 	LEFTLEADING,
302 
303 	WAVE_XSTART,
304 
305 	WAVE_S575_XDUMMY_2400, WAVE_S575_XDUMMY_1200, WAVE_S575_XDUMMY_600,
306 
307 	ODD_DCOFFSET11, ODD_DCOFFSET12, ODD_DCOFFSET13,
308 	ODD_DCOFFSET21, ODD_DCOFFSET22, ODD_DCOFFSET23,
309 
310 	EVEN_DCOFFSET11, EVEN_DCOFFSET12, EVEN_DCOFFSET13,
311 	EVEN_DCOFFSET21, EVEN_DCOFFSET22, EVEN_DCOFFSET23,
312 
313 	DCGAIN11, DCGAIN12, DCGAIN13,
314 	DCGAIN21, DCGAIN22, DCGAIN23,
315 
316 	CRYSTALFREQ,
317 
318 	PGA1, PGA2, PGA3,
319 
320 	VGAGAIN11, VGAGAIN12, VGAGAIN13,
321 
322 	DCSTEPEVEN1, DCSTEPODD1,
323 	DCSTEPEVEN2, DCSTEPODD2,
324 	DCSTEPEVEN3, DCSTEPODD3,
325 
326 	FIRSTDCOFFSETEVEN11, FIRSTDCOFFSETODD11,
327 	FIRSTDCOFFSETEVEN12, FIRSTDCOFFSETODD12,
328 	FIRSTDCOFFSETEVEN13, FIRSTDCOFFSETODD13,
329 
330 	DCOFFSETEVEN11, DCOFFSETODD11,
331 	DCOFFSETEVEN12, DCOFFSETODD12,
332 	DCOFFSETEVEN13, DCOFFSETODD13,
333 
334 	SHADINGBASE, SHADINGFACT1, SHADINGFACT2, SHADINGFACT3,
335 
336 	PIXELDARKLEVEL,
337 
338 	EXPOSURETIME,
339 	SCANYSTART, SCANYLINES,
340 
341 	BINARYTHRESHOLDH, BINARYTHRESHOLDL,
342 	CLOSETIME,
343 	PLATFORM,
344 	SCAN_PARAM,
345 	USB1_PWM, USB2_PWM,
346 	WAVETEST,
347 	DMA_PARAM,
348 	TRUE_GRAY_PARAM,
349 	CALI_PARAM,
350 	DUMMYLINE,
351 
352 	MEXPT1, MEXPT2, MEXPT3,
353 	EXPT1, EXPT2, EXPT3,
354 
355 	STARTPOS,
356 	LINEDARLAMPOFF,
357 	MCLKIOC
358 };
359 
cfg_device_get(SANE_Int product,SANE_Int vendor)360 static SANE_Int cfg_device_get(SANE_Int product, SANE_Int vendor)
361 {
362 	struct st_myreg
363 	{
364 		SANE_Int vendor, product, device;
365 	};
366 
367 	struct st_myreg myreg[] =
368 	{
369 		/*vendor, prodct, device */
370 		{  0x4a5, 0x2211, BQ5550 }, /* BenQ 5550                  */
371 		{  0x6dc, 0x0020, UA4900 }, /* UMAX Astra 4900            */
372 		{  0x3f0, 0x2605, HP3800 }, /* HP Scanjet 3800            */
373 		{  0x3f0, 0x2805, HPG2710}, /* HP Scanjet G2710           */
374 		{  0x3f0, 0x2305, HP3970 }, /* HP Scanjet 3970c           */
375 		{  0x3f0, 0x2405, HP4070 }, /* HP Scanjet 4070 Photosmart */
376 		{  0x3f0, 0x4105, HP4370 }, /* HP Scanjet 4370            */
377 		{  0x3f0, 0x4205, HPG3010}, /* HP Scanjet G3010           */
378 		{  0x3f0, 0x4305, HPG3110}  /* HP Scanjet G3010           */
379 	};
380 
381 	SANE_Int rst = -1; /* default */
382 	SANE_Int a;
383 	SANE_Int count = sizeof(myreg) / sizeof(struct st_myreg);
384 
385 	for (a = 0; a < count; a++)
386 	{
387 		if ((vendor == myreg[a].vendor)&&(product == myreg[a].product))
388 		{
389 			rst = myreg[a].device;
390 
391 			break;
392 		}
393 	}
394 
395 	return rst;
396 }
397 
cfg_chipset_model_get(SANE_Int device)398 static SANE_Int cfg_chipset_model_get(SANE_Int device)
399 {
400 	/* returns the chipset model for each scanner */
401 	struct st_myreg
402 	{
403 		SANE_Int device, chipset;
404 	};
405 
406 	struct st_myreg myreg[] =
407 	{
408 		/*device , chipset      */
409 		{ HP3800 , RTS8822BL_03A },
410 		{ HPG2710, RTS8822BL_03A },
411 		{ BQ5550 , RTS8823L_01E  },
412 		{ UA4900 , RTS8822L_01H  },
413 		{ HP3970 , RTS8822L_01H  },
414 		{ HP4070 , RTS8822L_01H  },
415 		{ HP4370 , RTS8822L_02A  },
416 		{ HPG3010, RTS8822L_02A  },
417 		{ HPG3110, RTS8822L_02A  }
418 	};
419 
420 	SANE_Int rst = RTS8822L_01H; /* default */
421 	SANE_Int a;
422 	SANE_Int count = sizeof(myreg) / sizeof(struct st_myreg);
423 
424 	for (a = 0; a < count; a++)
425 	{
426 		if (device == myreg[a].device)
427 		{
428 			rst = myreg[a].chipset;
429 
430 			break;
431 		}
432 	}
433 
434 	return rst;
435 }
436 
cfg_chipset_get(SANE_Int model,struct st_chip * chipset)437 static SANE_Int cfg_chipset_get(SANE_Int model, struct st_chip *chipset)
438 {
439 	/* returns info and capabilities of selected chipset */
440 	SANE_Int rst = ERROR;
441 
442 	if (chipset != NULL)
443 	{
444 		struct st_chip data[] =
445 		{
446 			/* model      , capabilities, name            */
447 			{RTS8823L_01E , 0           , "RTS8823L-01E" },
448 			{RTS8822BL_03A, CAP_EEPROM  , "RTS8822BL-03A"},
449 			{RTS8822L_02A , CAP_EEPROM  , "RTS8822L-02A" },
450 			{RTS8822L_01H , CAP_EEPROM  , "RTS8822L-01H" }
451 		};
452 
453 		SANE_Int a;
454 
455 		for (a = 0; a < 4; a++)
456 		{
457 			if (model == data[a].model)
458 			{
459 				/* model found, fill information */
460 				chipset->model = data[a].model;
461 				chipset->capabilities = data[a].capabilities;
462 				chipset->name = strdup(data[a].name);
463 
464 				if (chipset->name != NULL)
465 					rst = OK;
466 
467 				break;
468 			}
469 		}
470 	}
471 
472 	return rst;
473 }
474 
475 /** SEC: Device's Buttons ---------- */
476 
cfg_buttons_get(struct st_buttons * reg)477 static SANE_Int cfg_buttons_get(struct st_buttons *reg)
478 {
479 	/* buttons for each scanner */
480 	SANE_Int rst = ERROR;
481 
482 	if (reg != NULL)
483 	{
484 		struct st_myreg
485 		{
486 			SANE_Int device;
487 			struct st_buttons value;
488 		};
489 
490 		struct st_myreg myreg[] =
491 		{
492 			/*device, {count, {btn1, btn2, btn3, btn4, btn5, btn6)} */
493 			{ BQ5550 , {3    , {0x01, 0x02, 0x08,   -1,   -1,   -1}}},
494 			{ UA4900 , {4    , {0x04, 0x08, 0x02, 0x01,   -1,   -1}}},
495 			{ HP3800 , {3    , {0x01, 0x02, 0x04,   -1,   -1,   -1}}},
496 			{ HPG2710, {3    , {0x01, 0x02, 0x04,   -1,   -1,   -1}}},
497 			{ HP3970 , {4    , {0x04, 0x08, 0x02, 0x01,   -1,   -1}}},
498 			{ HP4070 , {4    , {0x04, 0x08, 0x02, 0x01,   -1,   -1}}},
499 			{ HP4370 , {4    , {0x04, 0x08, 0x02, 0x01,   -1,   -1}}},
500 			{ HPG3010, {4    , {0x04, 0x08, 0x02, 0x01,   -1,   -1}}},
501 			{ HPG3110, {4    , {0x04, 0x08, 0x02, 0x01,   -1,   -1}}}
502 		};
503 
504 		SANE_Int a;
505 		SANE_Int count = sizeof(myreg) / sizeof(struct st_myreg);
506 
507 		for (a = 0; a < count; a++)
508 		{
509 			if (RTS_Debug->dev_model == myreg[a].device)
510 			{
511 				memcpy(reg, &myreg[a].value, sizeof(struct st_buttons));
512 				rst = OK;
513 
514 				break;
515 			}
516 		}
517 	}
518 
519 	return rst;
520 }
521 
522 /** SEC: Spectrum clock generator ---------- */
523 
cfg_sscg_get(SANE_Int * enable,SANE_Int * mode,SANE_Int * clock)524 static SANE_Int cfg_sscg_get(SANE_Int *enable, SANE_Int *mode, SANE_Int *clock)
525 {
526 	SANE_Int rst = ERROR;
527 
528 	if ((enable != NULL)&&(mode != NULL)&&(clock != NULL))
529 	{
530 		struct st_myreg
531 		{
532 			SANE_Int device;
533 			SANE_Int value[3];
534 		};
535 
536 		struct st_myreg myreg[] =
537 		{
538 			/*device, {enable, mode, clock} */
539 			{ BQ5550, {1     ,    1,     1}},
540 			{ UA4900, {1     ,    1,     0}},
541 			{ HP3800, {1     ,    1,     0}},
542 			{HPG2710, {1     ,    1,     0}},
543 			{ HP3970, {1     ,    1,     0}},
544 			{ HP4070, {1     ,    1,     0}},
545 			{ HP4370, {1     ,    1,     0}},
546 			{HPG3010, {1     ,    1,     0}},
547 			{HPG3110, {1     ,    1,     0}}
548 		};
549 
550 		SANE_Int a;
551 		SANE_Int count = sizeof(myreg) / sizeof(struct st_myreg);
552 
553 		/* default values */
554 		*enable = 0;
555 		*mode   = 0;
556 		*clock  = 3;
557 
558 		for (a = 0; a < count; a++)
559 		{
560 			if (RTS_Debug->dev_model == myreg[a].device)
561 			{
562 				*enable = myreg[a].value[0];
563 				*mode   = myreg[a].value[1];
564 				*clock  = myreg[a].value[2];
565 				rst = OK;
566 
567 				break;
568 			}
569 		}
570 	}
571 	return rst;
572 }
573 
574 /** SEC: Motors ---------- */
575 
cfg_motor_get(struct st_motorcfg * reg)576 static SANE_Int cfg_motor_get(struct st_motorcfg *reg)
577 {
578 	SANE_Int rst = ERROR;
579 
580 	if (reg != NULL)
581 	{
582 		struct st_myreg
583 		{
584 			SANE_Int device;
585 			struct st_motorcfg motor;
586 		};
587 
588 		struct st_myreg myreg[] =
589 		{
590 			/*device, {type          ,  res, freq, speed, basemove, highmove, parkmove, change}} */
591 			{ BQ5550, {MT_OUTPUTSTATE, 1200,   30,   800,        1,        0,        0,   TRUE}},
592 			{ UA4900, {MT_OUTPUTSTATE, 2400,   30,   800,        1,        0,        0,   TRUE}},
593 			{ HP3800, {MT_OUTPUTSTATE, 1200,   30,   800,        1,        0,        0,   TRUE}},
594 			{HPG2710, {MT_OUTPUTSTATE, 1200,   30,   800,        1,        0,        0,   TRUE}},
595 			{ HP3970, {MT_OUTPUTSTATE, 2400,   30,   800,        1,        0,        0,   TRUE}},
596 			{ HP4070, {MT_OUTPUTSTATE, 2400,   30,   800,        1,        0,        0,   TRUE}},
597 			{ HP4370, {MT_OUTPUTSTATE, 2400,   30,   800,        1,        0,        0,   TRUE}},
598 			{HPG3010, {MT_OUTPUTSTATE, 2400,   30,   800,        1,        0,        0,   TRUE}},
599 			{HPG3110, {MT_OUTPUTSTATE, 2400,   30,   800,        1,        0,        0,   TRUE}}
600 		};
601 
602 		SANE_Int a;
603 		SANE_Int count = sizeof(myreg) / sizeof(struct st_myreg);
604 
605 		/* default values */
606 		memset(reg, 0, sizeof(struct st_motorcfg));
607 		reg->type = -1;
608 
609 		for (a = 0; a < count; a++)
610 		{
611 			if (RTS_Debug->dev_model == myreg[a].device)
612 			{
613 				memcpy(reg, &myreg[a].motor, sizeof(struct st_motorcfg));
614 				rst = OK;
615 
616 				break;
617 			}
618 		}
619 	}
620 
621 	return rst;
622 }
623 
624 /** SEC: Sensors ---------- */
625 
cfg_sensor_get(struct st_sensorcfg * reg)626 static SANE_Int cfg_sensor_get(struct st_sensorcfg *reg)
627 {
628 	SANE_Int rst = ERROR;
629 
630 	if (reg != NULL)
631 	{
632 		struct st_myreg
633 		{
634 			SANE_Int device;
635 			struct st_sensorcfg sensor;
636 		};
637 
638 		struct st_myreg myreg[] =
639 		{
640 			/*device, {type      , name   , resolution, {chnl_colors               }, {chnl_gray  }, {rgb_order                 }, line_dist, evenodd_dist} */
641 			{ BQ5550, {CCD_SENSOR,      -1, 1200      , {CL_BLUE, CL_GREEN, CL_RED }, {CL_GREEN, 0}, {CL_BLUE, CL_GREEN, CL_RED }, 24       , 4           }},
642 			{ UA4900, {CIS_SENSOR, SNYS575, 2400      , {CL_RED , CL_GREEN, CL_BLUE}, {CL_RED  , 0}, {CL_RED , CL_GREEN, CL_BLUE}, 24       , 0           }},
643 			{ HP3800, {CCD_SENSOR, TCD2905, 2400      , {CL_RED , CL_GREEN, CL_BLUE}, {CL_RED  , 0}, {CL_RED , CL_GREEN, CL_BLUE}, 64       , 8           }},
644 			{HPG2710, {CCD_SENSOR, TCD2905, 2400      , {CL_RED , CL_GREEN, CL_BLUE}, {CL_RED  , 0}, {CL_RED , CL_GREEN, CL_BLUE}, 64       , 8           }},
645 			{ HP3970, {CCD_SENSOR, TCD2952, 2400      , {CL_RED , CL_GREEN, CL_BLUE}, {CL_RED  , 0}, {CL_RED , CL_GREEN, CL_BLUE}, 24       , 4           }},
646 			{ HP4070, {CCD_SENSOR, TCD2952, 2400      , {CL_RED , CL_GREEN, CL_BLUE}, {CL_RED  , 0}, {CL_RED , CL_GREEN, CL_BLUE}, 24       , 4           }},
647 			{ HP4370, {CCD_SENSOR, TCD2958, 4800      , {CL_RED , CL_GREEN, CL_BLUE}, {CL_RED  , 0}, {CL_RED , CL_GREEN, CL_BLUE}, 128      , 6           }},
648 			{HPG3010, {CCD_SENSOR, TCD2958, 4800      , {CL_RED , CL_GREEN, CL_BLUE}, {CL_RED  , 0}, {CL_RED , CL_GREEN, CL_BLUE}, 128      , 6           }},
649 			{HPG3110, {CCD_SENSOR, TCD2958, 4800      , {CL_RED , CL_GREEN, CL_BLUE}, {CL_RED  , 0}, {CL_RED , CL_GREEN, CL_BLUE}, 128      , 6           }}
650 		};
651 
652 		SANE_Int a;
653 		SANE_Int count = sizeof(myreg) / sizeof(struct st_myreg);
654 
655 		/* default values */
656 		memset(reg, 0, sizeof(struct st_sensorcfg));
657 		reg->type = -1;
658 
659 		for (a = 0; a < count; a++)
660 		{
661 			if (RTS_Debug->dev_model == myreg[a].device)
662 			{
663 				memcpy(reg, &myreg[a].sensor, sizeof(struct st_sensorcfg));
664 				rst = OK;
665 
666 				break;
667 			}
668 		}
669 	}
670 
671 	return rst;
672 }
673 
674 /** SEC: Reference voltages ---------- */
675 
hp3800_refvoltages(SANE_Int usb,SANE_Int sensor,SANE_Byte * vrts,SANE_Byte * vrms,SANE_Byte * vrbs)676 static void hp3800_refvoltages(SANE_Int usb, SANE_Int sensor, SANE_Byte *vrts, SANE_Byte *vrms, SANE_Byte *vrbs)
677 {
678 	/* this function returns top, middle and bottom reference voltages for each scanner */
679 	struct st_reg
680 	{
681 		SANE_Int usb;
682 		SANE_Int sensor;
683 		SANE_Byte values[3];
684 	};
685 
686 	struct st_reg myreg[] =
687 	{
688 		/* usb, sensor    , {vrts, vrms, vrbs} */
689 		{USB20, CCD_SENSOR, {   2,    3,    2}},
690 		{USB11, CCD_SENSOR, {   2,    3,    2}},
691 	};
692 
693 	if ((vrts != NULL)&&(vrms != NULL)&&(vrbs != NULL))
694 	{
695 		SANE_Int a;
696 		SANE_Int count = sizeof(myreg) / sizeof(struct st_reg);
697 
698 		*vrts = *vrms = *vrbs = 0;
699 
700 		for (a = 0; a < count; a++)
701 		{
702 			if ((myreg[a].usb == usb)&&(myreg[a].sensor == sensor))
703 			{
704 				*vrts = myreg[a].values[0];
705 				*vrms = myreg[a].values[1];
706 				*vrbs = myreg[a].values[2];
707 			}
708 		}
709 	}
710 }
711 
hp3970_refvoltages(SANE_Int usb,SANE_Int sensor,SANE_Byte * vrts,SANE_Byte * vrms,SANE_Byte * vrbs)712 static void hp3970_refvoltages(SANE_Int usb, SANE_Int sensor, SANE_Byte *vrts, SANE_Byte *vrms, SANE_Byte *vrbs)
713 {
714 	/* this function returns top, middle and bottom reference voltages for each scanner */
715 	struct st_reg
716 	{
717 		SANE_Int usb;
718 		SANE_Int sensor;
719 		SANE_Byte values[3];
720 	};
721 
722 	struct st_reg myreg[] =
723 	{
724 		/* usb, sensor     , {vrts, vrms, vrbs} */
725 		{USB20, CCD_SENSOR, {   0,    0,    0}},
726 		{USB11, CCD_SENSOR, {   0,    0,    0}},
727 		{USB20, CIS_SENSOR, {   0,    0,    0}},
728 		{USB11, CIS_SENSOR, {   0,    0,    0}}
729 	};
730 
731 	if ((vrts != NULL)&&(vrms != NULL)&&(vrbs != NULL))
732 	{
733 		SANE_Int a;
734 		SANE_Int count = sizeof(myreg) / sizeof(struct st_reg);
735 
736 		*vrts = *vrms = *vrbs = 0;
737 
738 		for (a = 0; a < count; a++)
739 		{
740 			if ((myreg[a].usb == usb)&&(myreg[a].sensor == sensor))
741 			{
742 				*vrts = myreg[a].values[0];
743 				*vrms = myreg[a].values[1];
744 				*vrbs = myreg[a].values[2];
745 			}
746 		}
747 	}
748 }
749 
cfg_refvoltages_get(SANE_Int sensortype,SANE_Byte * vrts,SANE_Byte * vrms,SANE_Byte * vrbs)750 static void cfg_refvoltages_get(SANE_Int sensortype, SANE_Byte *vrts, SANE_Byte *vrms, SANE_Byte *vrbs)
751 {
752 	/* this function returns top, middle and bottom reference voltages for each scanner */
753 	switch(RTS_Debug->dev_model)
754 	{
755 		case HP3800:
756 		case HPG2710:
757 			hp3800_refvoltages(RTS_Debug->usbtype, sensortype, vrts, vrms, vrbs);
758 			break;
759 		default:
760 			/* at this momment all analyzed scanners have the same values */
761 			hp3970_refvoltages(RTS_Debug->usbtype, sensortype, vrts, vrms, vrbs);
762 			break;
763 	}
764 }
765 
766 /** SEC: Calibration Offset ---------- */
767 
hp3800_offset(SANE_Int resolution,SANE_Int scantype,SANE_Int * left,SANE_Int * width)768 static void hp3800_offset(SANE_Int resolution, SANE_Int scantype, SANE_Int *left, SANE_Int *width)
769 {
770 	/* this function provides left coordinate and width to calculate offset
771 	   Sensor = Toshiba T2905
772 	 */
773 
774 	struct st_ofst
775 	{
776 		SANE_Int left;
777 		SANE_Int width;
778 	};
779 
780 	struct st_reg
781 	{
782 		SANE_Int resolution;
783 		struct st_ofst values[3];
784 	};
785 
786 	struct st_reg myreg[] =
787 	{
788 		/*res , {ref(L,W), tma(L,W), neg(L,W)} */
789 		{ 2400, {{15, 20}, {15, 20}, {15, 20}}},
790 		{ 1200, {{10, 10}, {10, 10}, {10, 10}}},
791 		{  600, {{ 2, 10}, { 5, 10}, { 5, 10}}},
792 		{  300, {{ 1,  5}, { 1,  5}, { 1,  5}}},
793 		{  150, {{ 0,  3}, { 0,  3}, { 0,  3}}}
794 	};
795 
796 	if ((left != NULL)&&(width != NULL))
797 	{
798 		SANE_Int a;
799 		SANE_Int count = sizeof(myreg) / sizeof(struct st_reg);
800 
801 		for (a = 0; a < count; a++)
802 		{
803 			if (myreg[a].resolution == resolution)
804 			{
805 				scantype--;
806 
807 				*left  = myreg[a].values[scantype].left;
808 				*width = myreg[a].values[scantype].width;
809 
810 				break;
811 			}
812 		}
813 	}
814 }
815 
hp3970_offset(SANE_Int sensor,SANE_Int resolution,SANE_Int scantype,SANE_Int * left,SANE_Int * width)816 static void hp3970_offset(SANE_Int sensor, SANE_Int resolution, SANE_Int scantype, SANE_Int *left, SANE_Int *width)
817 {
818 	/* this function provides left coordinate and width to calculate offset */
819 
820 	struct st_ofst
821 	{
822 		SANE_Int left;
823 		SANE_Int width;
824 	};
825 
826 	struct st_reg
827 	{
828 		SANE_Int sensor;
829 		SANE_Int resolution;
830 		struct st_ofst values[3];
831 	};
832 
833 	struct st_reg myreg[] =
834 	{
835 		/* sensor   , res , {ref(L,W), tma(L,W), neg(L,W)} */
836 		{CCD_SENSOR, 2400, {{16, 20}, {16, 20}, {16, 20}}},
837 		{CCD_SENSOR, 1200, {{16, 10}, {16, 10}, {16, 10}}},
838 		{CCD_SENSOR,  600, {{15, 10}, {15, 10}, {15, 10}}},
839 		{CCD_SENSOR,  300, {{ 7,  5}, { 7,  5}, { 7,  5}}},
840 		{CCD_SENSOR,  200, {{ 7,  3}, { 7,  3}, { 7,  3}}},
841 		{CCD_SENSOR,  100, {{ 3,  3}, { 3,  3}, { 3,  3}}},
842 
843 		/* sensor  , res , {ref(L,W), tma(L,W), neg(L,W)} */
844 		{CIS_SENSOR, 2400, {{84, 20}, {84, 20}, {84, 20}}},
845 		{CIS_SENSOR, 1200, {{54, 10}, {54, 10}, {54, 10}}},
846 		{CIS_SENSOR,  600, {{28, 10}, {28, 10}, {28, 10}}},
847 		{CIS_SENSOR,  300, {{15,  5}, {15,  5}, {15,  5}}},
848 		{CIS_SENSOR,  200, {{ 5,  3}, { 5,  3}, { 5,  3}}},
849 		{CIS_SENSOR,  100, {{ 2,  3}, { 2,  3}, { 2,  3}}}
850 	};
851 
852 	if ((left != NULL)&&(width != NULL))
853 	{
854 		SANE_Int a;
855 		SANE_Int count = sizeof(myreg) / sizeof(struct st_reg);
856 
857 		for (a = 0; a < count; a++)
858 		{
859 			if ((myreg[a].sensor == sensor)&&(myreg[a].resolution == resolution))
860 			{
861 				scantype--;
862 
863 				*left  = myreg[a].values[scantype].left;
864 				*width = myreg[a].values[scantype].width;
865 
866 				break;
867 			}
868 		}
869 	}
870 }
871 
hp4370_offset(SANE_Int resolution,SANE_Int scantype,SANE_Int * left,SANE_Int * width)872 static void hp4370_offset(SANE_Int resolution, SANE_Int scantype, SANE_Int *left, SANE_Int *width)
873 {
874 	/* this function provides left coordinate and width to calculate offset */
875 
876 	struct st_ofst
877 	{
878 		SANE_Int left;
879 		SANE_Int width;
880 	};
881 
882 	struct st_reg
883 	{
884 		SANE_Int resolution;
885 		struct st_ofst values[3];
886 	};
887 
888 	struct st_reg myreg[] =
889 	{
890 		/* res, {ref(L,W), tma(L,W), neg(L,W)} */
891 		{ 4800, {{42, 20}, {42, 20}, {52, 26}}},
892 		{ 2400, {{14, 20}, {14, 20}, {14, 26}}},
893 		{ 1200, {{ 8, 14}, { 8, 14}, { 8, 14}}},
894 		{  600, {{ 4,  8}, { 4,  8}, { 4,  8}}},
895 		{  300, {{ 2,  4}, { 2,  4}, { 2,  4}}},
896 		{  150, {{ 1,  2}, { 1,  2}, { 1,  2}}}
897 	};
898 
899 	if ((left != NULL)&&(width != NULL))
900 	{
901 		SANE_Int a;
902 		SANE_Int count = sizeof(myreg) / sizeof(struct st_reg);
903 
904 		for (a = 0; a < count; a++)
905 		{
906 			if (myreg[a].resolution == resolution)
907 			{
908 				scantype--;
909 
910 				*left  = myreg[a].values[scantype].left;
911 				*width = myreg[a].values[scantype].width;
912 
913 				break;
914 			}
915 		}
916 	}
917 }
918 
ua4900_offset(SANE_Int resolution,SANE_Int scantype,SANE_Int * left,SANE_Int * width)919 static void ua4900_offset(SANE_Int resolution, SANE_Int scantype, SANE_Int *left, SANE_Int *width)
920 {
921 	/* this function provides left coordinate and width to calculate offset */
922 
923 	struct st_ofst
924 	{
925 		SANE_Int left;
926 		SANE_Int width;
927 	};
928 
929 	struct st_reg
930 	{
931 		SANE_Int resolution;
932 		struct st_ofst values[3];
933 	};
934 
935 	struct st_reg myreg[] =
936 	{
937 		/* res , {ref(L,W), tma(L,W), neg(L,W)} */
938 		{  2400, {{20, 20}, {16, 20}, {16, 20}}},
939 		{  1200, {{20, 10}, {10, 10}, {10, 10}}},
940 		{   600, {{ 7, 10}, {15, 10}, {15, 10}}},
941 		{   300, {{ 5, 10}, { 7,  8}, { 7,  8}}},
942 		{   200, {{ 2, 10}, { 7,  6}, { 7,  6}}},
943 		{   100, {{ 0, 10}, { 3,  4}, { 3,  4}}}
944 	};
945 
946 	if ((left != NULL)&&(width != NULL))
947 	{
948 		SANE_Int a;
949 		SANE_Int count = sizeof(myreg) / sizeof(struct st_reg);
950 
951 		for (a = 0; a < count; a++)
952 		{
953 			if (myreg[a].resolution == resolution)
954 			{
955 				scantype--;
956 
957 				*left  = myreg[a].values[scantype].left;
958 				*width = myreg[a].values[scantype].width;
959 
960 				break;
961 			}
962 		}
963 	}
964 }
965 
cfg_offset_get(SANE_Int sensortype,SANE_Int resolution,SANE_Int scantype,SANE_Int * left,SANE_Int * width)966 static void cfg_offset_get(SANE_Int sensortype, SANE_Int resolution, SANE_Int scantype, SANE_Int *left, SANE_Int *width)
967 {
968 	switch(RTS_Debug->dev_model)
969 	{
970 		case UA4900:
971 			ua4900_offset(resolution, scantype, left, width);
972 			break;
973 
974 		case HP3800:
975 		case HPG2710:
976 			hp3800_offset(resolution, scantype, left, width);
977 			break;
978 
979 		case HPG3010:
980 		case HPG3110:
981 		case HP4370:
982 			hp4370_offset(resolution, scantype, left, width);
983 			break;
984 
985 		default:
986 			hp3970_offset(sensortype, resolution, scantype, left, width);
987 			break;
988 	}
989 }
990 
991 /** SEC: Device constraints ---------- */
992 
cfg_constrains_get(struct st_constrains * constrain)993 static SANE_Int cfg_constrains_get(struct st_constrains *constrain)
994 {
995 	SANE_Int rst = ERROR;
996 
997 	struct st_reg
998 	{
999 		SANE_Int device;
1000 		struct st_constrains constrain;
1001 	};
1002 
1003 	struct st_reg reg[] =
1004 	{
1005 		/* constraints are set in millimeters */
1006 		/*device ,   reflective               , negative                  , transparent                   */
1007 		/*       , {{left, width, top, height}, {left, width, top, height}, {left, width, top, height}}}, */
1008 		{ BQ5550 , {{   0,   220,   0,    300}, {  88,    42,   0,     83}, {  88,    42,   0,     83}}},
1009 		{ HP3800 , {{   0,   220,   0,    300}, {  89,    45,   0,     85}, {  89,    45,   0,    100}}},
1010 		{HPG2710 , {{   0,   220,   0,    300}, {  89,    45,   0,     85}, {  89,    45,   0,    100}}},
1011 		{ HP3970 , {{   0,   220,   0,    300}, {  88,    42,   0,     83}, {  88,    42,   0,     83}}},
1012 		{ HP4070 , {{   0,   220,   0,    300}, {  58,    99,   0,    197}, {  58,    99,   0,    197}}},
1013 		{ HP4370 , {{   0,   220,   0,    300}, {  90,    45,   0,     85}, {  90,    45,   0,    100}}},
1014 		{ UA4900 , {{   0,   220,   0,    300}, {  88,    42,   0,     83}, {  88,    42,   0,     83}}},
1015 		{HPG3010 , {{   0,   220,   0,    300}, {  90,    45,   0,     85}, {  89,    45,   0,    100}}},
1016 		{HPG3110 , {{   0,   220,   0,    300}, {  92,    28,   0,    190}, {  85,    44,   0,    190}}}
1017 	};
1018 
1019 	if (constrain != NULL)
1020 	{
1021 		SANE_Int a;
1022 		SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1023 
1024 		for (a = 0; a < count; a++)
1025 		{
1026 			if (reg[a].device == RTS_Debug->dev_model)
1027 			{
1028 				memcpy(constrain, &reg[a].constrain, sizeof(struct st_constrains));
1029 				rst = OK;
1030 				break;
1031 			}
1032 		}
1033 	}
1034 
1035 	return rst;
1036 }
1037 
1038 /** SEC: Motor resource ------------------- */
cfg_motor_resource_get(SANE_Byte * size)1039 static SANE_Byte *cfg_motor_resource_get(SANE_Byte *size)
1040 {
1041 	/* this function returns the proper motor resources for a given device */
1042 	SANE_Byte *rst = NULL;
1043 
1044 	/* Until now, resource size is always 32 bytes */
1045 	rst = (SANE_Byte *)malloc(sizeof(SANE_Byte) * 32);
1046 	if (size != NULL)
1047 		*size = 0;
1048 
1049 	if (rst != NULL)
1050 	{
1051 		memset(rst, 0, sizeof(SANE_Byte) * 32);
1052 
1053 		switch(RTS_Debug->dev_model)
1054 		{
1055 			case BQ5550:
1056 				{
1057 					SANE_Byte Resource[] = {0xff, 0xb4, 0xb0, 0xd4, 0xd0, 0x70, 0x50, 0x54, 0x30, 0x34, 0x14, 0x38, 0x18, 0x0c, 0x08, 0x28, 0x04, 0x24, 0x20, 0x44, 0x40, 0xe0, 0xc0, 0xc4, 0xa0, 0xa4, 0x84, 0xa8, 0x88, 0x9c, 0x98, 0xb8};
1058 					memcpy(rst, &Resource, sizeof(SANE_Byte) * 32);
1059 					if (size != NULL)
1060 						*size = 32;
1061 				}
1062 				break;
1063 			default:
1064 				{
1065 					SANE_Byte Resource[] = {0xff, 0x90, 0xb0, 0xd4, 0xd0, 0x70, 0x50, 0x54, 0x30, 0x10, 0x14, 0x38, 0x18, 0x0c, 0x08, 0x28, 0x04, 0x00, 0x20, 0x44, 0x40, 0xe0, 0xc0, 0xc4, 0xa0, 0x80, 0x84, 0xa8, 0x88, 0x9c, 0x98, 0xb8};
1066 					memcpy(rst, &Resource, sizeof(SANE_Byte) * 32);
1067 					if (size != NULL)
1068 						*size = 32;
1069 				}
1070 				break;
1071 		}
1072 	}
1073 
1074 	return rst;
1075 }
1076 
1077 /** SEC: Auto reference position ---------- */
1078 
cfg_autoref_get(struct st_autoref * reg)1079 static void cfg_autoref_get(struct st_autoref *reg)
1080 {
1081 	if (reg != NULL)
1082 	{
1083 		struct st_reg
1084 		{
1085 			SANE_Int device;
1086 			struct st_autoref value;
1087 		};
1088 
1089 		struct st_reg myreg[] =
1090 		{
1091 			/* x and y offsets are based on 2400 dpi */
1092 			/* device, { type              , x  , y  , resolution, extern_boundary}*/
1093 			{ BQ5550 , {REF_NONE           , -40, -40, 600       , 40}},
1094 			{ UA4900 , {REF_NONE           , -40, -40, 600       , 40}},
1095 			{ HP3800 , {REF_TAKEFROMSCANNER,  88, 624, 600       , 40}},
1096 			{HPG2710 , {REF_TAKEFROMSCANNER,  88, 624, 600       , 40}},
1097 			{ HP3970 , {REF_TAKEFROMSCANNER,  88, 717, 600       , 40}},
1098 			{ HP4070 , {REF_TAKEFROMSCANNER,  88, 717, 600       , 40}},
1099 			{ HP4370 , {REF_TAKEFROMSCANNER,  88, 717, 600       , 40}},
1100 			{HPG3010 , {REF_TAKEFROMSCANNER,  88, 717, 600       , 40}},
1101 			{HPG3110 , {REF_TAKEFROMSCANNER,  88, 717, 600       , 40}}
1102 		};
1103 
1104 		SANE_Int a;
1105 		SANE_Int count = sizeof(myreg) / sizeof(struct st_reg);
1106 
1107 		for (a = 0; a < count; a++)
1108 		{
1109 			if (myreg[a].device == RTS_Debug->dev_model)
1110 			{
1111 				memcpy(reg, &myreg[a].value, sizeof(struct st_autoref));
1112 				break;
1113 			}
1114 		}
1115 	}
1116 }
1117 
hp3800_effectivepixel(SANE_Int resolution)1118 static SANE_Int hp3800_effectivepixel(SANE_Int resolution)
1119 {
1120 	struct st_reg
1121 	{
1122 		SANE_Int resolution;
1123 		SANE_Int pixel;
1124 	};
1125 
1126 	struct st_reg reg[] =
1127 	{
1128 		/* res , pixel */
1129 		{  2400, 134 },
1130 		{  1200, 134 },
1131 		{   600, 230 },
1132 		{   300, 172 },
1133 		{   200, 230 },
1134 		{   100, 230 }
1135 	};
1136 
1137 	SANE_Int a;
1138 	SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1139 	SANE_Int rst = 230; /* default */
1140 
1141 	for (a = 0; a < count; a++)
1142 	{
1143 		if (reg[a].resolution == resolution)
1144 		{
1145 			rst = reg[a].pixel;
1146 			break;
1147 		}
1148 	}
1149 
1150 	return rst;
1151 }
1152 
hp3970_effectivepixel(SANE_Int sensor,SANE_Int resolution)1153 static SANE_Int hp3970_effectivepixel(SANE_Int sensor, SANE_Int resolution)
1154 {
1155 	struct st_reg
1156 	{
1157 		SANE_Int resolution;
1158 		SANE_Int pixel[2];
1159 	};
1160 
1161 	struct st_reg reg[] =
1162 	{
1163 		/* res , {Toshiba, sony}} */
1164 		{  2400, {134    , 218 }},
1165 		{  1200, {134    , 240 }},
1166 		{   600, {230    , 242 }},
1167 		{   300, {160    , 172 }},
1168 		{   200, {230    , 242 }},
1169 		{   100, {230    , 242 }}
1170 	};
1171 
1172 	SANE_Int a;
1173 	SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1174 	SANE_Int rst = 230; /* default */
1175 
1176 	for (a = 0; a < count; a++)
1177 	{
1178 		if (reg[a].resolution == resolution)
1179 		{
1180 			rst = (sensor == CCD_SENSOR)? reg[a].pixel[0] : reg[a].pixel[1];
1181 			break;
1182 		}
1183 	}
1184 
1185 	return rst;
1186 }
1187 
hp4370_effectivepixel(SANE_Int resolution)1188 static SANE_Int hp4370_effectivepixel(SANE_Int resolution)
1189 {
1190 	struct st_reg
1191 	{
1192 		SANE_Int resolution;
1193 		SANE_Int pixel;
1194 	};
1195 
1196 	struct st_reg reg[] =
1197 	{
1198 		/* res , pxl */
1199 		{  4800, 134},
1200 		{  2400, 134},
1201 		{  1200, 134},
1202 		{   600, 230},
1203 		{   300, 230},
1204 		{   150, 230}
1205 	};
1206 
1207 	SANE_Int a;
1208 	SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1209 	SANE_Int rst = 230; /* default */
1210 
1211 	for (a = 0; a < count; a++)
1212 	{
1213 		if (reg[a].resolution == resolution)
1214 		{
1215 			rst = reg[a].pixel;
1216 			break;
1217 		}
1218 	}
1219 
1220 	return rst;
1221 }
1222 
ua4900_effectivepixel(SANE_Int resolution)1223 static SANE_Int ua4900_effectivepixel(SANE_Int resolution)
1224 {
1225 	struct st_reg
1226 	{
1227 		SANE_Int resolution;
1228 		SANE_Int pixel;
1229 	};
1230 
1231 	struct st_reg reg[] =
1232 	{
1233 		/* res , pixel */
1234 		{  2400, 134 },
1235 		{  1200, 134 },
1236 		{   600, 230 },
1237 		{   300, 172 },
1238 		{   200, 230 },
1239 		{   100, 230 }
1240 	};
1241 
1242 	SANE_Int a;
1243 	SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1244 	SANE_Int rst = 230; /* default */
1245 
1246 	for (a = 0; a < count; a++)
1247 	{
1248 		if (reg[a].resolution == resolution)
1249 		{
1250 			rst = reg[a].pixel;
1251 			break;
1252 		}
1253 	}
1254 
1255 	return rst;
1256 }
1257 
cfg_effectivepixel_get(SANE_Int sensortype,SANE_Int resolution)1258 static SANE_Int cfg_effectivepixel_get(SANE_Int sensortype, SANE_Int resolution)
1259 {
1260 	SANE_Int rst;
1261 
1262 	switch(RTS_Debug->dev_model)
1263 	{
1264 		case UA4900:
1265 			rst = ua4900_effectivepixel(resolution);
1266 			break;
1267 
1268 		case HP3800:
1269 		case HPG2710:
1270 			rst = hp3800_effectivepixel(resolution);
1271 			break;
1272 
1273 		case HP4370:
1274 		case HPG3010:
1275 		case HPG3110:
1276 			rst = hp4370_effectivepixel(resolution);
1277 			break;
1278 
1279 		default:
1280 			rst = hp3970_effectivepixel(sensortype, resolution);
1281 			break;
1282 	}
1283 
1284 	return rst;
1285 }
1286 
1287 /** SEC: Gain and offset values ---------- */
1288 
bq5550_gainoffset(SANE_Int usb,struct st_gain_offset * myreg)1289 static SANE_Int bq5550_gainoffset(SANE_Int usb, struct st_gain_offset *myreg)
1290 {
1291 	struct st_reg
1292 	{
1293 		SANE_Int usb;
1294 		struct st_gain_offset values;
1295 	};
1296 
1297 	struct st_reg reg[] =
1298 	{
1299 		/* usb  , {{edcg1        }, {edcg2  }, {odcg1        }, {odcg2  }, {pag    }, {vgag1     }, {vgag2  }}} */
1300 		{  USB20, {{264, 264, 264}, {0, 0, 0}, {262, 262, 262}, {0, 0, 0}, {3, 3, 3}, {27, 27, 27}, {4, 4, 4}}},
1301 		{  USB11, {{264, 264, 264}, {0, 0, 0}, {262, 262, 262}, {0, 0, 0}, {3, 3, 3}, {27, 27, 27}, {4, 4, 4}}}
1302 	};
1303 
1304 	SANE_Int rst = ERROR;
1305 
1306 	if (myreg != NULL)
1307 	{
1308 		SANE_Int a;
1309 		SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1310 
1311 		for (a = 0; a < count; a++)
1312 		{
1313 			if (reg[a].usb == usb)
1314 			{
1315 				memcpy(myreg, &reg[a].values, sizeof(struct st_gain_offset));
1316 				rst = OK;
1317 				break;
1318 			}
1319 		}
1320 	}
1321 
1322 	return rst;
1323 }
1324 
hp3800_gainoffset(SANE_Int usb,struct st_gain_offset * myreg)1325 static SANE_Int hp3800_gainoffset(SANE_Int usb, struct st_gain_offset *myreg)
1326 {
1327 	struct st_reg
1328 	{
1329 		SANE_Int usb;
1330 		struct st_gain_offset values;
1331 	};
1332 
1333 	struct st_reg reg[] =
1334 	{
1335 		/* usb  , {{edcg1  }, {edcg2  }, {odcg1  }, {odcg2  }, {pag    }, {vgag1  }, {vgag2  }}} */
1336 		{  USB20, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {2, 2, 2}, {4, 4, 4}, {4, 4, 4}}},
1337 		{  USB11, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {2, 2, 2}, {4, 4, 4}, {4, 4, 4}}}
1338 	};
1339 
1340 	SANE_Int rst = ERROR;
1341 
1342 	if (myreg != NULL)
1343 	{
1344 		SANE_Int a;
1345 		SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1346 
1347 		for (a = 0; a < count; a++)
1348 		{
1349 			if (reg[a].usb == usb)
1350 			{
1351 				memcpy(myreg, &reg[a].values, sizeof(struct st_gain_offset));
1352 				rst = OK;
1353 				break;
1354 			}
1355 		}
1356 	}
1357 
1358 	return rst;
1359 }
1360 
hp3970_gainoffset(SANE_Int usb,SANE_Int sensor,struct st_gain_offset * myreg)1361 static SANE_Int hp3970_gainoffset(SANE_Int usb, SANE_Int sensor, struct st_gain_offset *myreg)
1362 {
1363 	struct st_reg
1364 	{
1365 		SANE_Int usb;
1366 		SANE_Int sensor;
1367 		struct st_gain_offset values;
1368 	};
1369 
1370 	struct st_reg reg[] =
1371 	{
1372 		/* usb  , sensor    , {{edcg1        }, {edcg2  }, {odcg1        }, {odcg2  }, {pag    }, {vgag1  }, {vgag2  }}} */
1373 		{  USB20, CCD_SENSOR, {{280, 266, 286}, {0, 0, 0}, {280, 266, 286}, {0, 0, 0}, {3, 3, 3}, {7, 4, 4}, {7, 4, 4}}},
1374 		{  USB11, CCD_SENSOR, {{280, 266, 286}, {0, 0, 0}, {280, 266, 286}, {0, 0, 0}, {3, 3, 3}, {7, 4, 4}, {7, 4, 4}}},
1375 
1376 		{  USB20, CIS_SENSOR, {{280, 266, 286}, {0, 0, 0}, {280, 266, 286}, {0, 0, 0}, {3, 3, 3}, {7, 4, 4}, {7, 4, 4}}},
1377 		{  USB11, CIS_SENSOR, {{280, 266, 286}, {0, 0, 0}, {280, 266, 286}, {0, 0, 0}, {3, 3, 3}, {7, 4, 4}, {7, 4, 4}}}
1378 	};
1379 
1380 	SANE_Int rst = ERROR;
1381 
1382 	if (myreg != NULL)
1383 	{
1384 		SANE_Int a;
1385 		SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1386 
1387 		for (a = 0; count < 4; a++)
1388 		{
1389 			if ((reg[a].usb == usb)&&(reg[a].sensor == sensor))
1390 			{
1391 				memcpy(myreg, &reg[a].values, sizeof(struct st_gain_offset));
1392 				rst = OK;
1393 				break;
1394 			}
1395 		}
1396 	}
1397 
1398 	return rst;
1399 }
1400 
hp4370_gainoffset(SANE_Int usb,struct st_gain_offset * myreg)1401 static SANE_Int hp4370_gainoffset(SANE_Int usb, struct st_gain_offset *myreg)
1402 {
1403 	struct st_reg
1404 	{
1405 		SANE_Int usb;
1406 		struct st_gain_offset values;
1407 	};
1408 
1409 	struct st_reg reg[] =
1410 	{
1411 		/* usb  , {{edcg1        }, {edcg2  }, {odcg1        }, {odcg2  }, {pag    }, {vgag1  }, {vgag2  }} */
1412 		{  USB20, {{280, 266, 286}, {0, 0, 0}, {280, 266, 286}, {0, 0, 0}, {3, 3, 3}, {7, 4, 4}, {7, 4, 4}}},
1413 		{  USB11, {{280, 266, 286}, {0, 0, 0}, {280, 266, 286}, {0, 0, 0}, {3, 3, 3}, {7, 4, 4}, {7, 4, 4}}}
1414 	};
1415 
1416 	SANE_Int rst = ERROR;
1417 
1418 	if (myreg != NULL)
1419 	{
1420 		SANE_Int a;
1421 		SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1422 
1423 		for (a = 0; a < count; a++)
1424 		{
1425 			if (reg[a].usb == usb)
1426 			{
1427 				memcpy(myreg, &reg[a].values, sizeof(struct st_gain_offset));
1428 				rst = OK;
1429 				break;
1430 			}
1431 		}
1432 	}
1433 
1434 	return rst;
1435 }
1436 
ua4900_gainoffset(SANE_Int usb,struct st_gain_offset * myreg)1437 static SANE_Int ua4900_gainoffset(SANE_Int usb, struct st_gain_offset *myreg)
1438 {
1439 	struct st_reg
1440 	{
1441 		SANE_Int usb;
1442 		struct st_gain_offset values;
1443 	};
1444 
1445 	struct st_reg reg[] =
1446 	{
1447 		/* usb  , {{edcg1        }, {edcg2  }, {odcg1        }, {odcg2  }, {pag    }, {vgag1     }, {vgag2  }}} */
1448 		{  USB20, {{321, 321, 321}, {0, 0, 0}, {321, 321, 321}, {0, 0, 0}, {0, 0, 0}, {24, 21, 19}, {8, 8, 8}}},
1449 		{  USB11, {{321, 321, 321}, {0, 0, 0}, {321, 321, 321}, {0, 0, 0}, {0, 0, 0}, {16, 16, 16}, {4, 4, 4}}}
1450 	};
1451 
1452 	SANE_Int rst = ERROR;
1453 
1454 	if (myreg != NULL)
1455 	{
1456 		SANE_Int a;
1457 		SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1458 
1459 		for (a = 0; a < count; a++)
1460 		{
1461 			if (reg[a].usb == usb)
1462 			{
1463 				memcpy(myreg, &reg[a].values, sizeof(struct st_gain_offset));
1464 				rst = OK;
1465 				break;
1466 			}
1467 		}
1468 	}
1469 
1470 	return rst;
1471 }
1472 
cfg_gainoffset_get(SANE_Int sensortype,struct st_gain_offset * reg)1473 static SANE_Int cfg_gainoffset_get(SANE_Int sensortype, struct st_gain_offset *reg)
1474 {
1475 	SANE_Int rst;
1476 
1477 	switch(RTS_Debug->dev_model)
1478 	{
1479 		case BQ5550:
1480 			rst = bq5550_gainoffset(RTS_Debug->usbtype, reg);
1481 			break;
1482 
1483 		case UA4900:
1484 			rst = ua4900_gainoffset(RTS_Debug->usbtype, reg);
1485 			break;
1486 
1487 		case HP3800:
1488 		case HPG2710:
1489 			rst = hp3800_gainoffset(RTS_Debug->usbtype, reg);
1490 			break;
1491 
1492 		case HP4370:
1493 		case HPG3010:
1494 		case HPG3110:
1495 			rst = hp4370_gainoffset(RTS_Debug->usbtype, reg);
1496 			break;
1497 
1498 		default:
1499 			rst = hp3970_gainoffset(RTS_Debug->usbtype, sensortype, reg);
1500 			break;
1501 	}
1502 
1503 	return rst;
1504 }
1505 
1506 /** SEC: Pulse-width modulation check stable ---------- */
1507 
hp3800_checkstable(SANE_Int lamp,struct st_checkstable * check)1508 static SANE_Int hp3800_checkstable(SANE_Int lamp, struct st_checkstable *check)
1509 {
1510 	struct st_reg
1511 	{
1512 		SANE_Int lamp;
1513 		struct st_checkstable values;
1514 	};
1515 
1516 	struct st_reg reg[] =
1517 	{
1518 		/* lamp    , { diff, interval, tottime } */
1519 		{  0       , { 100.,      200,  10000}},
1520 		{  FLB_LAMP, { 100.,      200,  10000}},
1521 		{  TMA_LAMP, { 100.,      200,  10000}}
1522 	};
1523 
1524 	SANE_Int rst = ERROR;
1525 
1526 	if (reg != NULL)
1527 	{
1528 		SANE_Int a;
1529 		SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1530 
1531 		for (a = 0; a < count; a++)
1532 		{
1533 			if (reg[a].lamp == lamp)
1534 			{
1535 				memcpy(check, &reg[a].values, sizeof(struct st_checkstable));
1536 				rst = OK;
1537 				break;
1538 			}
1539 		}
1540 	}
1541 
1542 	return rst;
1543 }
1544 
hp3970_checkstable(SANE_Int lamp,struct st_checkstable * check)1545 static SANE_Int hp3970_checkstable(SANE_Int lamp, struct st_checkstable *check)
1546 {
1547 	struct st_reg
1548 	{
1549 		SANE_Int lamp;
1550 		struct st_checkstable values;
1551 	};
1552 
1553 	struct st_reg reg[] =
1554 	{
1555 		/* lamp    , { diff, interval, tottime } */
1556 		{  0       , {1000.,      200,   5000}},
1557 		{  FLB_LAMP, { 500.,      200,   5000}},
1558 		{  TMA_LAMP, { 500.,      200,   5000}}
1559 	};
1560 
1561 	SANE_Int rst = ERROR;
1562 
1563 	if (reg != NULL)
1564 	{
1565 		SANE_Int a;
1566 		SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1567 
1568 		for (a = 0; a < count; a++)
1569 		{
1570 			if (reg[a].lamp == lamp)
1571 			{
1572 				memcpy(check, &reg[a].values, sizeof(struct st_checkstable));
1573 				rst = OK;
1574 				break;
1575 			}
1576 		}
1577 	}
1578 
1579 	return rst;
1580 }
1581 
hp4370_checkstable(SANE_Int lamp,struct st_checkstable * check)1582 static SANE_Int hp4370_checkstable(SANE_Int lamp, struct st_checkstable *check)
1583 {
1584 	struct st_reg
1585 	{
1586 		SANE_Int lamp;
1587 		struct st_checkstable values;
1588 	};
1589 
1590 	struct st_reg reg[] =
1591 	{
1592 		/* lamp    , { diff, interval, tottime } */
1593 		{  0       , { 100.,      200,   5000}},
1594 		{  FLB_LAMP, { 300.,      200,   5000}},
1595 		{  TMA_LAMP, {   0.,      200,  25000}}
1596 	};
1597 
1598 	SANE_Int rst = ERROR;
1599 
1600 	if (reg != NULL)
1601 	{
1602 		SANE_Int a;
1603 		SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1604 
1605 		for (a = 0; a < count; a++)
1606 		{
1607 			if (reg[a].lamp == lamp)
1608 			{
1609 				memcpy(check, &reg[a].values, sizeof(struct st_checkstable));
1610 				rst = OK;
1611 				break;
1612 			}
1613 		}
1614 	}
1615 
1616 	return rst;
1617 }
1618 
ua4900_checkstable(SANE_Int lamp,struct st_checkstable * check)1619 static SANE_Int ua4900_checkstable(SANE_Int lamp, struct st_checkstable *check)
1620 {
1621 	struct st_reg
1622 	{
1623 		SANE_Int lamp;
1624 		struct st_checkstable values;
1625 	};
1626 
1627 	struct st_reg reg[] =
1628 	{
1629 		/* lamp    , { diff, interval, tottime } */
1630 		{  0       , { 100.,      200,   5000}},
1631 		{  FLB_LAMP, {  10.,      200,   5000}},
1632 		{  TMA_LAMP, {  10.,      200,  25000}}
1633 	};
1634 
1635 	SANE_Int rst = ERROR;
1636 
1637 	if (reg != NULL)
1638 	{
1639 		SANE_Int a;
1640 		SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1641 
1642 		for (a = 0; a < count; a++)
1643 		{
1644 			if (reg[a].lamp == lamp)
1645 			{
1646 				memcpy(check, &reg[a].values, sizeof(struct st_checkstable));
1647 				rst = OK;
1648 				break;
1649 			}
1650 		}
1651 	}
1652 
1653 	return rst;
1654 }
1655 
cfg_checkstable_get(SANE_Int lamp,struct st_checkstable * check)1656 static SANE_Int cfg_checkstable_get(SANE_Int lamp, struct st_checkstable *check)
1657 {
1658 	SANE_Int rst;
1659 
1660 	switch(RTS_Debug->dev_model)
1661 	{
1662 		case UA4900:
1663 			rst = ua4900_checkstable(lamp, check);
1664 			break;
1665 
1666 		case HP3800:
1667 		case HPG2710:
1668 			rst = hp3800_checkstable(lamp, check);
1669 			break;
1670 
1671 		case HP4370:
1672 		case HPG3010:
1673 		case HPG3110:
1674 			rst = hp4370_checkstable(lamp, check);
1675 			break;
1676 
1677 		default:
1678 			rst = hp3970_checkstable(lamp, check);
1679 			break;
1680 	}
1681 
1682 	return rst;
1683 }
1684 
1685 /** SEC: Fixed pulse-width modulation values ---------- */
1686 
hp3800_fixedpwm(SANE_Int scantype,SANE_Int usb)1687 static SANE_Int hp3800_fixedpwm(SANE_Int scantype, SANE_Int usb)
1688 {
1689 	struct st_reg
1690 	{
1691 		SANE_Int usb;
1692 		SANE_Int pwm[3];
1693 	};
1694 
1695 	struct st_reg reg[] =
1696 	{
1697 		/* usb  , { ST_NORMAL, ST_TA, ST_NEG} */
1698 		{  USB20, {         0,     0,      0}},
1699 		{  USB11, {         0,     0,      0}}
1700 	};
1701 
1702 	SANE_Int a, rst = 0x16;
1703 	SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1704 
1705 	for (a = 0; a < count; a++)
1706 	{
1707 		if (reg[a].usb == usb)
1708 		{
1709 			if ((scantype < ST_NORMAL)||(scantype > ST_NEG))
1710 				scantype = ST_NORMAL;
1711 
1712 			rst = reg[a].pwm[scantype - 1];
1713 			break;
1714 		}
1715 	}
1716 
1717 	return rst;
1718 }
1719 
hp3970_fixedpwm(SANE_Int scantype,SANE_Int usb,SANE_Int sensor)1720 static SANE_Int hp3970_fixedpwm(SANE_Int scantype, SANE_Int usb, SANE_Int sensor)
1721 {
1722 	struct st_reg
1723 	{
1724 		SANE_Int usb;
1725 		SANE_Int sensor;
1726 		SANE_Int pwm[3];
1727 	};
1728 
1729 	struct st_reg reg[] =
1730 	{
1731 		/* usb  , sensor    , { ST_NORMAL, ST_TA, ST_NEG} */
1732 		{  USB20, CCD_SENSOR, {        22,    22,     22}},
1733 		{  USB11, CCD_SENSOR, {        22,    22,     22}},
1734 
1735 		{  USB20, CIS_SENSOR, {        22,    22,     22}},
1736 		{  USB11, CIS_SENSOR, {        22,    22,     22}}
1737 	};
1738 
1739 	SANE_Int a, rst = 0x16;
1740 	SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1741 
1742 	for (a = 0; a < count; a++)
1743 	{
1744 		if ((reg[a].usb == usb)&&(reg[a].sensor == sensor))
1745 		{
1746 			if ((scantype < ST_NORMAL)||(scantype > ST_NEG))
1747 				scantype = ST_NORMAL;
1748 
1749 			rst = reg[a].pwm[scantype - 1];
1750 			break;
1751 		}
1752 	}
1753 
1754 	return rst;
1755 }
1756 
hp4370_fixedpwm(SANE_Int scantype,SANE_Int usb)1757 static SANE_Int hp4370_fixedpwm(SANE_Int scantype, SANE_Int usb)
1758 {
1759 	struct st_reg
1760 	{
1761 		SANE_Int usb;
1762 		SANE_Int pwm[3];
1763 	};
1764 
1765 	struct st_reg reg[] =
1766 	{
1767 		/* usb  , { ST_NORMAL, ST_TA, ST_NEG} */
1768 		{  USB20, {        20,    28,     28}},
1769 		{  USB11, {        20,    28,     28}}
1770 	};
1771 
1772 	SANE_Int a, rst = 0x16;
1773 	SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1774 
1775 	for (a = 0; a < count; a++)
1776 	{
1777 		if (reg[a].usb == usb)
1778 		{
1779 			if ((scantype < ST_NORMAL)||(scantype > ST_NEG))
1780 				scantype = ST_NORMAL;
1781 
1782 			rst = reg[a].pwm[scantype - 1];
1783 			break;
1784 		}
1785 	}
1786 
1787 	return rst;
1788 }
1789 
ua4900_fixedpwm(SANE_Int scantype,SANE_Int usb)1790 static SANE_Int ua4900_fixedpwm(SANE_Int scantype, SANE_Int usb)
1791 {
1792 	struct st_reg
1793 	{
1794 		SANE_Int usb;
1795 		SANE_Int pwm[3];
1796 	};
1797 
1798 	struct st_reg reg[] =
1799 	{
1800 		/* usb  , { ST_NORMAL, ST_TA, ST_NEG} */
1801 		{  USB20, {        20,    28,     28}},
1802 		{  USB11, {        20,    28,     28}}
1803 	};
1804 
1805 	SANE_Int a, rst = 0x16;
1806 	SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1807 
1808 	for (a = 0; a < count; a++)
1809 	{
1810 		if (reg[a].usb == usb)
1811 		{
1812 			if ((scantype < ST_NORMAL)||(scantype > ST_NEG))
1813 				scantype = ST_NORMAL;
1814 
1815 			rst = reg[a].pwm[scantype - 1];
1816 			break;
1817 		}
1818 	}
1819 
1820 	return rst;
1821 }
1822 
cfg_fixedpwm_get(SANE_Int sensortype,SANE_Int scantype)1823 static SANE_Int cfg_fixedpwm_get(SANE_Int sensortype, SANE_Int scantype)
1824 {
1825 	SANE_Int rst;
1826 
1827 	switch(RTS_Debug->dev_model)
1828 	{
1829 		case UA4900:
1830 			rst = ua4900_fixedpwm(scantype, RTS_Debug->usbtype);
1831 			break;
1832 
1833 		case HP3800:
1834 		case HPG2710:
1835 			rst = hp3800_fixedpwm(scantype, RTS_Debug->usbtype);
1836 			break;
1837 
1838 		case HP4370:
1839 		case HPG3010:
1840 		case HPG3110:
1841 			rst = hp4370_fixedpwm(scantype, RTS_Debug->usbtype);
1842 			break;
1843 
1844 		default:
1845 			rst = hp3970_fixedpwm(scantype, RTS_Debug->usbtype, sensortype);
1846 			break;
1847 	}
1848 
1849 	return rst;
1850 }
1851 
1852 /** SEC: Fixed reference positions ---------- */
1853 
cfg_vrefs_get(SANE_Int sensortype,SANE_Int res,SANE_Int * ser,SANE_Int * ler)1854 static void cfg_vrefs_get(SANE_Int sensortype, SANE_Int res, SANE_Int *ser, SANE_Int *ler)
1855 {
1856 	switch(RTS_Debug->dev_model)
1857 	{
1858 		case HP3800:
1859 		case HPG2710:
1860 			hp3800_vrefs(res, ser, ler);
1861 			break;
1862 
1863 		case HP4370:
1864 		case HPG3010:
1865 		case HPG3110:
1866 			hp4370_vrefs(res, ser, ler);
1867 			break;
1868 
1869 		default:
1870 			hp3970_vrefs(RTS_Debug->usbtype, sensortype, res, ser, ler);
1871 			break;
1872 	}
1873 }
1874 
hp3800_vrefs(SANE_Int res,SANE_Int * ser,SANE_Int * ler)1875 static void hp3800_vrefs(SANE_Int res, SANE_Int *ser, SANE_Int *ler)
1876 {
1877 	struct st_reg
1878 	{
1879 		SANE_Int resolution;
1880 		SANE_Int vref[2];
1881 	};
1882 
1883 	struct st_reg reg[] =
1884 	{
1885 		/* res, { ser,  ler} */
1886 		{  150, {  25,   50}},
1887 		{  300, {  50,  101}},
1888 		{  600, { 102,  202}},
1889 		{ 1200, { 204,  404}},
1890 		{ 2400, { 408,  808}}
1891 	};
1892 
1893 	if ((ser != NULL)&&(ler != NULL))
1894 	{
1895 		SANE_Int a;
1896 		SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1897 
1898 		/* values by default */
1899 		*ser = *ler = 0;
1900 
1901 		for (a = 0; a < count; a++)
1902 		{
1903 			if (reg[a].resolution == res)
1904 			{
1905 				*ser = reg[a].vref[0];
1906 				*ler = reg[a].vref[1];
1907 				break;
1908 			}
1909 		}
1910 	}
1911 }
1912 
hp3970_vrefs(SANE_Int usb,SANE_Int sensor,SANE_Int res,SANE_Int * ser,SANE_Int * ler)1913 static void hp3970_vrefs(SANE_Int usb, SANE_Int sensor, SANE_Int res, SANE_Int *ser, SANE_Int *ler)
1914 {
1915 	struct st_reg
1916 	{
1917 		SANE_Int usb;
1918 		SANE_Int sensor;
1919 		SANE_Int resolution;
1920 		SANE_Int vref[2];
1921 	};
1922 
1923 	/* I think these references should be the same in all usb versions and in
1924 	   all sensor types but windows driver has some different values in some cases.
1925 	*/
1926 
1927 	struct st_reg reg[] =
1928 	{
1929 		/* usb  , sensor    ,  res, { ser,  ler} */
1930 		{  USB20, CCD_SENSOR,  100, {  28,   60}},
1931 		{  USB20, CCD_SENSOR,  200, {  37,  117}},
1932 		{  USB20, CCD_SENSOR,  300, {  52,  162}},
1933 		{  USB20, CCD_SENSOR,  600, { 103,  344}},
1934 		{  USB20, CCD_SENSOR, 1200, { 156,  660}},
1935 		{  USB20, CCD_SENSOR, 2400, { 309, 1262}},
1936 
1937 		/* usb  , sensor    ,  res, { ser,  ler} */
1938 		{  USB11, CCD_SENSOR,  100, {  28,   60}},
1939 		{  USB11, CCD_SENSOR,  200, {  37,  117}},
1940 		{  USB11, CCD_SENSOR,  300, {  52,  162}},
1941 		{  USB11, CCD_SENSOR,  600, { 103,  344}},
1942 		{  USB11, CCD_SENSOR, 1200, { 156,  660}},
1943 		{  USB11, CCD_SENSOR, 2400, { 309, 1262}},
1944 
1945 		/* usb  , sensor    ,  res, { ser,  ler} */
1946 		{  USB20, CIS_SENSOR,  100, {  15,   60}},
1947 		{  USB20, CIS_SENSOR,  200, {  39,  117}},
1948 		{  USB20, CIS_SENSOR,  300, {  56,  161}},
1949 		{  USB20, CIS_SENSOR,  600, { 108,  342}},
1950 		{  USB20, CIS_SENSOR, 1200, { 221,  642}},
1951 		{  USB20, CIS_SENSOR, 2400, { 407, 1285}},
1952 
1953 		/* usb  , sensor    ,  res, { ser,  ler} */
1954 		{  USB11, CIS_SENSOR,  100, {  15,   60}},
1955 		{  USB11, CIS_SENSOR,  200, {  39,  117}},
1956 		{  USB11, CIS_SENSOR,  300, {  56,  161}},
1957 		{  USB11, CIS_SENSOR,  600, { 108,  342}},
1958 		{  USB11, CIS_SENSOR, 1200, { 221,  642}},
1959 		{  USB11, CIS_SENSOR, 2400, { 407, 1285}}
1960 	};
1961 
1962 	if ((ser != NULL)&&(ler != NULL))
1963 	{
1964 		SANE_Int a;
1965 		SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1966 
1967 		/* values by default */
1968 		*ser = *ler = 0;
1969 
1970 		for (a = 0; a < count; a++)
1971 		{
1972 			if ((reg[a].usb == usb)&&(reg[a].sensor == sensor)&&(reg[a].resolution == res))
1973 			{
1974 				*ser = reg[a].vref[0];
1975 				*ler = reg[a].vref[1];
1976 				break;
1977 			}
1978 		}
1979 	}
1980 }
1981 
hp4370_vrefs(SANE_Int res,SANE_Int * ser,SANE_Int * ler)1982 static void hp4370_vrefs(SANE_Int res, SANE_Int *ser, SANE_Int *ler)
1983 {
1984 	struct st_reg
1985 	{
1986 		SANE_Int resolution;
1987 		SANE_Int vref[2];
1988 	};
1989 
1990 	struct st_reg reg[] =
1991 	{
1992 		/* res, { ser,  ler} */
1993 		{  150, {  31,   81}},
1994 		{  300, {  61,  162}},
1995 		{  600, { 122,  324}},
1996 		{ 1200, { 244,  648}},
1997 		{ 2400, { 488, 1256}},
1998 		{ 4800, { 976, 2512}}
1999 	};
2000 
2001 	if ((ser != NULL)&&(ler != NULL))
2002 	{
2003 		SANE_Int a;
2004 		SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
2005 
2006 		/* values by default */
2007 		*ser = *ler = 0;
2008 
2009 		for (a = 0; a < count; a++)
2010 		{
2011 			if (reg[a].resolution == res)
2012 			{
2013 				*ser = reg[a].vref[0];
2014 				*ler = reg[a].vref[1];
2015 				break;
2016 			}
2017 		}
2018 	}
2019 }
2020 
2021 /** SEC: Motor movements ---------- */
2022 
cfg_motormove_get(SANE_Int sensortype,SANE_Int item,struct st_motormove * reg)2023 static SANE_Int cfg_motormove_get(SANE_Int sensortype, SANE_Int item, struct st_motormove *reg)
2024 {
2025 	SANE_Int rst = ERROR;
2026 
2027 	switch(RTS_Debug->dev_model)
2028 	{
2029 		case BQ5550:
2030 			rst = bq5550_motormove(item, reg);
2031 			break;
2032 		case HP3800:
2033 		case HPG2710:
2034 			rst = hp3800_motormove(item, reg);
2035 			break;
2036 
2037 		default:
2038 			rst = hp3970_motormove(RTS_Debug->usbtype, sensortype, item, reg);
2039 			break;
2040 	}
2041 
2042 	return rst;
2043 }
2044 
bq5550_motormove(SANE_Int item,struct st_motormove * reg)2045 static SANE_Int bq5550_motormove(SANE_Int item, struct st_motormove *reg)
2046 {
2047 	SANE_Int rst = ERROR;
2048 
2049 	/* data is the same in all usb types and sensors so those args aren't needed */
2050 
2051 	if (reg != NULL)
2052 	{
2053 		struct st_motormove mv[] =
2054 		{
2055 			/* systemclock, ctpc, steptype , motorcurve } */
2056 			{  0x05       , 4059, STT_HALF ,  0         },
2057 			{  0x02       , 1200, STT_QUART, -1         }
2058 		};
2059 
2060 		rst = OK;
2061 
2062 		if ((item < 2)&&(item > -1))
2063 			memcpy(reg, &mv[item], sizeof(struct st_motormove));
2064 				else rst = ERROR;
2065 	}
2066 
2067 	return rst;
2068 }
2069 
hp3800_motormove(SANE_Int item,struct st_motormove * reg)2070 static SANE_Int hp3800_motormove(SANE_Int item, struct st_motormove *reg)
2071 {
2072 	SANE_Int rst = ERROR;
2073 
2074 	/* data is the same in all usb types and sensors so those args aren't needed */
2075 
2076 	if (reg != NULL)
2077 	{
2078 		struct st_motormove mv[] =
2079 		{
2080 			/* systemclock, ctpc, steptype, motorcurve } */
2081 			{  0x04       , 1991, STT_HALF,  2         },
2082 			{  0x02       , 1991, STT_HALF, -1         }
2083 		};
2084 
2085 		rst = OK;
2086 
2087 		if ((item < 2)&&(item > -1))
2088 			memcpy(reg, &mv[item], sizeof(struct st_motormove));
2089 				else rst = ERROR;
2090 	}
2091 
2092 	return rst;
2093 }
2094 
hp3970_motormove(SANE_Int usb,SANE_Int ccd,SANE_Int item,struct st_motormove * reg)2095 static SANE_Int hp3970_motormove(SANE_Int usb, SANE_Int ccd, SANE_Int item, struct st_motormove *reg)
2096 {
2097 	SANE_Int rst = ERROR;
2098 
2099 	struct st_mtmove
2100 	{
2101 		SANE_Int usbtype;
2102 		SANE_Int sensor;
2103 		struct st_motormove move;
2104 	};
2105 
2106 	if (reg != NULL)
2107 	{
2108 		struct st_mtmove mv[] =
2109 		{
2110 			/* usb, sensor    , {systemclock, ctpc, steptype, motorcurve } */
2111 			{USB20, CCD_SENSOR, {0x02       , 6431, STT_HALF,  1         }},
2112 			{USB20, CCD_SENSOR, {0x02       , 2000, STT_HALF, -1         }},
2113 
2114 			{USB20, CIS_SENSOR, {0x02       , 6431, STT_HALF,  1         }},
2115 			{USB20, CIS_SENSOR, {0x02       , 2000, STT_HALF, -1         }},
2116 
2117 			{USB11, CCD_SENSOR, {0x02       , 6431, STT_HALF,  1         }},
2118 			{USB11, CCD_SENSOR, {0x02       , 2000, STT_HALF, -1         }},
2119 
2120 			{USB11, CIS_SENSOR, {0x02       , 6431, STT_HALF,  1         }},
2121 			{USB11, CIS_SENSOR, {0x02       , 2000, STT_HALF, -1         }}
2122 		};
2123 
2124 		if (item < 2)
2125 		{
2126 			SANE_Int a, count = 0;
2127 			SANE_Int total = sizeof(mv) / sizeof(struct st_mtmove);
2128 
2129 			for (a = 0; a < total; a++)
2130 			{
2131 				if ((mv[a].usbtype == usb)&&(mv[a].sensor == ccd))
2132 				{
2133 					if (item == count)
2134 					{
2135 						memcpy(reg, &mv[a].move, sizeof(struct st_motormove));
2136 						rst = OK;
2137 						break;
2138 					} else count++;
2139 				}
2140 			}
2141 		}
2142 	}
2143 
2144 	return rst;
2145 }
2146 
2147 /** SEC: Scanning modes ---------- */
2148 
cfg_scanmode_get(SANE_Int sensortype,SANE_Int sm,struct st_scanmode * mymode)2149 static SANE_Int cfg_scanmode_get(SANE_Int sensortype, SANE_Int sm, struct st_scanmode *mymode)
2150 {
2151 	SANE_Int rst = ERROR;
2152 
2153 	switch(RTS_Debug->dev_model)
2154 	{
2155 		case BQ5550:
2156 			rst = bq5550_scanmodes(RTS_Debug->usbtype, sm, mymode);
2157 			break;
2158 
2159 		case UA4900:
2160 			rst = ua4900_scanmodes(RTS_Debug->usbtype, sm, mymode);
2161 			break;
2162 
2163 		case HP3800:
2164 		case HPG2710:
2165 			rst = hp3800_scanmodes(RTS_Debug->usbtype, sm, mymode);
2166 			break;
2167 
2168 		case HP4370:
2169 		case HPG3010:
2170 		case HPG3110:
2171 			rst = hp4370_scanmodes(RTS_Debug->usbtype, sm, mymode);
2172 			break;
2173 
2174 		default: /* hp3970 hp4070 */
2175 			rst = hp3970_scanmodes(RTS_Debug->usbtype, sensortype, sm, mymode);
2176 			break;
2177 	}
2178 
2179 	return rst;
2180 }
2181 
hp3970_scanmodes(SANE_Int usb,SANE_Int ccd,SANE_Int sm,struct st_scanmode * mymode)2182 static SANE_Int hp3970_scanmodes(SANE_Int usb, SANE_Int ccd, SANE_Int sm, struct st_scanmode *mymode)
2183 {
2184 	struct st_modes
2185 	{
2186 		SANE_Int usb;
2187 		SANE_Int sensor;
2188 		struct st_scanmode mode;
2189 	};
2190 
2191 	struct st_modes reg[] =
2192 	{
2193 		/* usb, sensor    , {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt      }, {mexpt     }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2194 		{USB20, CCD_SENSOR, {ST_NORMAL, CM_COLOR , 2400, 0x00  , -1   , PIXEL_RATE, 0x04 , 24499, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2195 		{USB20, CCD_SENSOR, {ST_NORMAL, CM_COLOR , 1200, 0x01  , -1   , PIXEL_RATE, 0x05 , 14667, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2196 		{USB20, CCD_SENSOR, {ST_NORMAL, CM_COLOR ,  600, 0x02  ,  2   , PIXEL_RATE, 0x04 ,  5499, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2197 		{USB20, CCD_SENSOR, {ST_NORMAL, CM_COLOR ,  300, 0x03  ,  3   , PIXEL_RATE, 0x04 ,  2751, 768    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2198 		{USB20, CCD_SENSOR, {ST_NORMAL, CM_COLOR ,  200, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  2255, 1856   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2199 		{USB20, CCD_SENSOR, {ST_NORMAL, CM_COLOR ,  100, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  2255, 1856   , STT_HALF, 0x02     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2200 
2201 		{USB20, CCD_SENSOR, {ST_NORMAL, CM_GRAY  , 2400, 0x05  , -1   , LINE_RATE , 0x04 , 24499, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2202 		{USB20, CCD_SENSOR, {ST_NORMAL, CM_GRAY  , 1200, 0x06  , -1   , LINE_RATE , 0x05 , 14667, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2203 		{USB20, CCD_SENSOR, {ST_NORMAL, CM_GRAY  ,  600, 0x07  ,  2   , LINE_RATE , 0x04 ,  5499, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2204 		{USB20, CCD_SENSOR, {ST_NORMAL, CM_GRAY  ,  300, 0x08  ,  3   , LINE_RATE , 0x04 ,  2751, 768    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2205 		{USB20, CCD_SENSOR, {ST_NORMAL, CM_GRAY  ,  200, 0x09  ,  4   , LINE_RATE , 0x04 ,  2255, 1856   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2206 		{USB20, CCD_SENSOR, {ST_NORMAL, CM_GRAY  ,  100, 0x09  ,  4   , LINE_RATE , 0x04 ,  2255, 1856   , STT_HALF, 0x02     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2207 
2208 		/* usb, sensor    , {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt      }, {mexpt     }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2209 		{USB20, CCD_SENSOR, {ST_TA    , CM_COLOR , 2400, 0x00  , -1   , PIXEL_RATE, 0x04 , 25599, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2210 		{USB20, CCD_SENSOR, {ST_TA    , CM_COLOR , 1200, 0x01  , -1   , PIXEL_RATE, 0x03 , 10899, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2211 		{USB20, CCD_SENSOR, {ST_TA    , CM_COLOR ,  600, 0x02  , -1   , PIXEL_RATE, 0x01 ,  5487, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2212 		{USB20, CCD_SENSOR, {ST_TA    , CM_COLOR ,  300, 0x03  ,  3   , PIXEL_RATE, 0x04 ,  8351, 512    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2213 		{USB20, CCD_SENSOR, {ST_TA    , CM_COLOR ,  200, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  7343, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2214 		{USB20, CCD_SENSOR, {ST_TA    , CM_COLOR ,  100, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  7343, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2215 
2216 		{USB20, CCD_SENSOR, {ST_TA    , CM_GRAY  , 2400, 0x05  , -1   , LINE_RATE , 0x04 , 25599, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2217 		{USB20, CCD_SENSOR, {ST_TA    , CM_GRAY  , 1200, 0x06  , -1   , LINE_RATE , 0x03 , 10899, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2218 		{USB20, CCD_SENSOR, {ST_TA    , CM_GRAY  ,  600, 0x07  , -1   , LINE_RATE , 0x01 ,  5487, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2219 		{USB20, CCD_SENSOR, {ST_TA    , CM_GRAY  ,  300, 0x08  ,  3   , LINE_RATE , 0x04 ,  8351, 512    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2220 		{USB20, CCD_SENSOR, {ST_TA    , CM_GRAY  ,  200, 0x09  ,  4   , LINE_RATE , 0x04 ,  7343, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2221 		{USB20, CCD_SENSOR, {ST_TA    , CM_GRAY  ,  100, 0x09  ,  4   , LINE_RATE , 0x04 ,  7343, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2222 
2223 		/* usb, sensor    , {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt           }, {mexpt              }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2224 		{USB20, CCD_SENSOR, {ST_NEG   , CM_COLOR , 2400, 0x00  , -1   , PIXEL_RATE, 0x02 , 76799, 256    , STT_FULL, 0x00     , {25599, 51199, 0}, {25599, 25599, 76799},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2225 		{USB20, CCD_SENSOR, {ST_NEG   , CM_COLOR , 1200, 0x01  , -1   , PIXEL_RATE, 0x03 , 36467, 256    , STT_FULL, 0x00     , {12155, 24311, 0}, {12155, 12155, 36467},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2226 		{USB20, CCD_SENSOR, {ST_NEG   , CM_COLOR ,  600, 0x02  , -1   , PIXEL_RATE, 0x02 , 16463, 256    , STT_FULL, 0x00     , { 5487, 10975, 0}, { 5487,  5487, 16463},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2227 		{USB20, CCD_SENSOR, {ST_NEG   , CM_COLOR ,  300, 0x03  , -1   , PIXEL_RATE, 0x02 ,  8351, 256    , STT_HALF, 0x00     , { 2783,  5567, 0}, { 2783,  2783,  8351},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2228 		{USB20, CCD_SENSOR, {ST_NEG   , CM_COLOR ,  200, 0x04  , -1   , PIXEL_RATE, 0x02 ,  6191, 256    , STT_HALF, 0x00     , { 2063,  4127, 0}, { 2063,  2063,  6191},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2229 		{USB20, CCD_SENSOR, {ST_NEG   , CM_COLOR ,  100, 0x04  , -1   , PIXEL_RATE, 0x02 ,  6191, 256    , STT_HALF, 0x02     , { 2063,  4127, 0}, { 2063,  2063,  6191},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2230 
2231 		{USB20, CCD_SENSOR, {ST_NEG   , CM_GRAY  , 2400, 0x05  , -1   , LINE_RATE , 0x02 , 76799, 256    , STT_FULL, 0x00     , {25599, 51199, 0}, {25599, 25599, 76799},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2232 		{USB20, CCD_SENSOR, {ST_NEG   , CM_GRAY  , 1200, 0x06  , -1   , LINE_RATE , 0x03 , 36467, 256    , STT_FULL, 0x00     , {12155, 24311, 0}, {12155, 12155, 36467},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2233 		{USB20, CCD_SENSOR, {ST_NEG   , CM_GRAY  ,  600, 0x07  , -1   , LINE_RATE , 0x02 , 16463, 256    , STT_FULL, 0x00     , { 5487, 10975, 0}, { 5487,  5487, 16463},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2234 		{USB20, CCD_SENSOR, {ST_NEG   , CM_GRAY  ,  300, 0x08  , -1   , LINE_RATE , 0x02 ,  8351, 256    , STT_HALF, 0x00     , { 2783,  5567, 0}, { 2783,  2783,  8351},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2235 		{USB20, CCD_SENSOR, {ST_NEG   , CM_GRAY  ,  200, 0x09  , -1   , LINE_RATE , 0x02 ,  6191, 256    , STT_HALF, 0x00     , { 2063,  4127, 0}, { 2063,  2063,  6191},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2236 		{USB20, CCD_SENSOR, {ST_NEG   , CM_GRAY  ,  100, 0x09  , -1   , LINE_RATE , 0x02 ,  6191, 256    , STT_HALF, 0x02     , { 2063,  4127, 0}, { 2063,  2063,  6191},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2237 
2238 		/* usb, sensor    , {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt      }, {mexpt     }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2239 		{USB20, CIS_SENSOR, {ST_NORMAL, CM_COLOR , 2400, 0x00  , -1   , PIXEL_RATE, 0x04 , 24499, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2240 		{USB20, CIS_SENSOR, {ST_NORMAL, CM_COLOR , 1200, 0x01  , -1   , PIXEL_RATE, 0x05 , 14667, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2241 		{USB20, CIS_SENSOR, {ST_NORMAL, CM_COLOR ,  600, 0x02  ,  2   , PIXEL_RATE, 0x04 ,  5499, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2242 		{USB20, CIS_SENSOR, {ST_NORMAL, CM_COLOR ,  300, 0x03  ,  3   , PIXEL_RATE, 0x04 ,  2751, 768    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2243 		{USB20, CIS_SENSOR, {ST_NORMAL, CM_COLOR ,  200, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  2255, 1856   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2244 		{USB20, CIS_SENSOR, {ST_NORMAL, CM_COLOR ,  100, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  2255, 1856   , STT_HALF, 0x02     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2245 
2246 		{USB20, CIS_SENSOR, {ST_NORMAL, CM_GRAY  , 2400, 0x05  , -1   , LINE_RATE , 0x04 , 24499, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2247 		{USB20, CIS_SENSOR, {ST_NORMAL, CM_GRAY  , 1200, 0x06  , -1   , LINE_RATE , 0x05 , 14667, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2248 		{USB20, CIS_SENSOR, {ST_NORMAL, CM_GRAY  ,  600, 0x07  ,  2   , LINE_RATE , 0x04 ,  5499, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2249 		{USB20, CIS_SENSOR, {ST_NORMAL, CM_GRAY  ,  300, 0x08  ,  3   , LINE_RATE , 0x04 ,  2751, 768    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2250 		{USB20, CIS_SENSOR, {ST_NORMAL, CM_GRAY  ,  200, 0x09  ,  4   , LINE_RATE , 0x04 ,  2255, 1856   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2251 		{USB20, CIS_SENSOR, {ST_NORMAL, CM_GRAY  ,  100, 0x09  ,  4   , LINE_RATE , 0x04 ,  2255, 1856   , STT_HALF, 0x02     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2252 
2253 		/* usb, sensor    , {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt      }, {mexpt     }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2254 		{USB20, CIS_SENSOR, {ST_TA    , CM_COLOR , 2400, 0x00  , -1   , PIXEL_RATE, 0x04 , 25599, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2255 		{USB20, CIS_SENSOR, {ST_TA    , CM_COLOR , 1200, 0x01  , -1   , PIXEL_RATE, 0x03 , 10899, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2256 		{USB20, CIS_SENSOR, {ST_TA    , CM_COLOR ,  600, 0x02  , -1   , PIXEL_RATE, 0x01 ,  5487, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2257 		{USB20, CIS_SENSOR, {ST_TA    , CM_COLOR ,  300, 0x03  ,  3   , PIXEL_RATE, 0x04 ,  8351, 512    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2258 		{USB20, CIS_SENSOR, {ST_TA    , CM_COLOR ,  200, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  7343, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2259 		{USB20, CIS_SENSOR, {ST_TA    , CM_COLOR ,  100, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  7343, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2260 
2261 		{USB20, CIS_SENSOR, {ST_TA    , CM_GRAY  , 2400, 0x05  , -1   , LINE_RATE , 0x04 , 25599, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2262 		{USB20, CIS_SENSOR, {ST_TA    , CM_GRAY  , 1200, 0x06  , -1   , LINE_RATE , 0x03 , 10899, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2263 		{USB20, CIS_SENSOR, {ST_TA    , CM_GRAY  ,  600, 0x07  , -1   , LINE_RATE , 0x01 ,  5487, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2264 		{USB20, CIS_SENSOR, {ST_TA    , CM_GRAY  ,  300, 0x08  ,  3   , LINE_RATE , 0x04 ,  8351, 512    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2265 		{USB20, CIS_SENSOR, {ST_TA    , CM_GRAY  ,  200, 0x09  ,  4   , LINE_RATE , 0x04 ,  7343, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2266 		{USB20, CIS_SENSOR, {ST_TA    , CM_GRAY  ,  100, 0x09  ,  4   , LINE_RATE , 0x04 ,  7343, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2267 
2268 		/* usb, sensor    , {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt           }, {mexpt              }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2269 		{USB20, CIS_SENSOR, {ST_NEG   , CM_COLOR , 2400, 0x00  , -1   , PIXEL_RATE, 0x02 , 76799, 256    , STT_FULL, 0x00     , {25599, 51199, 0}, {25599, 25599, 76799},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2270 		{USB20, CIS_SENSOR, {ST_NEG   , CM_COLOR , 1200, 0x01  , -1   , PIXEL_RATE, 0x03 , 36467, 256    , STT_FULL, 0x00     , {12155, 24311, 0}, {12155, 12155, 36467},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2271 		{USB20, CIS_SENSOR, {ST_NEG   , CM_COLOR ,  600, 0x02  , -1   , PIXEL_RATE, 0x02 , 16463, 256    , STT_FULL, 0x00     , { 5487, 10975, 0}, { 5487,  5487, 16463},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2272 		{USB20, CIS_SENSOR, {ST_NEG   , CM_COLOR ,  300, 0x03  , -1   , PIXEL_RATE, 0x02 ,  8351, 256    , STT_HALF, 0x00     , { 2783,  5567, 0}, { 2783,  2783,  8351},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2273 		{USB20, CIS_SENSOR, {ST_NEG   , CM_COLOR ,  200, 0x04  , -1   , PIXEL_RATE, 0x02 ,  6191, 256    , STT_HALF, 0x00     , { 2063,  4127, 0}, { 2063,  2063,  6191},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2274 		{USB20, CIS_SENSOR, {ST_NEG   , CM_COLOR ,  100, 0x04  , -1   , PIXEL_RATE, 0x02 ,  6191, 256    , STT_HALF, 0x02     , { 2063,  4127, 0}, { 2063,  2063,  6191},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2275 
2276 		{USB20, CIS_SENSOR, {ST_NEG   , CM_GRAY  , 2400, 0x05  , -1   , LINE_RATE , 0x02 , 76799, 256    , STT_FULL, 0x00     , {25599, 51199, 0}, {25599, 25599, 76799},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2277 		{USB20, CIS_SENSOR, {ST_NEG   , CM_GRAY  , 1200, 0x06  , -1   , LINE_RATE , 0x03 , 36467, 256    , STT_FULL, 0x00     , {12155, 24311, 0}, {12155, 12155, 36467},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2278 		{USB20, CIS_SENSOR, {ST_NEG   , CM_GRAY  ,  600, 0x07  , -1   , LINE_RATE , 0x02 , 16463, 256    , STT_FULL, 0x00     , { 5487, 10975, 0}, { 5487,  5487, 16463},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2279 		{USB20, CIS_SENSOR, {ST_NEG   , CM_GRAY  ,  300, 0x08  , -1   , LINE_RATE , 0x02 ,  8351, 256    , STT_HALF, 0x00     , { 2783,  5567, 0}, { 2783,  2783,  8351},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2280 		{USB20, CIS_SENSOR, {ST_NEG   , CM_GRAY  ,  200, 0x09  , -1   , LINE_RATE , 0x02 ,  6191, 256    , STT_HALF, 0x00     , { 2063,  4127, 0}, { 2063,  2063,  6191},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2281 		{USB20, CIS_SENSOR, {ST_NEG   , CM_GRAY  ,  100, 0x09  , -1   , LINE_RATE , 0x02 ,  6191, 256    , STT_HALF, 0x02     , { 2063,  4127, 0}, { 2063,  2063,  6191},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2282 
2283 		/* usb, sensor    , {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt      }, {mexpt     }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2284 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_COLOR , 2400, 0x00  , -1   , PIXEL_RATE, 0x03 , 21499, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2285 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_COLOR , 1200, 0x01  , -1   , PIXEL_RATE, 0x04 , 14667, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2286 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_COLOR ,  600, 0x02  , -1   , PIXEL_RATE, 0x04 , 21999, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2287 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_COLOR ,  300, 0x03  ,  3   , PIXEL_RATE, 0x04 , 10727, 768    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2288 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_COLOR ,  200, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  5591, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2289 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_COLOR ,  100, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  2255, 1856   , STT_HALF, 0x02     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2290 
2291 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_GRAY  , 2400, 0x05  , -1   , LINE_RATE , 0x02 , 21499, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2292 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_GRAY  , 1200, 0x06  , -1   , LINE_RATE , 0x04 , 14667, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2293 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_GRAY  ,  600, 0x07  ,  2   , LINE_RATE , 0x04 ,  6999, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2294 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_GRAY  ,  300, 0x08  ,  3   , LINE_RATE , 0x04 ,  4671, 768    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2295 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_GRAY  ,  200, 0x09  ,  4   , LINE_RATE , 0x04 ,  2255, 1856   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2296 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_GRAY  ,  100, 0x09  ,  4   , LINE_RATE , 0x04 ,  2255, 1856   , STT_HALF, 0x02     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2297 
2298 		/* usb, sensor    , {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt      }, {mexpt     }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2299 		{USB11, CCD_SENSOR, {ST_TA    , CM_COLOR , 2400, 0x00  , -1   , PIXEL_RATE, 0x04 , 25599, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2300 		{USB11, CCD_SENSOR, {ST_TA    , CM_COLOR , 1200, 0x01  , -1   , PIXEL_RATE, 0x03 , 10899, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2301 		{USB11, CCD_SENSOR, {ST_TA    , CM_COLOR ,  600, 0x02  , -1   , PIXEL_RATE, 0x01 ,  5487, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2302 		{USB11, CCD_SENSOR, {ST_TA    , CM_COLOR ,  300, 0x03  ,  3   , PIXEL_RATE, 0x04 ,  8351, 512    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2303 		{USB11, CCD_SENSOR, {ST_TA    , CM_COLOR ,  200, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  7343, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2304 		{USB11, CCD_SENSOR, {ST_TA    , CM_COLOR ,  100, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  7343, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2305 
2306 		{USB11, CCD_SENSOR, {ST_TA    , CM_GRAY  , 2400, 0x05  , -1   , LINE_RATE , 0x04 , 25599, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2307 		{USB11, CCD_SENSOR, {ST_TA    , CM_GRAY  , 1200, 0x06  , -1   , LINE_RATE , 0x03 , 10899, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2308 		{USB11, CCD_SENSOR, {ST_TA    , CM_GRAY  ,  600, 0x07  , -1   , LINE_RATE , 0x01 ,  5487, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2309 		{USB11, CCD_SENSOR, {ST_TA    , CM_GRAY  ,  300, 0x08  ,  3   , LINE_RATE , 0x04 ,  8351, 512    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2310 		{USB11, CCD_SENSOR, {ST_TA    , CM_GRAY  ,  200, 0x09  ,  4   , LINE_RATE , 0x04 ,  7343, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2311 		{USB11, CCD_SENSOR, {ST_TA    , CM_GRAY  ,  100, 0x09  ,  4   , LINE_RATE , 0x04 ,  7343, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2312 
2313 		/* usb, sensor    , {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt           }, {mexpt              }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2314 		{USB11, CCD_SENSOR, {ST_NEG   , CM_COLOR , 2400, 0x00  , -1   , PIXEL_RATE, 0x02 , 76799, 256    , STT_FULL, 0x00     , {25599, 51199, 0}, {25599, 25599, 76799},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2315 		{USB11, CCD_SENSOR, {ST_NEG   , CM_COLOR , 1200, 0x01  , -1   , PIXEL_RATE, 0x03 , 36467, 256    , STT_FULL, 0x00     , {12155, 24311, 0}, {12155, 12155, 36467},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2316 		{USB11, CCD_SENSOR, {ST_NEG   , CM_COLOR ,  600, 0x02  , -1   , PIXEL_RATE, 0x02 , 16463, 256    , STT_FULL, 0x00     , { 5487, 10975, 0}, { 5487,  5487, 16463},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2317 		{USB11, CCD_SENSOR, {ST_NEG   , CM_COLOR ,  300, 0x03  , -1   , PIXEL_RATE, 0x02 ,  8351, 256    , STT_HALF, 0x00     , { 2783,  5567, 0}, { 2783,  2783,  8351},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2318 		{USB11, CCD_SENSOR, {ST_NEG   , CM_COLOR ,  200, 0x04  , -1   , PIXEL_RATE, 0x02 ,  6191, 256    , STT_HALF, 0x00     , { 2063,  4127, 0}, { 2063,  2063,  6191},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2319 		{USB11, CCD_SENSOR, {ST_NEG   , CM_COLOR ,  100, 0x04  , -1   , PIXEL_RATE, 0x02 ,  6191, 256    , STT_HALF, 0x02     , { 2063,  4127, 0}, { 2063,  2063,  6191},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2320 
2321 		{USB11, CCD_SENSOR, {ST_NEG   , CM_GRAY  , 2400, 0x05  , -1   , LINE_RATE , 0x02 , 76799, 256    , STT_FULL, 0x00     , {25599, 51199, 0}, {25599, 25599, 76799},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2322 		{USB11, CCD_SENSOR, {ST_NEG   , CM_GRAY  , 1200, 0x06  , -1   , LINE_RATE , 0x03 , 36467, 256    , STT_FULL, 0x00     , {12155, 24311, 0}, {12155, 12155, 36467},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2323 		{USB11, CCD_SENSOR, {ST_NEG   , CM_GRAY  ,  600, 0x07  , -1   , LINE_RATE , 0x02 , 16463, 256    , STT_FULL, 0x00     , { 5487, 10975, 0}, { 5487,  5487, 16463},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2324 		{USB11, CCD_SENSOR, {ST_NEG   , CM_GRAY  ,  300, 0x08  , -1   , LINE_RATE , 0x02 ,  8351, 256    , STT_HALF, 0x00     , { 2783,  5567, 0}, { 2783,  2783,  8351},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2325 		{USB11, CCD_SENSOR, {ST_NEG   , CM_GRAY  ,  200, 0x09  , -1   , LINE_RATE , 0x02 ,  6191, 256    , STT_HALF, 0x00     , { 2063,  4127, 0}, { 2063,  2063,  6191},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2326 		{USB11, CCD_SENSOR, {ST_NEG   , CM_GRAY  ,  100, 0x09  , -1   , LINE_RATE , 0x02 ,  6191, 256    , STT_HALF, 0x02     , { 2063,  4127, 0}, { 2063,  2063,  6191},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2327 
2328 		/* usb, sensor    , {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt      }, {mexpt     }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2329 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_COLOR , 2400, 0x00  , -1   , PIXEL_RATE, 0x02 , 21499, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2330 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_COLOR , 1200, 0x01  , -1   , PIXEL_RATE, 0x03 , 14667, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2331 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_COLOR ,  600, 0x02  , -1   , PIXEL_RATE, 0x04 , 21999, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2332 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_COLOR ,  300, 0x03  ,  3   , PIXEL_RATE, 0x04 , 10727, 768    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2333 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_COLOR ,  200, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  5591, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2334 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_COLOR ,  100, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  2255, 1856   , STT_HALF, 0x02     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2335 
2336 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_GRAY  , 2400, 0x05  , -1   , LINE_RATE , 0x02 , 21499, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2337 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_GRAY  , 1200, 0x06  , -1   , LINE_RATE , 0x04 , 14667, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2338 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_GRAY  ,  600, 0x07  ,  2   , LINE_RATE , 0x04 ,  6999, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2339 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_GRAY  ,  300, 0x08  ,  3   , LINE_RATE , 0x04 ,  4671, 768    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2340 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_GRAY  ,  200, 0x09  ,  4   , LINE_RATE , 0x04 ,  2255, 1856   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2341 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_GRAY  ,  100, 0x09  ,  4   , LINE_RATE , 0x04 ,  2255, 1856   , STT_HALF, 0x02     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2342 
2343 		/* usb, sensor    , {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt      }, {mexpt     }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2344 		{USB11, CCD_SENSOR, {ST_TA    , CM_COLOR , 2400, 0x00  , -1   , PIXEL_RATE, 0x04 , 25599, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2345 		{USB11, CCD_SENSOR, {ST_TA    , CM_COLOR , 1200, 0x01  , -1   , PIXEL_RATE, 0x03 , 10899, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2346 		{USB11, CCD_SENSOR, {ST_TA    , CM_COLOR ,  600, 0x02  , -1   , PIXEL_RATE, 0x01 ,  5487, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2347 		{USB11, CCD_SENSOR, {ST_TA    , CM_COLOR ,  300, 0x03  ,  3   , PIXEL_RATE, 0x04 ,  8351, 512    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2348 		{USB11, CCD_SENSOR, {ST_TA    , CM_COLOR ,  200, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  7343, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2349 		{USB11, CCD_SENSOR, {ST_TA    , CM_COLOR ,  100, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  7343, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2350 
2351 		{USB11, CCD_SENSOR, {ST_TA    , CM_GRAY  , 2400, 0x05  , -1   , LINE_RATE , 0x04 , 25599, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2352 		{USB11, CCD_SENSOR, {ST_TA    , CM_GRAY  , 1200, 0x06  , -1   , LINE_RATE , 0x03 , 10899, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2353 		{USB11, CCD_SENSOR, {ST_TA    , CM_GRAY  ,  600, 0x07  , -1   , LINE_RATE , 0x01 ,  5487, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2354 		{USB11, CCD_SENSOR, {ST_TA    , CM_GRAY  ,  300, 0x08  ,  3   , LINE_RATE , 0x04 ,  8351, 512    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2355 		{USB11, CCD_SENSOR, {ST_TA    , CM_GRAY  ,  200, 0x09  ,  4   , LINE_RATE , 0x04 ,  7343, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2356 		{USB11, CCD_SENSOR, {ST_TA    , CM_GRAY  ,  100, 0x09  ,  4   , LINE_RATE , 0x04 ,  7343, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2357 
2358 		/* usb, sensor    , {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt           }, {mexpt              }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2359 		{USB11, CCD_SENSOR, {ST_NEG   , CM_COLOR , 2400, 0x00  , -1   , PIXEL_RATE, 0x02 , 76799, 256    , STT_FULL, 0x00     , {25599, 51199, 0}, {25599, 25599, 76799},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2360 		{USB11, CCD_SENSOR, {ST_NEG   , CM_COLOR , 1200, 0x01  , -1   , PIXEL_RATE, 0x03 , 36467, 256    , STT_FULL, 0x00     , {12155, 24311, 0}, {12155, 12155, 36467},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2361 		{USB11, CCD_SENSOR, {ST_NEG   , CM_COLOR ,  600, 0x02  , -1   , PIXEL_RATE, 0x02 , 16463, 256    , STT_FULL, 0x00     , { 5487, 10975, 0}, { 5487,  5487, 16463},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2362 		{USB11, CCD_SENSOR, {ST_NEG   , CM_COLOR ,  300, 0x03  , -1   , PIXEL_RATE, 0x02 ,  8351, 256    , STT_HALF, 0x00     , { 2783,  5567, 0}, { 2783,  2783,  8351},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2363 		{USB11, CCD_SENSOR, {ST_NEG   , CM_COLOR ,  200, 0x04  , -1   , PIXEL_RATE, 0x02 ,  6191, 256    , STT_HALF, 0x00     , { 2063,  4127, 0}, { 2063,  2063,  6191},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2364 		{USB11, CCD_SENSOR, {ST_NEG   , CM_COLOR ,  100, 0x04  , -1   , PIXEL_RATE, 0x02 ,  6191, 256    , STT_HALF, 0x02     , { 2063,  4127, 0}, { 2063,  2063,  6191},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2365 
2366 		{USB11, CIS_SENSOR, {ST_NEG   , CM_GRAY  , 2400, 0x05  , -1   , LINE_RATE , 0x02 , 76799, 256    , STT_FULL, 0x00     , {25599, 51199, 0}, {25599, 25599, 76799},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2367 		{USB11, CIS_SENSOR, {ST_NEG   , CM_GRAY  , 1200, 0x06  , -1   , LINE_RATE , 0x03 , 36467, 256    , STT_FULL, 0x00     , {12155, 24311, 0}, {12155, 12155, 36467},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2368 		{USB11, CCD_SENSOR, {ST_NEG   , CM_GRAY  ,  600, 0x07  , -1   , LINE_RATE , 0x02 , 16463, 256    , STT_FULL, 0x00     , { 5487, 10975, 0}, { 5487,  5487, 16463},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2369 		{USB11, CCD_SENSOR, {ST_NEG   , CM_GRAY  ,  300, 0x08  , -1   , LINE_RATE , 0x02 ,  8351, 256    , STT_HALF, 0x00     , { 2783,  5567, 0}, { 2783,  2783,  8351},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2370 		{USB11, CCD_SENSOR, {ST_NEG   , CM_GRAY  ,  200, 0x09  , -1   , LINE_RATE , 0x02 ,  6191, 256    , STT_HALF, 0x00     , { 2063,  4127, 0}, { 2063,  2063,  6191},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2371 		{USB11, CCD_SENSOR, {ST_NEG   , CM_GRAY  ,  100, 0x09  , -1   , LINE_RATE , 0x02 ,  6191, 256    , STT_HALF, 0x02     , { 2063,  4127, 0}, { 2063,  2063,  6191},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }}
2372 	};
2373 
2374 	SANE_Int rst = ERROR;
2375 
2376 	if (mymode != NULL)
2377 	{
2378 		SANE_Int a;
2379 		SANE_Int total = sizeof(reg) / sizeof(struct st_modes);
2380 		SANE_Int count = 0;
2381 		struct st_modes *md;
2382 
2383 		for (a = 0; a < total; a++)
2384 		{
2385 			md = &reg[a];
2386 			if ((md->usb == usb)&&(md->sensor == ccd))
2387 			{
2388 				if (count == sm)
2389 				{
2390 					memcpy(mymode, &md->mode, sizeof(struct st_scanmode));
2391 					rst = OK;
2392 					break;
2393 				}
2394 
2395 				count++;
2396 			}
2397 		}
2398 	}
2399 
2400 	return rst;
2401 }
2402 
hp4370_scanmodes(SANE_Int usb,SANE_Int sm,struct st_scanmode * mymode)2403 static SANE_Int hp4370_scanmodes(SANE_Int usb, SANE_Int sm, struct st_scanmode *mymode)
2404 {
2405 	struct st_modes
2406 	{
2407 		SANE_Int usb;
2408 		struct st_scanmode mode;
2409 	};
2410 
2411 	struct st_modes reg[] =
2412 	{
2413 		/* usb, {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt               }, {mexpt              }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2414 		{USB20, {ST_NORMAL, CM_COLOR , 4800, 0x00  , -1   , PIXEL_RATE, 0x05 , 47799, 256    , STT_HALF, 0x00     , {23899, 23899, 23899}, {23899, 23899, 23899},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2415 		{USB20, {ST_NORMAL, CM_COLOR , 2400, 0x01  , -1   , PIXEL_RATE, 0x05 , 31849, 256    , STT_FULL, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2416 		{USB20, {ST_NORMAL, CM_COLOR , 1200, 0x02  , -1   , PIXEL_RATE, 0x05 , 15999, 256    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2417 		{USB20, {ST_NORMAL, CM_COLOR ,  600, 0x03  ,  2   , PIXEL_RATE, 0x05 ,  7999, 256    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2418 		{USB20, {ST_NORMAL, CM_COLOR ,  300, 0x04  ,  3   , PIXEL_RATE, 0x04 ,  2799, 768    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2419 		{USB20, {ST_NORMAL, CM_COLOR ,  150, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  2799, 1856   , STT_HALF, 0x01     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2420 
2421 		{USB20, {ST_NORMAL, CM_GRAY  , 4800, 0x05  , -1   , LINE_RATE , 0x05 , 47799, 256    , STT_HALF, 0x00     , {23899, 23899, 23899}, {23899, 23899, 23899},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2422 		{USB20, {ST_NORMAL, CM_GRAY  , 2400, 0x06  , -1   , LINE_RATE , 0x05 , 31849, 256    , STT_FULL, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2423 		{USB20, {ST_NORMAL, CM_GRAY  , 1200, 0x07  , -1   , LINE_RATE , 0x05 , 15999, 256    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2424 		{USB20, {ST_NORMAL, CM_GRAY  ,  600, 0x08  ,  2   , LINE_RATE , 0x05 ,  7999, 256    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2425 		{USB20, {ST_NORMAL, CM_GRAY  ,  300, 0x09  ,  3   , LINE_RATE , 0x04 ,  2799, 768    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2426 		{USB20, {ST_NORMAL, CM_GRAY  ,  150, 0x09  ,  4   , LINE_RATE , 0x04 ,  2799, 1856   , STT_HALF, 0x01     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2427 
2428 		/* usb, {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt               }, {mexpt              }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2429 		{USB20, {ST_TA    , CM_COLOR , 4800, 0x0A  , -1   , PIXEL_RATE, 0x05 , 53999, 256    , STT_HALF, 0x00     , {26999, 26999, 26999}, {26999, 26999, 26999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2430 		{USB20, {ST_TA    , CM_COLOR , 2400, 0x01  , -1   , PIXEL_RATE, 0x05 , 35999, 256    , STT_FULL, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2431 		{USB20, {ST_TA    , CM_COLOR , 1200, 0x02  , -1   , PIXEL_RATE, 0x05 , 17999, 256    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2432 		{USB20, {ST_TA    , CM_COLOR ,  600, 0x03  ,  2   , PIXEL_RATE, 0x05 ,  8999, 256    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2433 		{USB20, {ST_TA    , CM_COLOR ,  300, 0x04  ,  3   , PIXEL_RATE, 0x04 ,  2959, 512    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2434 		{USB20, {ST_TA    , CM_COLOR ,  150, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  2959, 1024   , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2435 
2436 		{USB20, {ST_TA    , CM_GRAY  , 4800, 0x0B  , -1   , LINE_RATE , 0x05 , 53999, 256    , STT_HALF, 0x00     , {26999, 26999, 26999}, {26999, 26999, 26999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2437 		{USB20, {ST_TA    , CM_GRAY  , 2400, 0x06  , -1   , LINE_RATE , 0x05 , 35999, 256    , STT_FULL, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2438 		{USB20, {ST_TA    , CM_GRAY  , 1200, 0x07  , -1   , LINE_RATE , 0x05 , 17999, 256    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2439 		{USB20, {ST_TA    , CM_GRAY  ,  600, 0x08  ,  3   , LINE_RATE , 0x05 ,  8999, 512    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2440 		{USB20, {ST_TA    , CM_GRAY  ,  300, 0x09  ,  4   , LINE_RATE , 0x04 ,  2959, 1024   , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2441 		{USB20, {ST_TA    , CM_GRAY  ,  150, 0x09  ,  4   , LINE_RATE , 0x05 ,  2959, 1024   , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2442 
2443 		/* usb, {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt               }, {mexpt              }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2444 		{USB20, {ST_NEG   , CM_COLOR , 4800, 0x0C  , -1   , PIXEL_RATE, 0x05 , 60599, 256    , STT_HALF, 0x00     , {30299, 30299, 30299}, {30299, 30299, 30299},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2445 		{USB20, {ST_NEG   , CM_COLOR , 2400, 0x01  , -1   , PIXEL_RATE, 0x05 , 145799, 256   , STT_FULL, 0x00     , {48599, 97199,     0}, {48599, 48599, 145799},  0      ,  1     , -1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2446 		{USB20, {ST_NEG   , CM_COLOR , 1200, 0x02  , -1   , PIXEL_RATE, 0x05 , 89999, 256    , STT_FULL, 0x00     , {29999, 59999,     0}, {29999, 29999, 89999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2447 		{USB20, {ST_NEG   , CM_COLOR ,  600, 0x03  , -1   , PIXEL_RATE, 0x05 , 45999, 256    , STT_HALF, 0x00     , {15333, 30666,     0}, {15333, 15333, 45999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2448 		{USB20, {ST_NEG   , CM_COLOR ,  300, 0x04  , -1   , PIXEL_RATE, 0x04 , 14879, 256    , STT_HALF, 0x00     , { 4959,  9919,     0}, { 4959,  4959, 14879},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2449 		{USB20, {ST_NEG   , CM_COLOR ,  150, 0x04  ,  3   , PIXEL_RATE, 0x04 , 14879, 256    , STT_HALF, 0x00     , { 4959,  9919,     0}, { 4959,  4959, 14879},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2450 
2451 		{USB20, {ST_NEG   , CM_GRAY  , 4800, 0x0D  , -1   , LINE_RATE , 0x05 , 60599, 256    , STT_FULL, 0x00     , {30299, 30299, 30299}, {30299, 30299, 30299},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2452 		{USB20, {ST_NEG   , CM_GRAY  , 2400, 0x06  , -1   , LINE_RATE , 0x05 ,145799,  256   , STT_FULL, 0x00     , {48599, 97199,     0}, {48599, 48599, 145799},  0      ,  1     , -1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2453 		{USB20, {ST_NEG   , CM_GRAY  , 1200, 0x07  , -1   , LINE_RATE , 0x05 , 89999, 256    , STT_FULL, 0x00     , {29999, 59999,     0}, {29999, 29999, 89999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2454 		{USB20, {ST_NEG   , CM_GRAY  ,  600, 0x08  , -1   , LINE_RATE , 0x05 , 45999, 256    , STT_HALF, 0x00     , {15333, 30666,     0}, {15333, 15333, 45999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2455 		{USB20, {ST_NEG   , CM_GRAY  ,  300, 0x09  , -1   , LINE_RATE , 0x04 , 14879, 256    , STT_HALF, 0x00     , { 4959,  9919,     0}, { 4959,  4959, 14879},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2456 		{USB20, {ST_NEG   , CM_GRAY  ,  150, 0x09  ,  3   , LINE_RATE , 0x04 , 14879, 256    , STT_HALF, 0x00     , { 4959,  9919,     0}, { 4959,  4959, 14879},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2457 
2458 		/* usb, {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt               }, {mexpt              }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2459 		{USB11, {ST_NORMAL, CM_COLOR , 4800, 0x00  , -1   , PIXEL_RATE, 0x05 , 47799, 64     , STT_HALF, 0x00     , {23899, 23899, 23899}, {23899, 23899, 23899},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2460 		{USB11, {ST_NORMAL, CM_COLOR , 2400, 0x01  , -1   , PIXEL_RATE, 0x05 , 31849, 256    , STT_FULL, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2461 		{USB11, {ST_NORMAL, CM_COLOR , 1200, 0x02  , -1   , PIXEL_RATE, 0x05 , 15999, 256    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2462 		{USB11, {ST_NORMAL, CM_COLOR ,  600, 0x03  ,  2   , PIXEL_RATE, 0x05 ,  7999, 256    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2463 		{USB11, {ST_NORMAL, CM_COLOR ,  300, 0x04  ,  3   , PIXEL_RATE, 0x04 ,  2799, 768    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2464 		{USB11, {ST_NORMAL, CM_COLOR ,  150, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  2799, 1856   , STT_HALF, 0x01     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2465 
2466 		{USB11, {ST_NORMAL, CM_GRAY  , 4800, 0x05  , -1   , LINE_RATE , 0x05 , 47799, 64     , STT_HALF, 0x00     , {23899, 23899, 23899}, {23899, 23899, 23899},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2467 		{USB11, {ST_NORMAL, CM_GRAY  , 2400, 0x06  , -1   , LINE_RATE , 0x05 , 31849, 256    , STT_FULL, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2468 		{USB11, {ST_NORMAL, CM_GRAY  , 1200, 0x07  , -1   , LINE_RATE , 0x05 , 15999, 256    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2469 		{USB11, {ST_NORMAL, CM_GRAY  ,  600, 0x08  ,  2   , LINE_RATE , 0x05 ,  7999, 256    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2470 		{USB11, {ST_NORMAL, CM_GRAY  ,  300, 0x09  ,  3   , LINE_RATE , 0x04 ,  2799, 768    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2471 		{USB11, {ST_NORMAL, CM_GRAY  ,  150, 0x09  ,  4   , LINE_RATE , 0x04 ,  2799, 1856   , STT_HALF, 0x01     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2472 
2473 		/* usb, {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt               }, {mexpt              }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2474 		{USB11, {ST_TA    , CM_COLOR , 4800, 0x0A  , -1   , PIXEL_RATE, 0x05 , 53999, 64     , STT_HALF, 0x00     , {26999, 26999, 26999}, {26999, 26999, 26999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2475 		{USB11, {ST_TA    , CM_COLOR , 2400, 0x01  , -1   , PIXEL_RATE, 0x05 , 35999, 256    , STT_FULL, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2476 		{USB11, {ST_TA    , CM_COLOR , 1200, 0x02  , -1   , PIXEL_RATE, 0x05 , 17999, 256    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2477 		{USB11, {ST_TA    , CM_COLOR ,  600, 0x03  ,  2   , PIXEL_RATE, 0x05 ,  8999, 256    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2478 		{USB11, {ST_TA    , CM_COLOR ,  300, 0x04  ,  3   , PIXEL_RATE, 0x04 ,  2959, 512    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2479 		{USB11, {ST_TA    , CM_COLOR ,  150, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  2959, 1024   , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2480 
2481 		{USB11, {ST_TA    , CM_GRAY  , 4800, 0x0B  , -1   , LINE_RATE , 0x05 , 53999, 64     , STT_HALF, 0x00     , {26999, 26999, 26999}, {26999, 26999, 26999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2482 		{USB11, {ST_TA    , CM_GRAY  , 2400, 0x06  , -1   , LINE_RATE , 0x05 , 35999, 256    , STT_FULL, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2483 		{USB11, {ST_TA    , CM_GRAY  , 1200, 0x07  , -1   , LINE_RATE , 0x05 , 17999, 256    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2484 		{USB11, {ST_TA    , CM_GRAY  ,  600, 0x08  ,  3   , LINE_RATE , 0x05 ,  8999, 512    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2485 		{USB11, {ST_TA    , CM_GRAY  ,  300, 0x09  ,  4   , LINE_RATE , 0x04 ,  2959, 1024   , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2486 		{USB11, {ST_TA    , CM_GRAY  ,  150, 0x09  ,  4   , LINE_RATE , 0x05 ,  2959, 1024   , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2487 
2488 		/* usb, {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt               }, {mexpt              }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2489 		{USB11, {ST_NEG   , CM_COLOR , 4800, 0x0C  , -1   , PIXEL_RATE, 0x05 , 60599, 64     , STT_HALF, 0x00     , {30299, 30299, 30299}, {30299, 30299, 30299},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2490 		{USB11, {ST_NEG   , CM_COLOR , 2400, 0x01  , -1   , PIXEL_RATE, 0x05 ,145799, 256    , STT_FULL, 0x00     , {48599, 97199,     0}, {48599, 48599,145799},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2491 		{USB11, {ST_NEG   , CM_COLOR , 1200, 0x02  , -1   , PIXEL_RATE, 0x05 , 89999, 256    , STT_FULL, 0x00     , {29999, 59999,     0}, {29999, 29999, 89999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2492 		{USB11, {ST_NEG   , CM_COLOR ,  600, 0x03  , -1   , PIXEL_RATE, 0x05 , 45999, 256    , STT_HALF, 0x00     , {15333, 30666,     0}, {15333, 15333, 45999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2493 		{USB11, {ST_NEG   , CM_COLOR ,  300, 0x04  , -1   , PIXEL_RATE, 0x04 , 14879, 256    , STT_HALF, 0x00     , { 4959,  9919,     0}, { 4959,  4959, 14879},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2494 		{USB11, {ST_NEG   , CM_COLOR ,  150, 0x04  ,  3   , PIXEL_RATE, 0x04 , 14879, 256    , STT_HALF, 0x00     , { 4959,  9919,     0}, { 4959,  4959, 14879},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2495 
2496 		{USB11, {ST_NEG   , CM_GRAY  , 4800, 0x0D  , -1   , LINE_RATE , 0x05 , 60599,  64    , STT_FULL, 0x00     , {30299, 30299, 30299}, {30299, 30299, 30299},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2497 		{USB11, {ST_NEG   , CM_GRAY  , 2400, 0x06  , -1   , LINE_RATE , 0x05 ,145799, 256    , STT_FULL, 0x00     , {48599, 97199,     0}, {48599, 48599,145799},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2498 		{USB11, {ST_NEG   , CM_GRAY  , 1200, 0x07  , -1   , LINE_RATE , 0x05 , 89999, 256    , STT_FULL, 0x00     , {29999, 59999,     0}, {29999, 29999, 59999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2499 		{USB11, {ST_NEG   , CM_GRAY  ,  600, 0x08  , -1   , LINE_RATE , 0x05 , 45999, 256    , STT_HALF, 0x00     , {15333, 30666,     0}, {15333, 15333, 45999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2500 		{USB11, {ST_NEG   , CM_GRAY  ,  300, 0x09  , -1   , LINE_RATE , 0x04 , 14879, 256    , STT_HALF, 0x00     , { 4959,  9919,     0}, { 4959,  4959, 14879},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2501 		{USB11, {ST_NEG   , CM_GRAY  ,  150, 0x09  ,  3   , LINE_RATE , 0x04 , 14879, 256    , STT_HALF, 0x00     , { 4959,  9919,     0}, { 4959,  4959, 14879},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }}
2502 	};
2503 
2504 	SANE_Int rst = ERROR;
2505 
2506 	if (mymode != NULL)
2507 	{
2508 		SANE_Int a;
2509 		SANE_Int total = sizeof(reg) / sizeof(struct st_modes);
2510 		SANE_Int count = 0;
2511 		struct st_modes *md;
2512 
2513 		for (a = 0; a < total; a++)
2514 		{
2515 			md = &reg[a];
2516 			if (md->usb == usb)
2517 			{
2518 				if (count == sm)
2519 				{
2520 					memcpy(mymode, &md->mode, sizeof(struct st_scanmode));
2521 					rst = OK;
2522 					break;
2523 				}
2524 
2525 				count++;
2526 			}
2527 		}
2528 	}
2529 
2530 	return rst;
2531 }
2532 
hp3800_scanmodes(SANE_Int usb,SANE_Int sm,struct st_scanmode * mymode)2533 static SANE_Int hp3800_scanmodes(SANE_Int usb, SANE_Int sm, struct st_scanmode *mymode)
2534 {
2535 	struct st_modes
2536 	{
2537 		SANE_Int usb;
2538 		struct st_scanmode mode;
2539 	};
2540 
2541 	struct st_modes reg[] =
2542 	{
2543 		/* usb, {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt      }, {mexpt     }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2544 		{USB20, {ST_NORMAL, CM_COLOR , 2400, 0x00  , -1   , PIXEL_RATE, 0x05 , 23999, 128    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2545 		{USB20, {ST_NORMAL, CM_COLOR , 1200, 0x01  , -1   , PIXEL_RATE, 0x05 , 23999, 96     , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2546 		{USB20, {ST_NORMAL, CM_COLOR ,  600, 0x02  , -1   , PIXEL_RATE, 0x04 ,  7999, 128    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2547 		{USB20, {ST_NORMAL, CM_COLOR ,  300, 0x03  ,  9   , PIXEL_RATE, 0x04 ,  4999, 256    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2548 		{USB20, {ST_NORMAL, CM_COLOR ,  150, 0x03  , 10   , PIXEL_RATE, 0x04 ,  2999, 1024   , STT_HALF, 0x01     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2549 
2550 		{USB20, {ST_NORMAL, CM_GRAY  , 2400, 0x05  , -1   , LINE_RATE , 0x05 , 23999, 128    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2551 		{USB20, {ST_NORMAL, CM_GRAY  , 1200, 0x06  , -1   , LINE_RATE , 0x05 , 23999, 96     , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2552 		{USB20, {ST_NORMAL, CM_GRAY  ,  600, 0x07  , -1   , LINE_RATE , 0x04 ,  7999, 128    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2553 		{USB20, {ST_NORMAL, CM_GRAY  ,  300, 0x08  ,  9   , LINE_RATE , 0x04 ,  4999, 256    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2554 		{USB20, {ST_NORMAL, CM_GRAY  ,  150, 0x08  , 10   , LINE_RATE , 0x04 ,  2999, 1024   , STT_HALF, 0x01     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2555 
2556 		/* usb, {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt      }, {mexpt     }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2557 		{USB20, {ST_TA    , CM_COLOR , 2400, 0x00  , -1   , PIXEL_RATE, 0x05 , 23999, 96     , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2558 		{USB20, {ST_TA    , CM_COLOR , 1200, 0x01  , -1   , PIXEL_RATE, 0x05 , 23999, 96     , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2559 		{USB20, {ST_TA    , CM_COLOR ,  600, 0x09  , -1   , PIXEL_RATE, 0x04 ,  5999, 128    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2560 		{USB20, {ST_TA    , CM_COLOR ,  300, 0x03  ,  3   , PIXEL_RATE, 0x04 ,  2999, 256    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2561 		{USB20, {ST_TA    , CM_COLOR ,  150, 0x03  , 10   , PIXEL_RATE, 0x04 ,  2999, 1024   , STT_HALF, 0x01     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2562 
2563 		{USB20, {ST_TA    , CM_GRAY  , 2400, 0x05  , -1   , LINE_RATE , 0x05 , 23999, 96     , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2564 		{USB20, {ST_TA    , CM_GRAY  , 1200, 0x06  , -1   , LINE_RATE , 0x05 , 23999, 96     , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2565 		{USB20, {ST_TA    , CM_GRAY  ,  600, 0x07  , -1   , LINE_RATE , 0x04 ,  5999, 128    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2566 		{USB20, {ST_TA    , CM_GRAY  ,  300, 0x08  ,  3   , LINE_RATE , 0x04 ,  2999, 256    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2567 		{USB20, {ST_TA    , CM_GRAY  ,  150, 0x08  , 10   , LINE_RATE , 0x04 ,  2999, 1024   , STT_HALF, 0x01     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2568 
2569 		/* usb, {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt           }, {mexpt               }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2570 		{USB20, {ST_NEG   , CM_COLOR , 2400, 0x0A  , -1   , PIXEL_RATE, 0x04 ,127999, 96     , STT_HALF, 0x00     , {    0,     0, 0}, {127999,127999,127999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2571 		{USB20, {ST_NEG   , CM_COLOR , 1200, 0x0B  , -1   , PIXEL_RATE, 0x05 ,127999, 128    , STT_HALF, 0x00     , {    0,     0, 0}, {127999,127999,127999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2572 		{USB20, {ST_NEG   , CM_COLOR ,  600, 0x0C  , -1   , PIXEL_RATE, 0x04 , 31999, 128    , STT_HALF, 0x00     , {    0,     0, 0}, { 31999, 31999, 31999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2573 		{USB20, {ST_NEG   , CM_COLOR ,  300, 0x0D  , -1   , PIXEL_RATE, 0x04 , 15999, 256    , STT_HALF, 0x00     , {    0,     0, 0}, { 15999, 15999, 15999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2574 		{USB20, {ST_NEG   , CM_COLOR ,  150, 0x0D  , 10   , PIXEL_RATE, 0x04 , 15999, 1024   , STT_HALF, 0x01     , {    0,     0, 0}, { 15999, 15999, 15999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2575 
2576 		{USB20, {ST_NEG   , CM_GRAY  , 2400, 0x0F  , -1   , LINE_RATE , 0x05 ,127999, 96     , STT_HALF, 0x00     , {    0,     0, 0}, {127999,127999,127999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2577 		{USB20, {ST_NEG   , CM_GRAY  , 1200, 0x10  , -1   , LINE_RATE , 0x05 ,127999, 96     , STT_HALF, 0x00     , {    0,     0, 0}, {127999,127999,127999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2578 		{USB20, {ST_NEG   , CM_GRAY  ,  600, 0x11  , -1   , LINE_RATE , 0x04 , 31999, 128    , STT_HALF, 0x00     , {    0,     0, 0}, { 31999, 31999, 31999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2579 		{USB20, {ST_NEG   , CM_GRAY  ,  300, 0x12  , -1   , LINE_RATE , 0x04 , 15999, 256    , STT_HALF, 0x00     , {    0,     0, 0}, { 15999, 15999, 15999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2580 		{USB20, {ST_NEG   , CM_GRAY  ,  150, 0x12  , 10   , LINE_RATE , 0x04 , 15999, 1024   , STT_HALF, 0x01     , {    0,     0, 0}, { 15999, 15999, 15999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2581 
2582 		/* usb, {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt      }, {mexpt     }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2583 		{USB11, {ST_NORMAL, CM_COLOR , 2400, 0x00  , -1   , PIXEL_RATE, 0x05 , 23999, 128    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  2     ,  5       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2584 		{USB11, {ST_NORMAL, CM_COLOR , 1200, 0x01  , -1   , PIXEL_RATE, 0x05 , 23999, 96     , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  2     ,  3       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2585 		{USB11, {ST_NORMAL, CM_COLOR ,  600, 0x02  , -1   , PIXEL_RATE, 0x04 ,  7999, 128    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2586 		{USB11, {ST_NORMAL, CM_COLOR ,  300, 0x03  ,  9   , PIXEL_RATE, 0x04 ,  4999, 256    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2587 		{USB11, {ST_NORMAL, CM_COLOR ,  150, 0x03  , 10   , PIXEL_RATE, 0x04 ,  2999, 1024   , STT_HALF, 0x01     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2588 
2589 		{USB11, {ST_NORMAL, CM_GRAY  , 2400, 0x05  , -1   , LINE_RATE , 0x05 , 23999, 128    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  2     ,  2       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2590 		{USB11, {ST_NORMAL, CM_GRAY  , 1200, 0x06  , -1   , LINE_RATE , 0x05 , 23999, 96     , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  2     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2591 		{USB11, {ST_NORMAL, CM_GRAY  ,  600, 0x07  , -1   , LINE_RATE , 0x04 ,  7999, 128    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2592 		{USB11, {ST_NORMAL, CM_GRAY  ,  300, 0x08  ,  9   , LINE_RATE , 0x04 ,  4999, 256    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2593 		{USB11, {ST_NORMAL, CM_GRAY  ,  150, 0x08  , 10   , LINE_RATE , 0x04 ,  2999, 1024   , STT_HALF, 0x01     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2594 
2595 		/* usb, {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt      }, {mexpt     }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2596 		{USB11, {ST_TA    , CM_COLOR , 2400, 0x00  , -1   , PIXEL_RATE, 0x05 , 23999, 96     , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2597 		{USB11, {ST_TA    , CM_COLOR , 1200, 0x01  , -1   , PIXEL_RATE, 0x05 , 23999, 96     , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2598 		{USB11, {ST_TA    , CM_COLOR ,  600, 0x09  , -1   , PIXEL_RATE, 0x04 ,  5999, 128    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2599 		{USB11, {ST_TA    , CM_COLOR ,  300, 0x03  ,  3   , PIXEL_RATE, 0x04 ,  2999, 256    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2600 		{USB11, {ST_TA    , CM_COLOR ,  150, 0x03  , 10   , PIXEL_RATE, 0x04 ,  2999, 1024   , STT_HALF, 0x01     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2601 
2602 		{USB11, {ST_TA    , CM_GRAY  , 2400, 0x05  , -1   , LINE_RATE , 0x05 , 23999, 96     , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2603 		{USB11, {ST_TA    , CM_GRAY  , 1200, 0x06  , -1   , LINE_RATE , 0x05 , 23999, 96     , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2604 		{USB11, {ST_TA    , CM_GRAY  ,  600, 0x07  , -1   , LINE_RATE , 0x04 ,  5999, 128    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2605 		{USB11, {ST_TA    , CM_GRAY  ,  300, 0x08  ,  3   , LINE_RATE , 0x04 ,  2999, 256    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2606 		{USB11, {ST_TA    , CM_GRAY  ,  150, 0x08  , 10   , LINE_RATE , 0x04 ,  2999, 1024   , STT_HALF, 0x01     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2607 
2608 		/* usb, {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt           }, {mexpt               }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2609 		{USB11, {ST_NEG   , CM_COLOR , 2400, 0x0A  , -1   , PIXEL_RATE, 0x04 ,127999, 96     , STT_HALF, 0x00     , {    0,     0, 0}, {127999,127999,127999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2610 		{USB11, {ST_NEG   , CM_COLOR , 1200, 0x0B  , -1   , PIXEL_RATE, 0x05 ,127999, 128    , STT_HALF, 0x00     , {    0,     0, 0}, {127999,127999,127999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2611 		{USB11, {ST_NEG   , CM_COLOR ,  600, 0x0C  , -1   , PIXEL_RATE, 0x04 , 31999, 128    , STT_HALF, 0x00     , {    0,     0, 0}, { 31999, 31999, 31999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2612 		{USB11, {ST_NEG   , CM_COLOR ,  300, 0x0D  , -1   , PIXEL_RATE, 0x04 , 15999, 256    , STT_HALF, 0x00     , {    0,     0, 0}, { 15999, 15999, 15999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2613 		{USB11, {ST_NEG   , CM_COLOR ,  150, 0x0D  , 10   , PIXEL_RATE, 0x04 , 15999, 1024   , STT_HALF, 0x01     , {    0,     0, 0}, { 15999, 15999, 15999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2614 
2615 		{USB11, {ST_NEG   , CM_GRAY  , 2400, 0x0F  , -1   , LINE_RATE , 0x05 ,127999, 96     , STT_HALF, 0x00     , {    0,     0, 0}, {127999,127999,127999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2616 		{USB11, {ST_NEG   , CM_GRAY  , 1200, 0x10  , -1   , LINE_RATE , 0x05 ,127999, 96     , STT_HALF, 0x00     , {    0,     0, 0}, {127999,127999,127999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2617 		{USB11, {ST_NEG   , CM_GRAY  ,  600, 0x11  , -1   , LINE_RATE , 0x04 , 31999, 128    , STT_HALF, 0x00     , {    0,     0, 0}, { 31999, 31999, 31999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2618 		{USB11, {ST_NEG   , CM_GRAY  ,  300, 0x12  , -1   , LINE_RATE , 0x04 , 15999, 256    , STT_HALF, 0x00     , {    0,     0, 0}, { 15999, 15999, 15999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2619 		{USB11, {ST_NEG   , CM_GRAY  ,  150, 0x12  , 10   , LINE_RATE , 0x04 , 15999, 1024   , STT_HALF, 0x01     , {    0,     0, 0}, { 15999, 15999, 15999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }}
2620 	};
2621 
2622 	SANE_Int rst = ERROR;
2623 
2624 	if (mymode != NULL)
2625 	{
2626 		SANE_Int a;
2627 		SANE_Int total = sizeof(reg) / sizeof(struct st_modes);
2628 		SANE_Int count = 0;
2629 		struct st_modes *md;
2630 
2631 		for (a = 0; a < total; a++)
2632 		{
2633 			md = &reg[a];
2634 			if (md->usb == usb)
2635 			{
2636 				if (count == sm)
2637 				{
2638 					memcpy(mymode, &md->mode, sizeof(struct st_scanmode));
2639 					rst = OK;
2640 					break;
2641 				}
2642 
2643 				count++;
2644 			}
2645 		}
2646 	}
2647 
2648 	return rst;
2649 }
2650 
bq5550_scanmodes(SANE_Int usb,SANE_Int sm,struct st_scanmode * mymode)2651 static SANE_Int bq5550_scanmodes(SANE_Int usb, SANE_Int sm, struct st_scanmode *mymode)
2652 {
2653 	struct st_modes
2654 	{
2655 		SANE_Int usb;
2656 		struct st_scanmode mode;
2657 	};
2658 
2659 	struct st_modes reg[] =
2660 	{
2661 		/* usb, {scantype , colormode , res , timing, curve, samplerate, clock, ctpc , backstp, steptype , dummyline, {expt      }, {mexpt     }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2662 		{USB20, {ST_NORMAL, CM_COLOR  , 1200, 0x00  , -1   , PIXEL_RATE, 0x05 , 12999, 10     , STT_QUART, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  3       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2663 		{USB20, {ST_NORMAL, CM_COLOR  ,  600, 0x01  , -1   , PIXEL_RATE, 0x05 ,  6999, 32     , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  5       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2664 		{USB20, {ST_NORMAL, CM_COLOR  ,  300, 0x02  ,  0   , PIXEL_RATE, 0x05 ,  5599, 128    , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  3       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2665 		{USB20, {ST_NORMAL, CM_COLOR  ,  150, 0x02  ,  0   , PIXEL_RATE, 0x05 ,  6439, 128    , STT_FULL , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  2       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2666 		{USB20, {ST_NORMAL, CM_COLOR  ,  100, 0x02  ,  0   , PIXEL_RATE, 0x05 ,  5759, 128    , STT_FULL , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2667 
2668 		{USB20, {ST_NORMAL, CM_GRAY   , 1200, 0x03  , -1   , LINE_RATE , 0x05 , 12999, 10     , STT_QUART, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  3       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2669 		{USB20, {ST_NORMAL, CM_GRAY   ,  600, 0x04  , -1   , LINE_RATE , 0x05 ,  7199, 32     , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  2       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2670 		{USB20, {ST_NORMAL, CM_GRAY   ,  300, 0x05  ,  0   , LINE_RATE , 0x05 ,  5599, 128    , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2671 		{USB20, {ST_NORMAL, CM_GRAY   ,  150, 0x05  ,  0   , LINE_RATE , 0x05 ,  6239, 128    , STT_FULL , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2672 		{USB20, {ST_NORMAL, CM_GRAY   ,  100, 0x05  ,  0   , LINE_RATE , 0x05 ,  5759, 128    , STT_FULL , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2673 
2674 		{USB20, {ST_NORMAL, CM_LINEART, 1200, 0x03  , -1   , LINE_RATE , 0x05 , 12999, 10     , STT_QUART, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  3       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2675 		{USB20, {ST_NORMAL, CM_LINEART,  600, 0x04  , -1   , LINE_RATE , 0x05 ,  7199, 32     , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  2       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2676 		{USB20, {ST_NORMAL, CM_LINEART,  300, 0x05  ,  0   , LINE_RATE , 0x05 ,  5599, 128    , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2677 		{USB20, {ST_NORMAL, CM_LINEART,  150, 0x05  ,  0   , LINE_RATE , 0x05 ,  6239, 128    , STT_FULL , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2678 		{USB20, {ST_NORMAL, CM_LINEART,  100, 0x05  ,  0   , LINE_RATE , 0x05 ,  5759, 128    , STT_FULL , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2679 
2680 		/* usb, {scantype , colormode , res , timing, curve, samplerate, clock, ctpc , backstp, steptype , dummyline, {expt      }, {mexpt     }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2681 		{USB20, {ST_TA    , CM_COLOR  , 1200, 0x00  , -1   , PIXEL_RATE, 0x05 ,  9899, 10     , STT_QUART, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2682 		{USB20, {ST_TA    , CM_COLOR  ,  600, 0x01  , -1   , PIXEL_RATE, 0x05 ,  9999, 32     , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2683 		{USB20, {ST_TA    , CM_COLOR  ,  300, 0x02  ,  0   , PIXEL_RATE, 0x05 ,  4799, 128    , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2684 		{USB20, {ST_TA    , CM_COLOR  ,  150, 0x02  ,  0   , PIXEL_RATE, 0x05 ,  4959, 128    , STT_FULL , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2685 		{USB20, {ST_TA    , CM_COLOR  ,  100, 0x02  ,  0   , PIXEL_RATE, 0x05 ,  5059, 128    , STT_FULL , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2686 
2687 		{USB20, {ST_TA    , CM_GRAY   , 1200, 0x03  , -1   , LINE_RATE , 0x05 ,  9899, 10     , STT_QUART, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2688 		{USB20, {ST_TA    , CM_GRAY   ,  600, 0x04  , -1   , LINE_RATE , 0x05 ,  9999, 32     , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2689 		{USB20, {ST_TA    , CM_GRAY   ,  300, 0x05  ,  0   , LINE_RATE , 0x05 ,  4799, 128    , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2690 		{USB20, {ST_TA    , CM_GRAY   ,  150, 0x05  ,  0   , LINE_RATE , 0x05 ,  4959, 128    , STT_FULL , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2691 		{USB20, {ST_TA    , CM_GRAY   ,  100, 0x05  ,  0   , LINE_RATE , 0x05 ,  5059, 128    , STT_FULL , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2692 
2693 		{USB20, {ST_TA    , CM_LINEART, 1200, 0x03  , -1   , LINE_RATE , 0x05 ,  9899, 10     , STT_QUART, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2694 		{USB20, {ST_TA    , CM_LINEART,  600, 0x04  , -1   , LINE_RATE , 0x05 ,  9999, 32     , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2695 		{USB20, {ST_TA    , CM_LINEART,  300, 0x05  ,  0   , LINE_RATE , 0x05 ,  4799, 128    , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2696 		{USB20, {ST_TA    , CM_LINEART,  150, 0x05  ,  0   , LINE_RATE , 0x05 ,  4959, 128    , STT_FULL , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2697 		{USB20, {ST_TA    , CM_LINEART,  100, 0x05  ,  0   , LINE_RATE , 0x05 ,  5059, 128    , STT_FULL , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2698 
2699 		/* usb, {scantype , colormode , res , timing, curve, samplerate, clock, ctpc , backstp, steptype , dummyline, {expt      }, {mexpt     }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2700 		{USB20, {ST_NEG   , CM_COLOR  , 1200, 0x00  , -1   , PIXEL_RATE, 0x05 , 51899, 10     , STT_QUART, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2701 		{USB20, {ST_NEG   , CM_COLOR  ,  600, 0x01  , -1   , PIXEL_RATE, 0x05 , 51799, 32     , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2702 		{USB20, {ST_NEG   , CM_COLOR  ,  300, 0x02  ,  0   , PIXEL_RATE, 0x05 , 25899, 128    , STT_FULL , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2703 		{USB20, {ST_NEG   , CM_COLOR  ,  150, 0x02  ,  0   , PIXEL_RATE, 0x05 , 25899, 128    , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2704 		{USB20, {ST_NEG   , CM_COLOR  ,  100, 0x02  ,  0   , PIXEL_RATE, 0x05 , 25499, 128    , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2705 
2706 		{USB20, {ST_NEG   , CM_GRAY   , 1200, 0x03  , -1   , LINE_RATE , 0x05 , 51899, 10     , STT_QUART, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2707 		{USB20, {ST_NEG   , CM_GRAY   ,  600, 0x04  , -1   , LINE_RATE , 0x05 , 51799, 32     , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2708 		{USB20, {ST_NEG   , CM_GRAY   ,  300, 0x05  ,  0   , LINE_RATE , 0x05 , 25899, 128    , STT_FULL , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2709 		{USB20, {ST_NEG   , CM_GRAY   ,  150, 0x05  ,  0   , LINE_RATE , 0x05 , 25899, 128    , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2710 		{USB20, {ST_NEG   , CM_GRAY   ,  100, 0x05  ,  0   , LINE_RATE , 0x05 , 25499, 128    , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2711 
2712 		{USB20, {ST_NEG   , CM_LINEART, 1200, 0x03  , -1   , LINE_RATE , 0x05 , 51899, 10     , STT_QUART, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2713 		{USB20, {ST_NEG   , CM_LINEART,  600, 0x04  , -1   , LINE_RATE , 0x05 , 51799, 32     , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2714 		{USB20, {ST_NEG   , CM_LINEART,  300, 0x05  ,  0   , LINE_RATE , 0x05 , 25899, 128    , STT_FULL , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2715 		{USB20, {ST_NEG   , CM_LINEART,  150, 0x05  ,  0   , LINE_RATE , 0x05 , 25899, 128    , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2716 		{USB20, {ST_NEG   , CM_LINEART,  100, 0x05  ,  0   , LINE_RATE , 0x05 , 25499, 128    , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }}
2717 	};
2718 
2719 	SANE_Int rst = ERROR;
2720 
2721 	/* silence compiler */
2722 	usb = usb;
2723 
2724 	if (mymode != NULL)
2725 	{
2726 		SANE_Int a;
2727 		SANE_Int total = sizeof(reg) / sizeof(struct st_modes);
2728 		SANE_Int count = 0;
2729 		struct st_modes *md;
2730 
2731 		for (a = 0; a < total; a++)
2732 		{
2733 			md = &reg[a];
2734 			if (count == sm)
2735 			{
2736 				memcpy(mymode, &md->mode, sizeof(struct st_scanmode));
2737 				rst = OK;
2738 				break;
2739 			}
2740 
2741 			count++;
2742 		}
2743 	}
2744 
2745 	return rst;
2746 }
2747 
ua4900_scanmodes(SANE_Int usb,SANE_Int sm,struct st_scanmode * mymode)2748 static SANE_Int ua4900_scanmodes(SANE_Int usb, SANE_Int sm, struct st_scanmode *mymode)
2749 {
2750 	struct st_modes
2751 	{
2752 		SANE_Int usb;
2753 		struct st_scanmode mode;
2754 	};
2755 
2756 	struct st_modes reg[] =
2757 	{
2758 		/* usb, {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt      }, {mexpt     }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2759 		{USB20, {ST_NORMAL, CM_COLOR , 1200, 0x00  , -1   , PIXEL_RATE, 0x05 , 14667, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2760 		{USB20, {ST_NORMAL, CM_COLOR ,  600, 0x01  ,  2   , PIXEL_RATE, 0x04 ,  5499, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2761 		{USB20, {ST_NORMAL, CM_COLOR ,  300, 0x02  ,  3   , PIXEL_RATE, 0x04 ,  2751, 768    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2762 		{USB20, {ST_NORMAL, CM_COLOR ,  200, 0x03  ,  4   , PIXEL_RATE, 0x04 ,  2255, 1856   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2763 		{USB20, {ST_NORMAL, CM_COLOR ,  100, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  2255, 1856   , STT_HALF, 0x02     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2764 
2765 		{USB20, {ST_NORMAL, CM_GRAY  , 1200, 0x05  , -1   , LINE_RATE , 0x05 , 14667, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2766 		{USB20, {ST_NORMAL, CM_GRAY  ,  600, 0x06  ,  2   , LINE_RATE , 0x04 ,  5499, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2767 		{USB20, {ST_NORMAL, CM_GRAY  ,  300, 0x07  ,  3   , LINE_RATE , 0x04 ,  2751, 768    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2768 		{USB20, {ST_NORMAL, CM_GRAY  ,  200, 0x08  ,  4   , LINE_RATE , 0x04 ,  2255, 1856   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2769 		{USB20, {ST_NORMAL, CM_GRAY  ,  100, 0x09  ,  4   , LINE_RATE , 0x04 ,  2255, 1856   , STT_HALF, 0x02     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2770 
2771 		/* usb, {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt      }, {mexpt     }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2772 		{USB20, {ST_TA    , CM_COLOR , 1200, 0x00  , -1   , PIXEL_RATE, 0x03 , 10899, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2773 		{USB20, {ST_TA    , CM_COLOR ,  600, 0x01  , -1   , PIXEL_RATE, 0x01 ,  5487, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2774 		{USB20, {ST_TA    , CM_COLOR ,  300, 0x02  ,  3   , PIXEL_RATE, 0x04 ,  8351, 512    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2775 		{USB20, {ST_TA    , CM_COLOR ,  200, 0x03  ,  4   , PIXEL_RATE, 0x04 ,  7343, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2776 		{USB20, {ST_TA    , CM_COLOR ,  100, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  7343, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2777 
2778 		{USB20, {ST_TA    , CM_GRAY  , 1200, 0x05  , -1   , LINE_RATE , 0x03 , 10899, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2779 		{USB20, {ST_TA    , CM_GRAY  ,  600, 0x06  , -1   , LINE_RATE , 0x01 ,  5487, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2780 		{USB20, {ST_TA    , CM_GRAY  ,  300, 0x07  ,  3   , LINE_RATE , 0x04 ,  8351, 512    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2781 		{USB20, {ST_TA    , CM_GRAY  ,  200, 0x08  ,  4   , LINE_RATE , 0x04 ,  7343, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2782 		{USB20, {ST_TA    , CM_GRAY  ,  100, 0x09  ,  4   , LINE_RATE , 0x04 ,  7343, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2783 
2784 		/* usb, {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt           }, {mexpt              }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2785 		{USB20, {ST_NEG   , CM_COLOR , 1200, 0x00  , -1   , PIXEL_RATE, 0x03 , 36467, 256    , STT_FULL, 0x00     , {12155, 24311, 0}, {12155, 12155, 36467},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2786 		{USB20, {ST_NEG   , CM_COLOR ,  600, 0x01  , -1   , PIXEL_RATE, 0x02 , 16463, 256    , STT_FULL, 0x00     , { 5487, 10975, 0}, { 5487,  5487, 16463},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2787 		{USB20, {ST_NEG   , CM_COLOR ,  300, 0x02  , -1   , PIXEL_RATE, 0x02 ,  8351, 256    , STT_HALF, 0x00     , { 2783,  5567, 0}, { 2783,  2783,  8351},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2788 		{USB20, {ST_NEG   , CM_COLOR ,  200, 0x03  , -1   , PIXEL_RATE, 0x02 ,  6191, 256    , STT_HALF, 0x00     , { 2063,  4127, 0}, { 2063,  2063,  6191},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2789 		{USB20, {ST_NEG   , CM_COLOR ,  100, 0x04  , -1   , PIXEL_RATE, 0x02 ,  6191, 256    , STT_HALF, 0x02     , { 2063,  4127, 0}, { 2063,  2063,  6191},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2790 
2791 		{USB20, {ST_NEG   , CM_GRAY  , 1200, 0x05  , -1   , LINE_RATE , 0x03 , 36467, 256    , STT_FULL, 0x00     , {12155, 24311, 0}, {12155, 12155, 36467},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2792 		{USB20, {ST_NEG   , CM_GRAY  ,  600, 0x06  , -1   , LINE_RATE , 0x02 , 16463, 256    , STT_FULL, 0x00     , { 5487, 10975, 0}, { 5487,  5487, 16463},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2793 		{USB20, {ST_NEG   , CM_GRAY  ,  300, 0x07  , -1   , LINE_RATE , 0x02 ,  8351, 256    , STT_HALF, 0x00     , { 2783,  5567, 0}, { 2783,  2783,  8351},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2794 		{USB20, {ST_NEG   , CM_GRAY  ,  200, 0x08  , -1   , LINE_RATE , 0x02 ,  6191, 256    , STT_HALF, 0x00     , { 2063,  4127, 0}, { 2063,  2063,  6191},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2795 		{USB20, {ST_NEG   , CM_GRAY  ,  100, 0x09  , -1   , LINE_RATE , 0x02 ,  6191, 256    , STT_HALF, 0x02     , { 2063,  4127, 0}, { 2063,  2063,  6191},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }}
2796 	};
2797 
2798 	SANE_Int rst = ERROR;
2799 
2800 	if (mymode != NULL)
2801 	{
2802 		SANE_Int a;
2803 		SANE_Int total = sizeof(reg) / sizeof(struct st_modes);
2804 		SANE_Int count = 0;
2805 		struct st_modes *md;
2806 
2807 		for (a = 0; a < total; a++)
2808 		{
2809 			md = &reg[a];
2810 			if (md->usb == usb)
2811 			{
2812 				if (count == sm)
2813 				{
2814 					memcpy(mymode, &md->mode, sizeof(struct st_scanmode));
2815 					rst = OK;
2816 					break;
2817 				}
2818 
2819 				count++;
2820 			}
2821 		}
2822 	}
2823 
2824 	return rst;
2825 }
2826 
2827 /** SEC: Calibration wreferences ---------- */
2828 
hp3970_wrefs(SANE_Int usb,SANE_Int ccd,SANE_Int depth,SANE_Int res,SANE_Int scantype,SANE_Int * red,SANE_Int * green,SANE_Int * blue)2829 static void hp3970_wrefs(SANE_Int usb, SANE_Int ccd, SANE_Int depth, SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue)
2830 {
2831 	struct st_wref
2832 	{
2833 		SANE_Int usb;
2834 		SANE_Int sensor;
2835 		SANE_Int depth;
2836 		SANE_Int res;
2837 		SANE_Int transparent[3];
2838 		SANE_Int negative[3];
2839 	};
2840 
2841 	struct st_wref wrefs[] =
2842 	{
2843 		/*usb , sensor     , depth, res , {transparent  }, {negative} */
2844 		{USB20, CCD_SENSOR, 8    , 2400, { 78,  78,  68}, {120, 136, 157}},
2845 		{USB20, CCD_SENSOR, 8    , 1200, { 78,  78,  68}, {120, 136, 157}},
2846 		{USB20, CCD_SENSOR, 8    , 600 , { 79,  80,  70}, {119, 136, 157}},
2847 		{USB20, CCD_SENSOR, 8    , 300 , { 79,  80,  70}, {119, 136, 157}},
2848 		{USB20, CCD_SENSOR, 8    , 200 , { 79,  80,  70}, {119, 136, 157}},
2849 		{USB20, CCD_SENSOR, 8    , 100 , { 79,  80,  70}, {119, 136, 157}},
2850 
2851 		{USB20, CCD_SENSOR, 16   , 2400, { 81,  81,  71}, {119, 137, 158}},
2852 		{USB20, CCD_SENSOR, 16   , 1200, { 81,  81,  71}, {119, 137, 158}},
2853 		{USB20, CCD_SENSOR, 16   , 600 , { 81,  82,  72}, {119, 137, 158}},
2854 		{USB20, CCD_SENSOR, 16   , 300 , { 81,  82,  72}, {119, 137, 158}},
2855 		{USB20, CCD_SENSOR, 16   , 200 , { 81,  82,  72}, {119, 137, 158}},
2856 		{USB20, CCD_SENSOR, 16   , 100 , { 81,  82,  72}, {119, 137, 158}},
2857 
2858 		/*usb , sensor    , depth, res , {transparent  }, {negative     } */
2859 		{USB20, CIS_SENSOR, 8    , 2400, { 94,  85,  78}, { 94,  85,  78}},
2860 		{USB20, CIS_SENSOR, 8    , 1200, { 83,  82,  75}, {140, 155, 155}},
2861 		{USB20, CIS_SENSOR, 8    , 600 , { 84,  84,  76}, {145, 155, 165}},
2862 		{USB20, CIS_SENSOR, 8    , 300 , {146, 166, 166}, {146, 166, 166}},
2863 		{USB20, CIS_SENSOR, 8    , 200 , {145, 310, 160}, {145, 310, 160}},
2864 		{USB20, CIS_SENSOR, 8    , 100 , {140, 300, 155}, {140, 300, 155}},
2865 
2866 		{USB20, CIS_SENSOR, 16   , 2400, { 94,  85,  78}, { 94,  85,  78}},
2867 		{USB20, CIS_SENSOR, 16   , 1200, { 83,  82,  75}, {140, 155, 155}},
2868 		{USB20, CIS_SENSOR, 16   , 600 , { 84,  84,  76}, {145, 155, 165}},
2869 		{USB20, CIS_SENSOR, 16   , 300 , {146, 166, 166}, {146, 166, 166}},
2870 		{USB20, CIS_SENSOR, 16   , 200 , {145, 310, 160}, {145, 310, 160}},
2871 		{USB20, CIS_SENSOR, 16   , 100 , {140, 300, 155}, {140, 300, 155}},
2872 
2873 		/*usb , sensor     , depth, res , {transparent  }, {negative     } */
2874 		{USB11, CCD_SENSOR, 8    , 2400, { 78,  78,  68}, {120, 137, 158}},
2875 		{USB11, CCD_SENSOR, 8    , 1200, { 78,  78,  68}, {120, 137, 158}},
2876 		{USB11, CCD_SENSOR, 8    , 600 , { 79,  79,  70}, {120, 137, 158}},
2877 		{USB11, CCD_SENSOR, 8    , 300 , { 79,  79,  70}, {120, 137, 158}},
2878 		{USB11, CCD_SENSOR, 8    , 200 , { 79,  79,  70}, {120, 137, 158}},
2879 		{USB11, CCD_SENSOR, 8    , 100 , { 79,  79,  70}, {120, 137, 158}},
2880 
2881 		{USB11, CCD_SENSOR, 16   , 2400, { 80,  80,  70}, {120, 137, 158}},
2882 		{USB11, CCD_SENSOR, 16   , 1200, { 80,  80,  70}, {120, 137, 158}},
2883 		{USB11, CCD_SENSOR, 16   , 600 , { 80,  81,  71}, {120, 137, 158}},
2884 		{USB11, CCD_SENSOR, 16   , 300 , { 80,  81,  71}, {120, 137, 158}},
2885 		{USB11, CCD_SENSOR, 16   , 200 , { 80,  81,  71}, {120, 137, 158}},
2886 		{USB11, CCD_SENSOR, 16   , 100 , { 80,  81,  71}, {120, 137, 158}},
2887 
2888 		/*usb , sensor    , depth, res , {transparent  }, {negative} */
2889 		{USB11, CIS_SENSOR, 8    , 2400, { 94,  85,  78}, {94 , 85 ,  78}},
2890 		{USB11, CIS_SENSOR, 8    , 1200, { 83,  82,  75}, {140, 155, 155}},
2891 		{USB11, CIS_SENSOR, 8    , 600 , { 84,  84,  76}, {145, 155, 165}},
2892 		{USB11, CIS_SENSOR, 8    , 300 , {146, 166, 166}, {146, 166, 166}},
2893 		{USB11, CIS_SENSOR, 8    , 200 , {145, 310, 160}, {145, 310, 160}},
2894 		{USB11, CIS_SENSOR, 8    , 100 , {140, 300, 155}, {140, 300, 155}},
2895 
2896 		{USB11, CIS_SENSOR, 16   , 2400, { 94,  85,  78}, { 94,  85,  78}},
2897 		{USB11, CIS_SENSOR, 16   , 1200, { 83,  82,  75}, {140, 155, 155}},
2898 		{USB11, CIS_SENSOR, 16   , 600 , { 84,  84,  76}, {145, 155, 165}},
2899 		{USB11, CIS_SENSOR, 16   , 300 , {146, 166, 166}, {146, 166, 166}},
2900 		{USB11, CIS_SENSOR, 16   , 200 , {145, 310, 160}, {145, 310, 160}},
2901 		{USB11, CIS_SENSOR, 16   , 100 , {140, 300, 155}, {140, 300, 155}}
2902 	};
2903 
2904 	struct st_wref *rf;
2905 
2906 	*red = *green = *blue = 0x50;
2907 
2908 	if (res <= 100)
2909 		res = 100;
2910 	else if (res <= 200)
2911 		res = 200;
2912 	else if (res <= 300)
2913 		res = 300;
2914 	else if (res <= 600)
2915 		res = 600;
2916 	else if (res <= 1200)
2917 		res = 1200;
2918 	else res = 2400;
2919 
2920 	if (scantype != ST_NORMAL)
2921 	{
2922 		SANE_Int a;
2923 		SANE_Int count = sizeof(wrefs) / sizeof(struct st_wref);
2924 
2925 		for (a = 0; a < count; a++)
2926 		{
2927 			rf = &wrefs[a];
2928 			if ((rf->usb == usb)&&(rf->sensor == ccd)&&(rf->depth == depth)&&(rf->res == res))
2929 			{
2930 				switch(scantype)
2931 				{
2932 					case ST_NEG:
2933 						*red   = rf->negative[CL_RED];
2934 						*green = rf->negative[CL_GREEN];
2935 						*blue  = rf->negative[CL_BLUE];
2936 						break;
2937 					case ST_TA:
2938 						*red   = rf->transparent[CL_RED];
2939 						*green = rf->transparent[CL_GREEN];
2940 						*blue  = rf->transparent[CL_BLUE];
2941 						break;
2942 				}
2943 
2944 				break;
2945 			}
2946 		}
2947 	} else
2948 	{
2949 		/* reflective mode */
2950 		*red   = 233;
2951 		*green = 230;
2952 		*blue  = 222;
2953 	}
2954 }
2955 
ua4900_wrefs(SANE_Int usb,SANE_Int depth,SANE_Int res,SANE_Int scantype,SANE_Int * red,SANE_Int * green,SANE_Int * blue)2956 static void ua4900_wrefs(SANE_Int usb, SANE_Int depth, SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue)
2957 {
2958 	struct st_wref
2959 	{
2960 		SANE_Int usb;
2961 		SANE_Int depth;
2962 		SANE_Int res;
2963 		SANE_Int transparent[3];
2964 		SANE_Int negative[3];
2965 	};
2966 
2967 	struct st_wref wrefs[] =
2968 	{
2969 		/*usb , depth, res , {transparent  }, {negative     } */
2970 		{USB20, 8    , 1200, {136, 131, 121}, {215, 210, 260}},
2971 		{USB20, 8    , 600 , {133, 129, 118}, {219, 215, 264}},
2972 		{USB20, 8    , 300 , {133, 129, 119}, {218, 215, 261}},
2973 		{USB20, 8    , 200 , {133, 130, 119}, {218, 215, 261}},
2974 		{USB20, 8    , 100 , {132, 128, 118}, {218, 215, 261}},
2975 
2976 		{USB20, 16   , 1200, {264, 263, 266}, {  0,   0,   0}},
2977 		{USB20, 16   , 600 , {264, 265, 268}, {  0,   0,   0}},
2978 		{USB20, 16   , 300 , {264, 260, 263}, {  0,   0,   0}},
2979 		{USB20, 16   , 200 , {257, 255, 253}, {  0,   0,   0}},
2980 		{USB20, 16   , 100 , {258, 259, 256}, {  0,   0,   0}},
2981 
2982 		/*usb , depth, res , {transparent  }, {negative     } */
2983 		{USB11, 8    , 1200, {135, 130, 119}, {220, 215, 264}},
2984 		{USB11, 8    , 600 , {132, 128, 117}, {217, 213, 259}},
2985 		{USB11, 8    , 300 , {132, 128, 117}, {216, 211, 259}},
2986 		{USB11, 8    , 200 , {132, 128, 118}, {215, 352, 259}},
2987 		{USB11, 8    , 100 , {266, 264, 264}, {215, 352, 259}},
2988 
2989 		{USB11, 16   , 1200, {264, 263, 266}, {  0,   0,   0}},
2990 		{USB11, 16   , 600 , {257, 256, 253}, {  0,   0,   0}},
2991 		{USB11, 16   , 300 , {259, 252, 254}, {  0,   0,   0}},
2992 		{USB11, 16   , 200 , {257, 255, 253}, {  0,   0,   0}},
2993 		{USB11, 16   , 100 , {258, 259, 256}, {  0,   0,   0}}
2994 	};
2995 
2996 	struct st_wref *rf;
2997 
2998 	*red = *green = *blue = 0x50;
2999 
3000 	if (res <= 100)
3001 		res = 100;
3002 	else if (res <= 200)
3003 		res = 200;
3004 	else if (res <= 300)
3005 		res = 300;
3006 	else if (res <= 600)
3007 		res = 600;
3008 	else res = 1200;
3009 
3010 	if (scantype != ST_NORMAL)
3011 	{
3012 		SANE_Int a;
3013 		SANE_Int count = sizeof(wrefs) / sizeof(struct st_wref);
3014 
3015 		for (a = 0; a < count; a++)
3016 		{
3017 			rf = &wrefs[a];
3018 			if ((rf->usb == usb)&&(rf->depth == depth)&&(rf->res == res))
3019 			{
3020 				switch(scantype)
3021 				{
3022 					case ST_NEG:
3023 						*red   = rf->negative[CL_RED];
3024 						*green = rf->negative[CL_GREEN];
3025 						*blue  = rf->negative[CL_BLUE];
3026 						break;
3027 					case ST_TA:
3028 						*red   = rf->transparent[CL_RED];
3029 						*green = rf->transparent[CL_GREEN];
3030 						*blue  = rf->transparent[CL_BLUE];
3031 						break;
3032 				}
3033 
3034 				break;
3035 			}
3036 		}
3037 	} else
3038 	{
3039 		/* reflective mode */
3040 		*red   = 233;
3041 		*green = 230;
3042 		*blue  = 222;
3043 	}
3044 }
3045 
hp3800_wrefs(SANE_Int res,SANE_Int scantype,SANE_Int * red,SANE_Int * green,SANE_Int * blue)3046 static void hp3800_wrefs(SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue)
3047 {
3048 	/* in this scanner, values are the same in all usb versions and depths */
3049 	struct st_wref
3050 	{
3051 		SANE_Int res;
3052 		SANE_Int transparent[3];
3053 		SANE_Int negative[3];
3054 	};
3055 
3056 	struct st_wref wrefs[] =
3057 	{
3058 		/* res , {transparent  }, {negative     } */
3059 		{  2400, {276, 279, 243}, { 98, 162, 229}},
3060 		{  1200, {276, 279, 243}, { 98, 162, 229}},
3061 		{   600, {276, 279, 243}, {100, 162, 229}},
3062 		{   300, {276, 279, 243}, {100, 162, 229}},
3063 		{   150, {276, 279, 243}, {100, 162, 229}},
3064 	};
3065 
3066 	struct st_wref *rf;
3067 
3068 	*red = *green = *blue = 0x50;
3069 
3070 	if (res <= 150)
3071 		res = 150;
3072 	else if (res <= 300)
3073 		res = 300;
3074 	else if (res <= 600)
3075 		res = 600;
3076 	else if (res <= 1200)
3077 		res = 1200;
3078 	else res = 2400;
3079 
3080 	if (scantype != ST_NORMAL)
3081 	{
3082 		SANE_Int a;
3083 		SANE_Int count = sizeof(wrefs) / sizeof(struct st_wref);
3084 
3085 		for (a = 0; a < count; a++)
3086 		{
3087 			rf = &wrefs[a];
3088 			if (rf->res == res)
3089 			{
3090 				switch(scantype)
3091 				{
3092 					case ST_NEG:
3093 						*red   = rf->negative[CL_RED];
3094 						*green = rf->negative[CL_GREEN];
3095 						*blue  = rf->negative[CL_BLUE];
3096 						break;
3097 					case ST_TA:
3098 						*red   = rf->transparent[CL_RED];
3099 						*green = rf->transparent[CL_GREEN];
3100 						*blue  = rf->transparent[CL_BLUE];
3101 						break;
3102 				}
3103 
3104 				break;
3105 			}
3106 		}
3107 	} else
3108 	{
3109 		/* reflective mode */
3110 		*red   = 248;
3111 		*green = 250;
3112 		*blue  = 248;
3113 	}
3114 }
3115 
hp4370_wrefs(SANE_Int res,SANE_Int scantype,SANE_Int * red,SANE_Int * green,SANE_Int * blue)3116 static void hp4370_wrefs(SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue)
3117 {
3118 	struct st_wref
3119 	{
3120 		SANE_Int res;
3121 		SANE_Int transparent[3];
3122 		SANE_Int negative[3];
3123 	};
3124 
3125 	/* values are the same in all usb versions and depths */
3126 
3127 	struct st_wref wrefs[] =
3128 	{
3129 		/* res, {transparent  }, {negative} */
3130 		{ 4800, { 93,  93,  82}, {156, 308, 454}},
3131 		{ 2400, { 93,  93,  82}, {156, 156, 153}},
3132 		{ 1200, { 93,  93,  82}, {156, 156, 153}},
3133 		{  600, { 93,  93,  82}, {155, 155, 152}},
3134 		{  300, { 94,  94,  83}, {155, 155, 152}},
3135 		{  150, { 86,  87,  77}, {148, 145, 138}}
3136 	};
3137 
3138 	struct st_wref *rf;
3139 
3140 	SANE_Int a;
3141 
3142 	*red = *green = *blue = 0x50;
3143 
3144 	if (res <= 150)
3145 		res = 150;
3146 	else if (res <= 300)
3147 		res = 300;
3148 	else if (res <= 600)
3149 		res = 600;
3150 	else if (res <= 1200)
3151 		res = 1200;
3152 	else if (res <= 2400)
3153 		res = 2400;
3154 	else res = 4800;
3155 
3156 	if (scantype != ST_NORMAL)
3157 	{
3158 		SANE_Int count = sizeof(wrefs) / sizeof(struct st_wref);
3159 
3160 		for (a = 0; a < count; a++)
3161 		{
3162 			rf = &wrefs[a];
3163 			if (rf->res == res)
3164 			{
3165 				switch(scantype)
3166 				{
3167 					case ST_NEG:
3168 						*red   = rf->negative[CL_RED];
3169 						*green = rf->negative[CL_GREEN];
3170 						*blue  = rf->negative[CL_BLUE];
3171 						break;
3172 					case ST_TA:
3173 						*red   = rf->transparent[CL_RED];
3174 						*green = rf->transparent[CL_GREEN];
3175 						*blue  = rf->transparent[CL_BLUE];
3176 						break;
3177 				}
3178 
3179 				break;
3180 			}
3181 		}
3182 	} else
3183 	{
3184 		/* reflective mode */
3185 		*red   = 233;
3186 		*green = 232;
3187 		*blue  = 223;
3188 	}
3189 }
3190 
cfg_wrefs_get(SANE_Int sensortype,SANE_Int depth,SANE_Int res,SANE_Int scantype,SANE_Int * red,SANE_Int * green,SANE_Int * blue)3191 static void cfg_wrefs_get(SANE_Int sensortype, SANE_Int depth, SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue)
3192 {
3193 	switch(RTS_Debug->dev_model)
3194 	{
3195 		case UA4900:
3196 			ua4900_wrefs(RTS_Debug->usbtype, depth, res, scantype, red, green, blue);
3197 			break;
3198 
3199 		case HP3800:
3200 		case HPG2710:
3201 			hp3800_wrefs(res, scantype, red, green, blue);
3202 			break;
3203 
3204 		case HP4370:
3205 		case HPG3010:
3206 		case HPG3110:
3207 			hp4370_wrefs(res, scantype, red, green, blue);
3208 			break;
3209 
3210 		default:
3211 			/* hp3970 and hp4070 */
3212 			hp3970_wrefs(RTS_Debug->usbtype, sensortype, depth, res, scantype, red, green, blue);
3213 			break;
3214 	}
3215 }
3216 
hp3800_shading_cut(SANE_Int res,SANE_Int scantype,SANE_Int * red,SANE_Int * green,SANE_Int * blue)3217 static void hp3800_shading_cut(SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue)
3218 {
3219 	/*  values are the same in all usb versions and depths */
3220 	struct st_cut
3221 	{
3222 		SANE_Int res;
3223 		SANE_Int reflective[3];
3224 		SANE_Int transparent[3];
3225 		SANE_Int negative[3];
3226 	};
3227 
3228 	struct st_cut cuts[] =
3229 	{
3230 		/* res, {reflective }, {transparent  }, {negative       } */
3231 		{ 2400, { -6, -6, -6}, {-75, -75, -75}, {440, -300, -250}},
3232 		{ 1200, { -6, -6, -6}, {-75, -75, -75}, {440, -300, -250}},
3233 		{  600, { 10,  9, 12}, {-75, -75, -75}, {440, -300, -250}},
3234 		{  300, { -6, -6, -6}, {-75, -75, -75}, {440, -300, -250}},
3235 		{  150, { -6, -6, -6}, {-75, -75, -75}, {440, -300, -250}}
3236 	};
3237 
3238 	struct st_cut *ct;
3239 
3240 	SANE_Int a;
3241 	SANE_Int count = sizeof(cuts) / sizeof(struct st_cut);
3242 
3243 	*red = *green = *blue = 0;
3244 
3245 	if (res <= 150)
3246 		res = 150;
3247 	else if (res <= 300)
3248 		res = 300;
3249 	else if (res <= 600)
3250 		res = 600;
3251 	else if (res <= 1200)
3252 		res = 1200;
3253 	else res = 2400;
3254 
3255 	for (a = 0; a < count; a++)
3256 	{
3257 		ct = &cuts[a];
3258 		if (ct->res == res)
3259 		{
3260 			switch(scantype)
3261 			{
3262 				case ST_NEG:
3263 					*red   = ct->negative[CL_RED];
3264 					*green = ct->negative[CL_GREEN];
3265 					*blue  = ct->negative[CL_BLUE];
3266 					break;
3267 				case ST_TA:
3268 					*red   = ct->transparent[CL_RED];
3269 					*green = ct->transparent[CL_GREEN];
3270 					*blue  = ct->transparent[CL_BLUE];
3271 					break;
3272 				default: /* reflective */
3273 					*red   = ct->reflective[CL_RED];
3274 					*green = ct->reflective[CL_GREEN];
3275 					*blue  = ct->reflective[CL_BLUE];
3276 					break;
3277 			}
3278 			break;
3279 		}
3280 	}
3281 }
3282 
hp3970_shading_cut(SANE_Int usb,SANE_Int ccd,SANE_Int depth,SANE_Int res,SANE_Int scantype,SANE_Int * red,SANE_Int * green,SANE_Int * blue)3283 static void hp3970_shading_cut(SANE_Int usb, SANE_Int ccd, SANE_Int depth, SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue)
3284 {
3285 	struct st_cut
3286 	{
3287 		SANE_Int usb;
3288 		SANE_Int sensor;
3289 		SANE_Int depth;
3290 		SANE_Int res;
3291 		SANE_Int reflective[3];
3292 		SANE_Int transparent[3];
3293 		SANE_Int negative[3];
3294 	};
3295 
3296 	struct st_cut cuts[] =
3297 	{
3298 		/*usb , sensor     , depth, res , {reflective   }, {transparent  }, {negative} */
3299 		{USB20, CCD_SENSOR, 8    , 2400, {-15, -15, -15}, {  0,   0,   0}, {63, 0, 3}},
3300 		{USB20, CCD_SENSOR, 8    , 1200, {-15, -15, -15}, {  0,   0,   0}, {63, 0, 5}},
3301 		{USB20, CCD_SENSOR, 8    , 600 , {-15, -15, -15}, {  0,   0,   0}, {75, 0, 5}},
3302 		{USB20, CCD_SENSOR, 8    , 300 , {-15, -15, -15}, {  0,   0,   0}, {75, 0, 5}},
3303 		{USB20, CCD_SENSOR, 8    , 200 , {-15, -15, -15}, {  0,   0,   0}, {75, 0, 5}},
3304 		{USB20, CCD_SENSOR, 8    , 100 , {-15, -15, -15}, {  0,   0,   0}, {75, 0, 5}},
3305 
3306 		{USB20, CCD_SENSOR, 16   , 2400, {-15, -15, -15}, { -7,  -7,  -7}, {43, 0, 3}},
3307 		{USB20, CCD_SENSOR, 16   , 1200, {-15, -15, -15}, {-15, -15, -15}, {63, 0, 5}},
3308 		{USB20, CCD_SENSOR, 16   , 600 , {-15, -15, -15}, {-15, -15, -15}, {75, 0, 5}},
3309 		{USB20, CCD_SENSOR, 16   , 300 , {-15, -15, -15}, {-15, -15, -15}, {75, 0, 5}},
3310 		{USB20, CCD_SENSOR, 16   , 200 , {-15, -15, -15}, {-15, -15, -15}, {75, 0, 5}},
3311 		{USB20, CCD_SENSOR, 16   , 100 , {-15, -15, -15}, {-15, -15, -15}, {75, 0, 5}},
3312 
3313 		/*usb , sensor    , depth, res , {reflective   }, {transparent  }, {negative} */
3314 		{USB20, CIS_SENSOR, 8    , 2400, {-15, -15, -15}, {-68, -37, -43}, { 0, 0, 0}},
3315 		{USB20, CIS_SENSOR, 8    , 1200, {-15, -15, -15}, {-20, -20, -28}, { 0, 0, 0}},
3316 		{USB20, CIS_SENSOR, 8    , 600 , {-15, -15, -15}, {  0,   0,   0}, { 0, 0, 0}},
3317 		{USB20, CIS_SENSOR, 8    , 300 , {-15, -15, -15}, {  0,   0,   0}, { 0, 0, 0}},
3318 		{USB20, CIS_SENSOR, 8    , 200 , {-15, -15, -15}, {  0,   0,   0}, { 0, 0, 0}},
3319 		{USB20, CIS_SENSOR, 8    , 100 , {-15, -15, -15}, {  0,   0,   0}, { 0, 0, 0}},
3320 
3321 		{USB20, CIS_SENSOR, 16   , 2400, {-15, -15, -15}, {-68, -37, -43}, { 0, 0, 0}},
3322 		{USB20, CIS_SENSOR, 16   , 1200, {-15, -15, -15}, {-20, -20, -28}, { 0, 0, 0}},
3323 		{USB20, CIS_SENSOR, 16   , 600 , {-15, -15, -15}, {  0,   0,   0}, { 0, 0, 0}},
3324 		{USB20, CIS_SENSOR, 16   , 300 , {-15, -15, -15}, {  0,   0,   0}, { 0, 0, 0}},
3325 		{USB20, CIS_SENSOR, 16   , 200 , {-15, -15, -15}, {  0,   0,   0}, { 0, 0, 0}},
3326 		{USB20, CIS_SENSOR, 16   , 100 , {-15, -15, -15}, {  0,   0,   0}, { 0, 0, 0}},
3327 
3328 		/*usb , sensor     , depth, res , {reflective   }, {transparent  }, {negative} */
3329 		{USB11, CCD_SENSOR, 8    , 2400, {-15, -15, -15}, {  0,   0,   0}, {63, 0, 3}},
3330 		{USB11, CCD_SENSOR, 8    , 1200, {-15, -15, -15}, {  0,   0,   0}, {63, 0, 5}},
3331 		{USB11, CCD_SENSOR, 8    , 600 , {-15, -15, -15}, {  0,   0,   0}, {50, 0, 5}},
3332 		{USB11, CCD_SENSOR, 8    , 300 , {-15, -15, -15}, {  0,   0,   0}, {50, 0, 5}},
3333 		{USB11, CCD_SENSOR, 8    , 200 , {-15, -15, -15}, {  0,   0,   0}, {50, 0, 5}},
3334 		{USB11, CCD_SENSOR, 8    , 100 , {-15, -15, -15}, {  0,   0,   0}, {50, 0, 5}},
3335 
3336 		{USB11, CCD_SENSOR, 16   , 2400, {-15, -15, -15}, { -7,  -7,  -7}, {43, 0, 3}},
3337 		{USB11, CCD_SENSOR, 16   , 1200, {-15, -15, -15}, {-15, -15, -15}, {63, 0, 5}},
3338 		{USB11, CCD_SENSOR, 16   , 600 , {-15, -15, -15}, {-15, -15, -15}, {50, 0, 5}},
3339 		{USB11, CCD_SENSOR, 16   , 300 , {-15, -15, -15}, {-15, -15, -15}, {50, 0, 5}},
3340 		{USB11, CCD_SENSOR, 16   , 200 , {-15, -15, -15}, {-15, -15, -15}, {50, 0, 5}},
3341 		{USB11, CCD_SENSOR, 16   , 100 , {-15, -15, -15}, {-15, -15, -15}, {50, 0, 5}},
3342 
3343 		/*usb , sensor    , depth, res , {reflective   }, {transparent  }, {negative} */
3344 		{USB11, CIS_SENSOR, 8    , 2400, {-15, -15, -15}, {-68, -37, -43}, { 0, 0, 0}},
3345 		{USB11, CIS_SENSOR, 8    , 1200, {-15, -15, -15}, {-20, -20, -28}, { 0, 0, 0}},
3346 		{USB11, CIS_SENSOR, 8    , 600 , {-15, -15, -15}, {  0,   0,   0}, { 0, 0, 0}},
3347 		{USB11, CIS_SENSOR, 8    , 300 , {-15, -15, -15}, {  0,   0,   0}, { 0, 0, 0}},
3348 		{USB11, CIS_SENSOR, 8    , 200 , {-15, -15, -15}, {  0,   0,   0}, { 0, 0, 0}},
3349 		{USB11, CIS_SENSOR, 8    , 100 , {-15, -15, -15}, {  0,   0,   0}, { 0, 0, 0}},
3350 
3351 		{USB11, CIS_SENSOR, 16   , 2400, {-15, -15, -15}, {-68, -37, -43}, { 0, 0, 0}},
3352 		{USB11, CIS_SENSOR, 16   , 1200, {-15, -15, -15}, {-20, -20, -28}, { 0, 0, 0}},
3353 		{USB11, CIS_SENSOR, 16   , 600 , {-15, -15, -15}, {  0,   0,   0}, { 0, 0, 0}},
3354 		{USB11, CIS_SENSOR, 16   , 300 , {-15, -15, -15}, {  0,   0,   0}, { 0, 0, 0}},
3355 		{USB11, CIS_SENSOR, 16   , 200 , {-15, -15, -15}, {  0,   0,   0}, { 0, 0, 0}},
3356 		{USB11, CIS_SENSOR, 16   , 100 , {-15, -15, -15}, {  0,   0,   0}, { 0, 0, 0}}
3357 	};
3358 
3359 	struct st_cut *ct;
3360 
3361 	SANE_Int a;
3362 	SANE_Int count = sizeof(cuts) / sizeof(struct st_cut);
3363 
3364 	*red = *green = *blue = 0;
3365 
3366 	if (res <= 100)
3367 		res = 100;
3368 	else if (res <= 200)
3369 		res = 200;
3370 	else if (res <= 300)
3371 		res = 300;
3372 	else if (res <= 600)
3373 		res = 600;
3374 	else if (res <= 1200)
3375 		res = 1200;
3376 	else res = 2400;
3377 
3378 	for (a = 0; a < count; a++)
3379 	{
3380 		ct = &cuts[a];
3381 		if ((ct->usb == usb)&&(ct->sensor == ccd)&&(ct->depth == depth)&&(ct->res == res))
3382 		{
3383 			switch(scantype)
3384 			{
3385 				case ST_NEG:
3386 					*red   = ct->negative[CL_RED];
3387 					*green = ct->negative[CL_GREEN];
3388 					*blue  = ct->negative[CL_BLUE];
3389 					break;
3390 				case ST_TA:
3391 					*red   = ct->transparent[CL_RED];
3392 					*green = ct->transparent[CL_GREEN];
3393 					*blue  = ct->transparent[CL_BLUE];
3394 					break;
3395 				default: /* reflective */
3396 					*red   = ct->reflective[CL_RED];
3397 					*green = ct->reflective[CL_GREEN];
3398 					*blue  = ct->reflective[CL_BLUE];
3399 					break;
3400 			}
3401 			break;
3402 		}
3403 	}
3404 }
3405 
hp4370_shading_cut(SANE_Int depth,SANE_Int res,SANE_Int scantype,SANE_Int * red,SANE_Int * green,SANE_Int * blue)3406 static void hp4370_shading_cut(SANE_Int depth, SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue)
3407 {
3408 	struct st_cut
3409 	{
3410 		SANE_Int depth;
3411 		SANE_Int res;
3412 		SANE_Int reflective[3];
3413 		SANE_Int transparent[3];
3414 		SANE_Int negative[3];
3415 	};
3416 
3417 	/* values are the same in all usb versions for each depth */
3418 	struct st_cut cuts[] =
3419 	{
3420 		/* depth, res , {reflective   }, {transparent  }, {negative    } */
3421 		{    8  , 4800, {  0,   0,   0}, { -3,  -3,  -3}, {35, -10,  -7}},
3422 		{    8  , 2400, {-15, -15, -15}, { -3,  -3,  -3}, {35, -10,  -7}},
3423 		{    8  , 1200, {-15, -15, -15}, { -3,  -3,  -3}, {35, -10, -22}},
3424 		{    8  , 600 , {-15, -15, -15}, { -2,  -2,  -2}, {38, -10, -22}},
3425 		{    8  , 300 , {-15, -15, -15}, { -2,  -2,  -2}, {38, -10, -22}},
3426 		{    8  , 150 , {-15, -15, -15}, {  0,   0,   0}, {50, -23, -14}},
3427 
3428 		{   16  , 4800, {  0,   0,   0}, { -3,  -3,  -3}, {35, -10,  -7}},
3429 		{   16  , 2400, {-15, -15, -15}, { -3,  -3,  -3}, {35, -10,  -7}},
3430 		{   16  , 1200, {-15, -15, -15}, { -3,  -3,  -3}, {35, -10, -22}},
3431 		{   16  , 600 , {-15, -15, -15}, { -2,  -2,  -2}, {38, -10, -22}},
3432 		{   16  , 300 , {-15, -15, -15}, { -2,  -2,  -2}, {38, -10, -22}},
3433 		{   16  , 150 , {-15, -15, -15}, {-15, -15, -15}, {40, -15,  -5}}
3434 	};
3435 
3436 	struct st_cut *ct;
3437 
3438 	SANE_Int a;
3439 	SANE_Int count = sizeof(cuts) / sizeof(struct st_cut);
3440 
3441 	*red = *green = *blue = 0;
3442 
3443 	if (res <= 150)
3444 		res = 150;
3445 	else if (res <= 300)
3446 		res = 300;
3447 	else if (res <= 600)
3448 		res = 600;
3449 	else if (res <= 1200)
3450 		res = 1200;
3451 	else if (res <= 2400)
3452 		res = 2400;
3453 	else res = 4800;
3454 
3455 	for (a = 0; a < count; a++)
3456 	{
3457 		ct = &cuts[a];
3458 		if ((ct->depth == depth)&&(ct->res == res))
3459 		{
3460 			switch(scantype)
3461 			{
3462 				case ST_NEG:
3463 					*red   = ct->negative[CL_RED];
3464 					*green = ct->negative[CL_GREEN];
3465 					*blue  = ct->negative[CL_BLUE];
3466 					break;
3467 				case ST_TA:
3468 					*red   = ct->transparent[CL_RED];
3469 					*green = ct->transparent[CL_GREEN];
3470 					*blue  = ct->transparent[CL_BLUE];
3471 					break;
3472 				default: /* reflective */
3473 					*red   = ct->reflective[CL_RED];
3474 					*green = ct->reflective[CL_GREEN];
3475 					*blue  = ct->reflective[CL_BLUE];
3476 					break;
3477 			}
3478 			break;
3479 		}
3480 	}
3481 }
3482 
ua4900_shading_cut(SANE_Int usb,SANE_Int depth,SANE_Int res,SANE_Int scantype,SANE_Int * red,SANE_Int * green,SANE_Int * blue)3483 static void ua4900_shading_cut(SANE_Int usb, SANE_Int depth, SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue)
3484 {
3485 	struct st_cut
3486 	{
3487 		SANE_Int usb;
3488 		SANE_Int depth;
3489 		SANE_Int res;
3490 		SANE_Int reflective[3];
3491 		SANE_Int transparent[3];
3492 		SANE_Int negative[3];
3493 	};
3494 
3495 	struct st_cut cuts[] =
3496 	{
3497 		/*usb , depth, res , {reflective   }, {transparent  }, {negative    } */
3498 		{USB20, 8    , 1200, {-15, -17, -13}, {  6,   0,   0}, {110, 15, 250}},
3499 		{USB20, 8    , 600 , {-16, -15, -15}, {  6,   7,   5}, {105, 11,  20}},
3500 		{USB20, 8    , 300 , {-15, -15, -15}, {  6,   7,   5}, {105, 10,  25}},
3501 		{USB20, 8    , 200 , {-15, -15, -15}, {  5,   5,   5}, {110, 15,  32}},
3502 		{USB20, 8    , 100 , {-15, -15, -15}, {  5,   5,   5}, {110, 15,  32}},
3503 
3504 		{USB20, 16   , 1200, {-15, -15, -15}, {  5,   5,   5}, { 0,   0,   0}},
3505 		{USB20, 16   , 600 , {-15, -15, -15}, {  5,   5,   5}, { 0,   0,   0}},
3506 		{USB20, 16   , 300 , {-15, -15, -15}, {  5,   5,   5}, { 0,   0,   0}},
3507 		{USB20, 16   , 200 , {-15, -15, -15}, {  5,   5,   5}, { 0,   0,   0}},
3508 		{USB20, 16   , 100 , {-15, -15, -15}, {  5,   5,   5}, { 0,   0,   0}},
3509 
3510 		/*usb , depth, res , {reflective   }, {transparent  }, {negative    } */
3511 		{USB11, 8    , 1200, {-15, -17, -13}, {  5,   5,   5}, {105, 12,  23}},
3512 		{USB11, 8    , 600 , {-17, -15, -16}, {  8,   8,   8}, {105, 12,  20}},
3513 		{USB11, 8    , 300 , {-15, -15, -15}, {  8,   8,   8}, {105, 15,  25}},
3514 		{USB11, 8    , 200 , {-15, -15, -15}, {  8,   8,   8}, {105, 40,  25}},
3515 		{USB11, 8    , 100 , {-15, -15, -15}, {  8,   8,   8}, {-20, 50,  23}},
3516 
3517 		{USB11, 16   , 1200, {-15, -15, -15}, {  5,   5,   5}, { 0,   0,   0}},
3518 		{USB11, 16   , 600 , {-15, -15, -15}, {  5,   5,   5}, { 0,   0,   0}},
3519 		{USB11, 16   , 300 , {-15, -15, -15}, {  5,   5,   5}, { 0,   0,   0}},
3520 		{USB11, 16   , 200 , {-15, -15, -15}, {  5,   5,   5}, { 0,   0,   0}},
3521 		{USB11, 16   , 100 , {-15, -15, -15}, {  5,   5,   5}, { 0,   0,   0}}
3522 	};
3523 
3524 	struct st_cut *ct;
3525 
3526 	SANE_Int a;
3527 	SANE_Int count = sizeof(cuts) / sizeof(struct st_cut);
3528 
3529 	*red = *green = *blue = 0;
3530 
3531 	if (res <= 100)
3532 		res = 100;
3533 	else if (res <= 200)
3534 		res = 200;
3535 	else if (res <= 300)
3536 		res = 300;
3537 	else if (res <= 600)
3538 		res = 600;
3539 	else res = 1200;
3540 
3541 	for (a = 0; a < count; a++)
3542 	{
3543 		ct = &cuts[a];
3544 		if ((ct->usb == usb)&&(ct->depth == depth)&&(ct->res == res))
3545 		{
3546 			switch(scantype)
3547 			{
3548 				case ST_NEG:
3549 					*red   = ct->negative[CL_RED];
3550 					*green = ct->negative[CL_GREEN];
3551 					*blue  = ct->negative[CL_BLUE];
3552 					break;
3553 				case ST_TA:
3554 					*red   = ct->transparent[CL_RED];
3555 					*green = ct->transparent[CL_GREEN];
3556 					*blue  = ct->transparent[CL_BLUE];
3557 					break;
3558 				default: /* reflective */
3559 					*red   = ct->reflective[CL_RED];
3560 					*green = ct->reflective[CL_GREEN];
3561 					*blue  = ct->reflective[CL_BLUE];
3562 					break;
3563 			}
3564 			break;
3565 		}
3566 	}
3567 }
3568 
cfg_shading_cut_get(SANE_Int sensortype,SANE_Int depth,SANE_Int res,SANE_Int scantype,SANE_Int * red,SANE_Int * green,SANE_Int * blue)3569 static void cfg_shading_cut_get(SANE_Int sensortype, SANE_Int depth, SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue)
3570 {
3571 	switch(RTS_Debug->dev_model)
3572 	{
3573 		case UA4900:
3574 			ua4900_shading_cut(RTS_Debug->usbtype, depth, res, scantype, red, green, blue);
3575 			break;
3576 
3577 		case HP3800:
3578 		case HPG2710:
3579 			hp3800_shading_cut(res, scantype, red, green, blue);
3580 			break;
3581 
3582 		case HP4370:
3583 		case HPG3010:
3584 		case HPG3110:
3585 			hp4370_shading_cut(depth, res, scantype, red, green, blue);
3586 			break;
3587 
3588 		default:
3589 			/* hp3970 and hp4070 */
3590 			hp3970_shading_cut(RTS_Debug->usbtype, sensortype, depth, res, scantype, red, green, blue);
3591 			break;
3592 	}
3593 }
3594 
3595 /** SEC: Sensor Timings ---------- */
3596 
3597 /* ccd timing values for bq5550 scanner */
bq5550_timing_get(SANE_Int tm,struct st_timing * reg)3598 static SANE_Int bq5550_timing_get(SANE_Int tm, struct st_timing *reg)
3599 {
3600 	SANE_Int rst = ERROR;
3601 
3602 	if ((tm < 7)&&(reg != NULL))
3603 	{
3604 		/* bq5550 sensor timing values for each resolution and color mode */
3605 
3606 		struct st_timing data[] =
3607 		{
3608 			/* res , cnpp, {cvtrp 1 2 3     }, cvtrw, cvtrfpw, cvtrbpw, {{cphp1       , cphp2       , cphps, cphge, cphgo}, {cphp1       , cphp2       , cphps, cphge, cphgo}, {cphp1       , cphp2       , cphps, cphge, cphgo}, {cphp1       , cphp2       , cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}}, cphbp2s, cphbp2e, clamps, clampe , {cdss1, cdss2}, {cdsc1, cdsc2}, {cdscs1, cdscs2}, {adcclkp 1 y 2             }, adcclkp2e */
3609 			{0x04B0, 0x23, {0x00, 0x00, 0x00}, 0x16 , 0x02   , 0x02   , {{67645734915., 0.          , 0x00 , 0x01 , 0x00 }, {132120576.  , 0.          , 0x00 , 0x01 , 0x00 }, {68585259519., 0.          , 0x01 , 0x01 , 0x00 }, {134217216.  , 0.          , 0x01 , 0x01 , 0x01 }, {68585259519., 0.   , 0x01 , 0x01 , 0x00 }, {134217216.  , 0.   , 0x01 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x11000, {0x0F , 0x1F }, {0x12 , 0x22 }, {0x00  , 0x00  }, {4228890876. , 0.          }, 0x00},
3610 			{0x0258, 0x23, {0x00, 0x00, 0x00}, 0x16 , 0x02   , 0x02   , {{66571993091., 0.          , 0x00 , 0x01 , 0x00 }, {132120576.  , 0.          , 0x00 , 0x01 , 0x00 }, {131071.     , 0.          , 0x00 , 0x01 , 0x00 }, {68719345664., 0.          , 0x00 , 0x01 , 0x01 }, {131071.     , 0.   , 0x00 , 0x01 , 0x00 }, {68719345664., 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x11000, {0x10 , 0x1F }, {0x13 , 0x22 }, {0x00  , 0x00  }, {4228890876. , 0.          }, 0x00},
3611 			{0x012C, 0x23, {0x00, 0x00, 0x00}, 0x16 , 0x02   , 0x02   , {{67645734915., 0.          , 0x00 , 0x01 , 0x00 }, {125829120.  , 0.          , 0x00 , 0x01 , 0x00 }, {67654057987., 0.          , 0x00 , 0x01 , 0x00 }, {1065418748. , 0.          , 0x00 , 0x01 , 0x01 }, {16383.      , 0.   , 0x00 , 0x01 , 0x00 }, {68182605824., 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x11000, {0x10 , 0x1F }, {0x13 , 0x22 }, {0x00  , 0x00  }, {4228890876. , 0.          }, 0x00},
3612 			{0x04B0, 0x23, {0x00, 0x00, 0x00}, 0x16 , 0x02   , 0x02   , {{67645734915., 0.          , 0x00 , 0x01 , 0x00 }, {132120576.  , 0.          , 0x00 , 0x01 , 0x00 }, {68585259519., 0.          , 0x01 , 0x01 , 0x00 }, {134217216.  , 0.          , 0x01 , 0x01 , 0x01 }, {68585259519., 0.   , 0x01 , 0x01 , 0x00 }, {134217216.  , 0.   , 0x01 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x11000, {0x0F , 0x1F }, {0x12 , 0x22 }, {0x00  , 0x00  }, {262140.     , 0.          }, 0x00},
3613 			{0x0258, 0x23, {0x00, 0x00, 0x00}, 0x16 , 0x02   , 0x02   , {{66571993091., 0.          , 0x00 , 0x01 , 0x00 }, {132120576.  , 0.          , 0x00 , 0x01 , 0x00 }, {131071.     , 0.          , 0x00 , 0x01 , 0x00 }, {68719345664., 0.          , 0x00 , 0x01 , 0x01 }, {131071.     , 0.   , 0x00 , 0x01 , 0x00 }, {68719345664., 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x11000, {0x10 , 0x1F }, {0x13 , 0x22 }, {0x00  , 0x00  }, {262140.     , 0.          }, 0x00},
3614 			{0x012C, 0x23, {0x00, 0x00, 0x00}, 0x16 , 0x02   , 0x02   , {{67645734915., 0.          , 0x00 , 0x01 , 0x00 }, {125829120.  , 0.          , 0x00 , 0x01 , 0x00 }, {67654057987., 0.          , 0x00 , 0x01 , 0x00 }, {1065418748. , 0.          , 0x00 , 0x01 , 0x01 }, {16383.      , 0.   , 0x00 , 0x01 , 0x00 }, {68182605824., 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x11000, {0x10 , 0x1F }, {0x13 , 0x22 }, {0x00  , 0x00  }, {524284.     , 0.          }, 0x00}
3615 		};
3616 
3617 		memcpy(reg, &data[tm], sizeof(struct st_timing));
3618 		rst = OK;
3619 	}
3620 
3621 	return rst;
3622 }
3623 
3624 /* ccd timing values for hp3800 scanner */
hp3800_timing_get(SANE_Int tm,struct st_timing * reg)3625 static SANE_Int hp3800_timing_get(SANE_Int tm, struct st_timing *reg)
3626 {
3627 	SANE_Int rst = ERROR;
3628 
3629 	if ((tm < 20)&&(reg != NULL))
3630 	{
3631 		/* Toshiba T2905 sensor timing values for each resolution and color mode */
3632 
3633 		struct st_timing data[] =
3634 		{
3635 			/* res , cnpp, {cvtrp 1 2 3     }, cvtrw, cvtrfpw, cvtrbpw, {{cphp1       , cphp2       , cphps, cphge, cphgo}, {cphp1       , cphp2       , cphps, cphge, cphgo}, {cphp1       , cphp2       , cphps, cphge, cphgo}, {cphp1       , cphp2       , cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}}, cphbp2s, cphbp2e, clamps, clampe , {cdss1, cdss2}, {cdsc1, cdsc2}, {cdscs1, cdscs2}, {adcclkp 1 y 2             }, adcclkp2e */
3636 			{0x0960, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{8589934588. , 0.          , 0x00 , 0x01 , 0x01 }, {68719476732., 0.          , 0x00 , 0x01 , 0x01 }, {134217216.  , 0.          , 0x01 , 0x01 , 0x00 }, {68585259519., 0.          , 0x01 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0x00   , 0x00   , 0x01  , -1     , {0x0F , 0x20 }, {0x11 , 0x22 }, {0x00  , 0x00  }, {4228890876. , 0.          }, 0x00},
3637 			{0x04B0, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{64692944895., 0.          , 0x00 , 0x01 , 0x01 }, {66571993087., 0.          , 0x00 , 0x01 , 0x01 }, {524287.     , 0.          , 0x00 , 0x01 , 0x00 }, {68718952448., 0.          , 0x00 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0x00   , 0x00   , 0x01  , -1     , {0x10 , 0x20 }, {0x11 , 0x22 }, {0x00  , 0x00  }, {4228890876. , 0.          }, 0x00},
3638 			{0x0258, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{68719476732., 0.          , 0x00 , 0x01 , 0x01 }, {68719476733., 0.          , 0x00 , 0x01 , 0x01 }, {1069563840. , 0.          , 0x00 , 0x01 , 0x00 }, {67649912895., 0.          , 0x00 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0x00   , 0x00   , 0x01  , -1     , {0x02 , 0x21 }, {0x03 , 0x22 }, {0x00  , 0x00  }, {4228890876. , 0.          }, 0x00},
3639 			{0x012C, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{68719476732., 0.          , 0x00 , 0x01 , 0x01 }, {68719476733., 0.          , 0x00 , 0x01 , 0x01 }, {477225440.  , 0.          , 0x00 , 0x01 , 0x00 }, {68242251295., 0.          , 0x00 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0x00   , 0x00   , 0x01  , -1     , {0x02 , 0x21 }, {0x04 , 0x22 }, {0x00  , 0x00  }, {4228890876. , 0.          }, 0x00},
3640 			{0x0096, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{68719476732., 0.          , 0x00 , 0x01 , 0x01 }, {68719476733., 0.          , 0x00 , 0x01 , 0x01 }, {13743895344., 0.          , 0x00 , 0x01 , 0x00 }, {54975581391., 0.          , 0x00 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0x00   , 0x00   , 0x01  , -1     , {0x01 , 0x21 }, {0x02 , 0x22 }, {0x00  , 0x00  }, {4228890876. , 0.          }, 0x00},
3641 
3642 			{0x0960, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{8589934588. , 0.          , 0x00 , 0x01 , 0x01 }, {68719476732., 0.          , 0x00 , 0x01 , 0x01 }, {134217216.  , 0.          , 0x01 , 0x01 , 0x00 }, {68585259519., 0.          , 0x01 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0x00   , 0x00   , 0x01  , -1     , {0x0F , 0x20 }, {0x11 , 0x22 }, {0x00  , 0x00  }, {1048572.    , 0.          }, 0x00},
3643 			{0x04B0, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{64692944895., 0.          , 0x00 , 0x01 , 0x01 }, {66571993087., 0.          , 0x00 , 0x01 , 0x01 }, {524287.     , 0.          , 0x00 , 0x01 , 0x00 }, {68718952448., 0.          , 0x00 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0x00   , 0x00   , 0x01  , -1     , {0x10 , 0x20 }, {0x11 , 0x22 }, {0x00  , 0x00  }, {1048572.    , 0.          }, 0x00},
3644 			{0x0258, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{68719476732., 0.          , 0x00 , 0x01 , 0x01 }, {68719476733., 0.          , 0x00 , 0x01 , 0x01 }, {1069563840. , 0.          , 0x00 , 0x01 , 0x00 }, {67649912895., 0.          , 0x00 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0x00   , 0x00   , 0x01  , -1     , {0x02 , 0x21 }, {0x03 , 0x22 }, {0x00  , 0x00  }, {1048572.    , 0.          }, 0x00},
3645 			{0x012C, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{68719476732., 0.          , 0x00 , 0x01 , 0x01 }, {68719476733., 0.          , 0x00 , 0x01 , 0x01 }, {477225440.  , 0.          , 0x00 , 0x01 , 0x00 }, {68242251295., 0.          , 0x00 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0x00   , 0x00   , 0x01  , -1     , {0x02 , 0x21 }, {0x04 , 0x22 }, {0x00  , 0x00  }, {1048572.    , 0.          }, 0x00},
3646 			{0x0258, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{68719476732., 0.          , 0x00 , 0x01 , 0x01 }, {68719476733., 0.          , 0x00 , 0x01 , 0x01 }, {266346464.  , 0.          , 0x00 , 0x01 , 0x00 }, {68453130271., 0.          , 0x00 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0x00   , 0x00   , 0x01  , -1     , {0x04 , 0x21 }, {0x06 , 0x22 }, {0x00  , 0x00  }, {4228890876. , 0.          }, 0x00},
3647 
3648 			{0x0960, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{8589934588. , 8589934588. , 0x00 , 0x01 , 0x01 }, {68719476732., 68719476732., 0x00 , 0x01 , 0x01 }, {134217216.  , 134217216.  , 0x01 , 0x01 , 0x00 }, {68585259519., 68585259519., 0x01 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0xFF   , 0x80FF , 0x01  , -1     , {0x0F , 0x20 }, {0x11 , 0x22 }, {0x00  , 0x00  }, {4228890876. , 0.          }, 0x00},
3649 			{0x04B0, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{64692944895., 64692944895., 0x00 , 0x01 , 0x01 }, {66571993087., 66571993087., 0x00 , 0x01 , 0x01 }, {524287.     , 524287.     , 0x00 , 0x01 , 0x00 }, {68718952448., 68718952448., 0x00 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0xFF   , 0x80FF , 0x01  , -1     , {0x10 , 0x20 }, {0x11 , 0x22 }, {0x00  , 0x00  }, {4228890876. , 0.          }, 0x00},
3650 			{0x0258, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{68719476732., 68719476732., 0x00 , 0x01 , 0x01 }, {68719476733., 68719476733., 0x00 , 0x01 , 0x01 }, {534781920.  , 534781920.  , 0x00 , 0x01 , 0x00 }, {68184694815., 68184694815., 0x00 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0xFF   , 0x20FF , 0x01  , -1     , {0x05 , 0x21 }, {0x07 , 0x22 }, {0x00  , 0x00  }, {4228890876. , 0.          }, 0x00},
3651 			{0x012C, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{68719476732., 68719476732., 0x00 , 0x01 , 0x01 }, {68719476733., 68719476733., 0x00 , 0x01 , 0x01 }, {477225440.  , 477225440.  , 0x00 , 0x01 , 0x00 }, {68242251295., 68242251295., 0x00 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0xFF   , 0x11FF , 0x01  , -1     , {0x02 , 0x21 }, {0x04 , 0x22 }, {0x00  , 0x00  }, {4228890876. , 0.          }, 0x00},
3652 			{0x0096, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{68719476732., 68719476732., 0x00 , 0x01 , 0x01 }, {68719476733., 68719476733., 0x00 , 0x01 , 0x01 }, {13743895344., 13743895344., 0x00 , 0x01 , 0x00 }, {54975581391., 54975581391., 0x00 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0xFF   , 0x110F , 0x01  , -1     , {0x01 , 0x21 }, {0x02 , 0x22 }, {0x00  , 0x00  }, {4228890876. , 0.          }, 0x00},
3653 
3654 			{0x0960, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{8589934588. , 8589934588. , 0x00 , 0x01 , 0x01 }, {68719476732., 68719476732., 0x00 , 0x01 , 0x01 }, {134217216.  , 134217216.  , 0x01 , 0x01 , 0x00 }, {68585259519., 68585259519., 0x01 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0xFF   , 0x80FF , 0x01  , -1     , {0x0F , 0x20 }, {0x11 , 0x22 }, {0x00  , 0x00  }, {1048572.    , 0.          }, 0x00},
3655 			{0x04B0, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{64692944895., 64692944895., 0x00 , 0x01 , 0x01 }, {66571993087., 66571993087., 0x00 , 0x01 , 0x01 }, {524287.     , 524287.     , 0x00 , 0x01 , 0x00 }, {68718952448., 68718952448., 0x00 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0xFF   , 0x80FF , 0x01  , -1     , {0x10 , 0x20 }, {0x11 , 0x22 }, {0x00  , 0x00  }, {1048572.    , 0.          }, 0x00},
3656 			{0x0258, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{68719476732., 68719476732., 0x00 , 0x01 , 0x01 }, {68719476733., 68719476733., 0x00 , 0x01 , 0x01 }, {534781920.  , 534781920.  , 0x00 , 0x01 , 0x00 }, {68184694815., 68184694815., 0x00 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0xFF   , 0x20FF , 0x01  , -1     , {0x05 , 0x21 }, {0x07 , 0x22 }, {0x00  , 0x00  }, {1048572.    , 0.          }, 0x00},
3657 			{0x012C, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{68719476732., 68719476732., 0x00 , 0x01 , 0x01 }, {68719476733., 68719476733., 0x00 , 0x01 , 0x01 }, {477225440.  , 477225440.  , 0x00 , 0x01 , 0x00 }, {68242251295., 68242251295., 0x00 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0xFF   , 0x110F , 0x01  , -1     , {0x02 , 0x21 }, {0x04 , 0x22 }, {0x00  , 0x00  }, {1048572.    , 0.          }, 0x00},
3658 			{0x0096, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{68719476732., 68719476732., 0x00 , 0x01 , 0x01 }, {68719476733., 68719476733., 0x00 , 0x01 , 0x01 }, {13743895344., 13743895344., 0x00 , 0x01 , 0x00 }, {54975581391., 54975581391., 0x00 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0xFF   , 0x110F , 0x01  , -1     , {0x01 , 0x21 }, {0x02 , 0x22 }, {0x00  , 0x00  }, {1048572.    , 0.          }, 0x00},
3659 		};
3660 
3661 		memcpy(reg, &data[tm], sizeof(struct st_timing));
3662 		rst = OK;
3663 	}
3664 
3665 	return rst;
3666 }
3667 
3668 /* ccd timing values for hp3970 scanner */
hp3970_timing_get(SANE_Int sensortype,SANE_Int tm,struct st_timing * reg)3669 static SANE_Int hp3970_timing_get(SANE_Int sensortype, SANE_Int tm, struct st_timing *reg)
3670 {
3671 	SANE_Int rst = ERROR;
3672 
3673 	if ((tm < 12)&&(reg != NULL))
3674 	{
3675 		rst = OK;
3676 		if (sensortype == CCD_SENSOR)
3677 		{
3678 			/* Toshiba T2952 sensor timing values for each resolution and color mode */
3679 			struct st_timing data[] =
3680 			{
3681 				/* res , cnpp, {cvtrp 1 2 3     }, cvtrw, cvtrfpw, cvtrbpw, {{cphp1       , cphp2, cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}}, cphbp2s, cphbp2e, clamps, clampe , {cdss1, cdss2}, {cdsc1, cdsc2}, {cdscs1, cdscs2}, {adcclkp 1 y 2             }, adcclkp2e */
3682 				{0x0960, 0x0B, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{0.          , 0.   , 0x00 , 0x01 , 0x00 }, {34376515584., 0.   , 0x00 , 0x01 , 0x00 }, {8455716864. , 0.   , 0x01 , 0x01 , 0x00 }, {60246982656., 0.   , 0x01 , 0x01 , 0x01 }, {68719214592., 0.   , 0x00 , 0x01 , 0x01 }, {68719214592., 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x24000, {0x04 , 0x09 }, {0x06 , 0x0B }, {0x00  , 0x00  }, {27481079808., 0.          }, 0x00},
3683 				{0x04B0, 0x1A, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{0.          , 0.   , 0x00 , 0x01 , 0x00 }, {64424511232., 0.   , 0x00 , 0x01 , 0x00 }, {68711088128., 0.   , 0x00 , 0x01 , 0x00 }, {8388352.    , 0.   , 0x00 , 0x01 , 0x01 }, {68719476480., 0.   , 0x00 , 0x01 , 0x01 }, {68719476480., 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x11000, {0x08 , 0x15 }, {0x0C , 0x18 }, {0x00  , 0x00  }, {33351135232., 33351135232.}, 0x01},
3684 				{0x0258, 0x17, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{0.          , 0.   , 0x00 , 0x01 , 0x00 }, {60129570816., 0.   , 0x00 , 0x01 , 0x00 }, {68719472640., 0.   , 0x00 , 0x01 , 0x01 }, {68719472640., 0.   , 0x00 , 0x01 , 0x01 }, {16773120.   , 0.   , 0x00 , 0x01 , 0x00 }, {68702699520., 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x05500, {0x09 , 0x12 }, {0x0C , 0x14 }, {0x00  , 0x00  }, {64677150720., 0.          }, 0x00},
3685 				{0x012C, 0x17, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{0.          , 0.   , 0x00 , 0x01 , 0x00 }, {51539611648., 0.   , 0x00 , 0x01 , 0x00 }, {68719472640., 0.   , 0x00 , 0x01 , 0x01 }, {68719472640., 0.   , 0x00 , 0x01 , 0x01 }, {1057222656. , 0.   , 0x00 , 0x01 , 0x00 }, {67662249984., 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x05500, {0x04 , 0x15 }, {0x06 , 0x17 }, {0x00  , 0x00  }, {8084643840. , 0.          }, 0x00},
3686 				{0x00C8, 0x1D, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{0.          , 0.   , 0x00 , 0x01 , 0x00 }, {68182605888., 0.   , 0x00 , 0x01 , 0x00 }, {68719476720., 0.   , 0x00 , 0x01 , 0x01 }, {68719476720., 0.   , 0x00 , 0x01 , 0x01 }, {16659267072., 0.   , 0x00 , 0x01 , 0x00 }, {52060209600., 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x05500, {0x0A , 0x1B }, {0x0C , 0x1D }, {0x00  , 0x00  }, {4164816768. , 0.          }, 0x00},
3687 				{0x0960, 0x0B, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{0.          , 0.   , 0x00 , 0x01 , 0x00 }, {34376515584., 0.   , 0x00 , 0x01 , 0x00 }, {8455716864. , 0.   , 0x01 , 0x01 , 0x00 }, {60246982656., 0.   , 0x01 , 0x01 , 0x01 }, {68719214592., 0.   , 0x00 , 0x01 , 0x01 }, {68719214592., 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x24000, {0x04 , 0x09 }, {0x06 , 0x0B }, {0x00  , 0x00  }, {2113929216. , 0.          }, 0x00},
3688 				{0x04B0, 0x1A, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{0.          , 0.   , 0x00 , 0x01 , 0x00 }, {64424511232., 0.   , 0x00 , 0x01 , 0x00 }, {68711088128., 0.   , 0x00 , 0x01 , 0x00 }, {8388352.    , 0.   , 0x00 , 0x01 , 0x01 }, {68719476480., 0.   , 0x00 , 0x01 , 0x01 }, {68719476480., 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x11000, {0x08 , 0x15 }, {0x0C , 0x18 }, {0x00  , 0x00  }, {67104768.   , 67104768.   }, 0x01},
3689 				{0x0258, 0x17, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{0.          , 0.   , 0x00 , 0x01 , 0x00 }, {60129570816., 0.   , 0x00 , 0x01 , 0x00 }, {68719472640., 0.   , 0x00 , 0x01 , 0x01 }, {68719472640., 0.   , 0x00 , 0x01 , 0x01 }, {16773120.   , 0.   , 0x00 , 0x01 , 0x00 }, {68702699520., 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x05500, {0x09 , 0x12 }, {0x0C , 0x14 }, {0x00  , 0x00  }, {268369920.  , 0.          }, 0x00},
3690 				{0x012C, 0x17, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{0.          , 0.   , 0x00 , 0x01 , 0x00 }, {51539611648., 0.   , 0x00 , 0x01 , 0x00 }, {68719472640., 0.   , 0x00 , 0x01 , 0x01 }, {68719472640., 0.   , 0x00 , 0x01 , 0x01 }, {1057222656. , 0.   , 0x00 , 0x01 , 0x00 }, {67662249984., 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x05500, {0x04 , 0x15 }, {0x06 , 0x17 }, {0x00  , 0x00  }, {33546240.   , 0.          }, 0x00},
3691 				{0x00C8, 0x1D, {0x00, 0x00, 0x00}, 0x1E , 0x01   , 0x0F   , {{68585258944., 0.   , 0x00 , 0x01 , 0x00 }, {536870784.  , 0.   , 0x00 , 0x01 , 0x00 }, {16659267072., 0.   , 0x00 , 0x01 , 0x00 }, {52060209600., 0.   , 0x00 , 0x01 , 0x01 }, {0.          , 0.   , 0x00 , 0x01 , 0x00 }, {0.          , 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x05500, {0x0A , 0x1B }, {0x0C , 0x1C }, {0x00  , 0x00  }, {4194176.    , 0.          }, 0x00},
3692 				{0x0064, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{0.          , 0.   , 0x00 , 0x01 , 0x00 }, {34359738368., 0.   , 0x00 , 0x01 , 0x00 }, {68719476735., 0.   , 0x00 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x01 , 0x01 }, {7635497415. , 0.   , 0x00 , 0x01 , 0x00 }, {61083979320., 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x11000, {0x02 , 0x22 }, {0x03 , 0x23 }, {0x00  , 0x00  }, {2114445438. , 0.          }, 0x00},
3693 				{0x0064, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{0.          , 0.   , 0x00 , 0x01 , 0x00 }, {34359738368., 0.   , 0x00 , 0x01 , 0x00 }, {68719476735., 0.   , 0x00 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x01 , 0x01 }, {7635497415. , 0.   , 0x00 , 0x01 , 0x00 }, {61083979320., 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x11000, {0x02 , 0x22 }, {0x03 , 0x23 }, {0x00  , 0x00  }, {524286.     , 0.          }, 0x00}
3694 			};
3695 
3696 			memcpy(reg, &data[tm], sizeof(struct st_timing));
3697 		} else
3698 		{
3699 			/* Sony S575 sensor timing values for each resolution and color mode
3700 					I haven't found any hp3970 scanner using sony sensor but windows drivers support this case */
3701 			struct st_timing data[] =
3702 			{
3703 				/* res , cnpp, {cvtrp1  2    3  }, cvtrw, cvtrfpw, cvtrbpw, {{cphp1       , cphp2, cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}}, cphbp2s, cphbp2e, clamps, clampe , {cdss1, cdss2}, {cdsc1, cdsc2}, {cdscs1, cdscs2}, {adcclkp 1 y 2             }, adcclkp2e */
3704 				{0x0960, 0x0B, {0x00, 0x00, 0x00}, 0x1E , 0x01   , 0x0F   , {{60112764928., 0.   , 0x00 , 0x01 , 0x00 }, {34326183936., 0.   , 0x00 , 0x01 , 0x00 }, {1056964608. , 0.   , 0x01 , 0x01 , 0x00 }, {67645734912., 0.   , 0x01 , 0x01 , 0x01 }, {1056964608. , 0.   , 0x00 , 0x01 , 0x00 }, {67645734912., 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x24000, {0x05 , 0x09 }, {0x07 , 0x0b }, {0x00  , 0x00  }, {27481079808., 0.          }, 0x00},
3705 				{0x04B0, 0x1A, {0x00, 0x00, 0x00}, 0x1E , 0x01   , 0x0F   , {{68316823296., 0.   , 0x00 , 0x01 , 0x00 }, {42949672704., 0.   , 0x00 , 0x01 , 0x00 }, {4194048.    , 0.   , 0x00 , 0x01 , 0x00 }, {68715282432., 0.   , 0x00 , 0x01 , 0x01 }, {4194048.    , 0.   , 0x00 , 0x01 , 0x00 }, {68715282432., 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x11000, {0x0B , 0x17 }, {0x0D , 0x19 }, {0x00  , 0x00  }, {16675567616., 16675567616.}, 0x01},
3706 				{0x0258, 0x17, {0x00, 0x00, 0x00}, 0x1E , 0x01   , 0x0F   , {{67914166272., 0.   , 0x00 , 0x01 , 0x00 }, {42949668864., 0.   , 0x00 , 0x01 , 0x00 }, {16773120.   , 0.   , 0x00 , 0x01 , 0x00 }, {68702699520., 0.   , 0x00 , 0x01 , 0x01 }, {0.          , 0.   , 0x00 , 0x01 , 0x00 }, {0.          , 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x05500, {0x09 , 0x15 }, {0x0B , 0x17 }, {0x00  , 0x00  }, {8084643840. , 0.          }, 0x00},
3707 				{0x012C, 0x17, {0x00, 0x00, 0x00}, 0x1E , 0x01   , 0x0F   , {{60129538048., 0.   , 0x00 , 0x01 , 0x00 }, {34359730176., 0.   , 0x00 , 0x01 , 0x00 }, {1057222656. , 0.   , 0x00 , 0x01 , 0x00 }, {67662249984., 0.   , 0x00 , 0x01 , 0x01 }, {0.          , 0.   , 0x00 , 0x01 , 0x00 }, {0.          , 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x05500, {0x04 , 0x15 }, {0x06 , 0x17 }, {0x00  , 0x00  }, {8084643840. , 0.          }, 0x00},
3708 				{0x00C8, 0x1D, {0x00, 0x00, 0x00}, 0x1E , 0x01   , 0x0F   , {{68585258944., 0.   , 0x00 , 0x01 , 0x00 }, {536870784.  , 0.   , 0x00 , 0x01 , 0x00 }, {16659267072., 0.   , 0x00 , 0x01 , 0x00 }, {52060209600., 0.   , 0x00 , 0x01 , 0x01 }, {0.          , 0.   , 0x00 , 0x01 , 0x00 }, {0.          , 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x05500, {0x0A , 0x1A }, {0x0C , 0x1C }, {0x00  , 0x00  }, {8329633536. , 0.          }, 0x00},
3709 				{0x0960, 0x0B, {0x00, 0x00, 0x00}, 0x1E , 0x01   , 0x0F   , {{60112764928., 0.   , 0x00 , 0x01 , 0x00 }, {34326183936., 0.   , 0x00 , 0x01 , 0x00 }, {1056964608. , 0.   , 0x01 , 0x01 , 0x00 }, {67645734912., 0.   , 0x01 , 0x01 , 0x01 }, {1056964608. , 0.   , 0x00 , 0x01 , 0x00 }, {67645734912., 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x24000, {0x05 , 0x09 }, {0x07 , 0x0B }, {0x00  , 0x00  }, {2113929216. , 0.          }, 0x00},
3710 				{0x04B0, 0x1A, {0x00, 0x00, 0x00}, 0x1E , 0x01   , 0x0F   , {{68316823296., 0.   , 0x00 , 0x01 , 0x00 }, {42949672704., 0.   , 0x00 , 0x01 , 0x00 }, {4194048.    , 0.   , 0x00 , 0x01 , 0x00 }, {68715282432., 0.   , 0x00 , 0x01 , 0x01 }, {4194048.    , 0.   , 0x00 , 0x01 , 0x00 }, {68715282432., 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x11000, {0x0B , 0x17 }, {0x0D , 0x19 }, {0x00  , 0x00  }, {33552384.   , 33552384.   }, 0x01},
3711 				{0x0258, 0x17, {0x00, 0x00, 0x00}, 0x1E , 0x01   , 0x0F   , {{67914166272., 0.   , 0x00 , 0x01 , 0x00 }, {42949668864., 0.   , 0x00 , 0x01 , 0x00 }, {16773120.   , 0.   , 0x00 , 0x01 , 0x00 }, {68702699520., 0.   , 0x00 , 0x01 , 0x01 }, {0.          , 0.   , 0x00 , 0x01 , 0x00 }, {0.          , 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x05500, {0x09 , 0x15 }, {0x0B , 0x17 }, {0x00  , 0x00  }, {33546240.   , 0.          }, 0x00},
3712 				{0x012C, 0x17, {0x00, 0x00, 0x00}, 0x1E , 0x01   , 0x0F   , {{60129538048., 0.   , 0x00 , 0x01 , 0x00 }, {34359730176., 0.   , 0x00 , 0x01 , 0x00 }, {34359730176., 0.   , 0x00 , 0x01 , 0x00 }, {67662249984., 0.   , 0x00 , 0x01 , 0x01 }, {0.          , 0.   , 0x00 , 0x01 , 0x00 }, {0.          , 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x05500, {0x04 , 0x15 }, {0x06 , 0x17 }, {0x00  , 0x00  }, {33546240.   , 0.          }, 0x00},
3713 				{0x00C8, 0x1D, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{0.          , 0.   , 0x00 , 0x01 , 0x00 }, {68182605888., 0.   , 0x00 , 0x01 , 0x00 }, {68719476720., 0.   , 0x00 , 0x01 , 0x01 }, {68719476720., 0.   , 0x00 , 0x01 , 0x01 }, {16659267072., 0.   , 0x00 , 0x01 , 0x00 }, {52060209600., 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x05500, {0x0A , 0x1A }, {0x0C , 0x1D }, {0x00  , 0x00  }, {4194176.    , 0.          }, 0x00},
3714 				{0x0064, 0x23, {0x00, 0x00, 0x00}, 0x1E , 0x01   , 0x0F   , {{51539607551., 0.   , 0x00 , 0x01 , 0x00 }, {34359738366., 0.   , 0x00 , 0x01 , 0x00 }, {7635497415. , 0.   , 0x00 , 0x01 , 0x00 }, {61083979320., 0.   , 0x00 , 0x01 , 0x01 }, {0.          , 0.   , 0x00 , 0x01 , 0x00 }, {0.          , 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x02700, {0x02 , 0x22 }, {0x03 , 0x23 }, {0x00  , 0x00  }, {2114445438. , 0.          }, 0x00},
3715 				{0x0064, 0x23, {0x00, 0x00, 0x00}, 0x1E , 0x01   , 0x0F   , {{51539607551., 0.   , 0x00 , 0x01 , 0x00 }, {34359738366., 0.   , 0x00 , 0x01 , 0x00 }, {7635497415. , 0.   , 0x00 , 0x01 , 0x00 }, {61083979320., 0.   , 0x00 , 0x01 , 0x01 }, {0.          , 0.   , 0x00 , 0x01 , 0x00 }, {0.          , 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x02700, {0x02 , 0x22 }, {0x03 , 0x23 }, {0x00  , 0x00  }, {524286.     , 0.          }, 0x00}
3716 			};
3717 
3718 			memcpy(reg, &data[tm], sizeof(struct st_timing));
3719 		}
3720 	}
3721 
3722 	return rst;
3723 }
3724 
3725 /* ccd timing values for hp4370 scanner */
hp4370_timing_get(SANE_Int tm,struct st_timing * reg)3726 static SANE_Int hp4370_timing_get(SANE_Int tm, struct st_timing *reg)
3727 {
3728 	SANE_Int rst = ERROR;
3729 
3730 	if ((reg != NULL)&&(tm < 14))
3731 	{
3732 		/* Toshiba T2958 sensor timing values for each resolution and color mode */
3733 
3734 		struct st_timing data[] =
3735 		{
3736 			/* res , cnpp, {cvtrp 1 2 3     }, cvtrw, cvtrfpw, cvtrbpw, {{cphp1       , cphp2, cphps, cphge, cphgo}, {cphp1       , cphp2       , cphps, cphge, cphgo}, {cphp1       , cphp2      , cphps, cphge, cphgo}, {cphp1       , cphp2       , cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}}, cphbp2s, cphbp2e, clamps, clampe , {cdss1, cdss2}, {cdsc1, cdsc2}, {cdscs1, cdscs2}, {adcclkp 1 y 2             }, adcclkp2e */
3737 			{0x12C0, 0x17, {0x00, 0x00, 0x00}, 0x0F , 0x05   , 0x0E   , {{0.          , 0.   , 0x00 , 0x01 , 0x01 }, {17179869183., 17179869183., 0x00 , 0x01 , 0x01 }, {1073479680. , 1073479680., 0x01 , 0x01 , 0x00 }, {67645997055., 67645997055., 0x01 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0x5D5B , 0xBAB7 , 0x1A  , -1     , {0x08 , 0x15 }, {0x0A , 0x17 }, {0x00  , 0x00  }, {8084644321. , 8084644321. }, 0x00},
3738 			{0x0960, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x05   , 0x0E   , {{0.          , 0.   , 0x00 , 0x01 , 0x01 }, {17179869182., 0.          , 0x00 , 0x01 , 0x01 }, {268434432.  , 0.         , 0x01 , 0x01 , 0x00 }, {68451042303., 0.          , 0x01 , 0x01 , 0x01 }, {0.          , 0.   , 0x00 , 0x00 , 0x00 }, {0.          , 0.   , 0x00 , 0x00 , 0x00 }}, 0x00   , 0x00   , 0x1A  , -1     , {0x07 , 0x18 }, {0x0B , 0x1E }, {0x00  , 0x00  }, {67662254016., 0.          }, 0x00},
3739 			{0x04B0, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{0.          , 0.   , 0x00 , 0x01 , 0x00 }, {68719475967., 0.          , 0x00 , 0x01 , 0x01 }, {1048572.    , 0.         , 0x00 , 0x01 , 0x01 }, {68718428163., 0.          , 0x00 , 0x01 , 0x01 }, {0.          , 0.   , 0x00 , 0x01 , 0x00 }, {0.          , 0.   , 0x00 , 0x01 , 0x00 }}, 0x00   , 0x00   , 0x01  , 0x11000, {0x1F , 0x17 }, {0x21 , 0x19 }, {0x01  , 0x01  }, {34888349727., 0.          }, 0x00},
3740 			{0x0258, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{0.          , 0.   , 0x00 , 0x01 , 0x00 }, {68719476731., 0.          , 0x00 , 0x01 , 0x01 }, {4261672960. , 0.         , 0x00 , 0x01 , 0x00 }, {64457803775., 0.          , 0x00 , 0x01 , 0x01 }, {0.          , 0.   , 0x00 , 0x00 , 0x00 }, {0.          , 0.   , 0x00 , 0x00 , 0x00 }}, 0x00   , 0x00   , 0x1A  , 0x05500, {0x00 , 0x1F }, {0x03 , 0x21 }, {0x00  , 0x00  }, {8457781752. , 0.          }, 0x00},
3741 			{0x012C, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{0.          , 0.   , 0x00 , 0x01 , 0x00 }, {51808043007., 0.          , 0x00 , 0x01 , 0x01 }, {8084644320. , 0.         , 0x00 , 0x01 , 0x00 }, {60634832415., 0.          , 0x00 , 0x01 , 0x01 }, {0.          , 0.   , 0x00 , 0x00 , 0x00 }, {0.          , 0.   , 0x00 , 0x00 , 0x00 }}, 0x00   , 0x00   , 0x1A  , 0x05500, {0x09 , 0x20 }, {0x0A , 0x22 }, {0x00  , 0x00  }, {4228890876. , 0.          }, 0x00},
3742 			{0x12C0, 0x17, {0x00, 0x00, 0x00}, 0x0F , 0x05   , 0x0E   , {{0.          , 0.   , 0x00 , 0x01 , 0x01 }, {17179869183., 17179869183., 0x00 , 0x01 , 0x01 }, {1073479680. , 1073479680., 0x01 , 0x01 , 0x00 }, {67645997055., 67645997055., 0x01 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0x5D5B , 0xBAB7 , 0x1A  , -1     , {0x08 , 0x15 }, {0x0A , 0x17 }, {0x00  , 0x00  }, {33546240.   , 33546240.   }, 0x00},
3743 			{0x0960, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x05   , 0x0E   , {{0.          , 0.   , 0x00 , 0x01 , 0x01 }, {17179869182., 0.          , 0x00 , 0x01 , 0x01 }, {268434432.  , 0.         , 0x01 , 0x01 , 0x00 }, {68451042303., 0.          , 0x01 , 0x01 , 0x01 }, {0.          , 0.   , 0x00 , 0x00 , 0x00 }, {0.          , 0.   , 0x00 , 0x00 , 0x00 }}, 0x00   , 0x00   , 0x1A  , -1     , {0x07 , 0x18 }, {0x0B , 0x1E }, {0x00  , 0x00  }, {16777152.   , 0.          }, 0x00},
3744 			{0x04B0, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{0.          , 0.   , 0x00 , 0x01 , 0x00 }, {68719475967., 0.          , 0x00 , 0x01 , 0x01 }, {1048572.    , 0.         , 0x00 , 0x01 , 0x01 }, {68718428163., 0.          , 0x00 , 0x01 , 0x01 }, {0.          , 0.   , 0x00 , 0x01 , 0x00 }, {0.          , 0.   , 0x00 , 0x01 , 0x00 }}, 0x00   , 0x00   , 0x01  , 0x11000, {0x1F , 0x17 }, {0x21 , 0x19 }, {0x01  , 0x01  }, {536868864.  , 0.          }, 0x00},
3745 			{0x0258, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{0.          , 0.   , 0x00 , 0x01 , 0x00 }, {68719476731., 0.          , 0x00 , 0x01 , 0x01 }, {4261672960. , 0.         , 0x00 , 0x01 , 0x00 }, {64457803775., 0.          , 0x00 , 0x01 , 0x01 }, {0.          , 0.   , 0x00 , 0x00 , 0x00 }, {0.          , 0.   , 0x00 , 0x00 , 0x00 }}, 0x00   , 0x00   , 0x1A  , 0x05500, {0x00 , 0x1F }, {0x03 , 0x21 }, {0x00  , 0x00  }, {2097144.    , 0.          }, 0x00},
3746 			{0x012C, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{0.          , 0.   , 0x00 , 0x01 , 0x00 }, {51808043007., 0.          , 0x00 , 0x01 , 0x01 }, {8084644320. , 0.         , 0x00 , 0x01 , 0x00 }, {60634832415., 0.          , 0x00 , 0x01 , 0x01 }, {0.          , 0.   , 0x00 , 0x00 , 0x00 }, {0.          , 0.   , 0x00 , 0x00 , 0x00 }}, 0x00   , 0x00   , 0x1A  , 0x05500, {0x09 , 0x20 }, {0x0A , 0x22 }, {0x00  , 0x00  }, {1048572.    , 0.          }, 0x00},
3747 			{0x12C0, 0x17, {0x00, 0x00, 0x00}, 0x0F , 0x05   , 0x0E   , {{0.          , 0.   , 0x00 , 0x01 , 0x01 }, {17179869183., 17179869183., 0x00 , 0x01 , 0x01 }, {1073479680. , 1073479680., 0x01 , 0x01 , 0x00 }, {67645997055., 67645997055., 0x01 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0x6977 , 0xD2EF , 0x1A  , -1     , {0x07 , 0x15 }, {0x0A , 0x17 }, {0x00  , 0x00  }, {8084644321. , 8084644321. }, 0x00},
3748 			{0x12C0, 0x17, {0x00, 0x00, 0x00}, 0x0F , 0x05   , 0x0E   , {{0.          , 0.   , 0x00 , 0x01 , 0x01 }, {17179869183., 17179869183., 0x00 , 0x01 , 0x01 }, {1073479680. , 1073479680., 0x01 , 0x01 , 0x00 }, {67645997055., 67645997055., 0x01 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0x6977 , 0xD2EF , 0x1A  , -1     , {0x07 , 0x15 }, {0x0A , 0x17 }, {0x00  , 0x00  }, {33546240.   , 33546240.   }, 0x00},
3749 			{0x12C0, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x05   , 0x0E   , {{0.          , 0.   , 0x00 , 0x01 , 0x01 }, {8589934591. , 8589934591. , 0x00 , 0x01 , 0x01 }, {134217216.  , 134217216. , 0x01 , 0x01 , 0x00 }, {68585259519., 68585259519., 0x01 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0x765B , 0xECB7 , 0x1A  , -1     , {0x07 , 0x1B }, {0x0D , 0x21 }, {0x00  , 0x00  }, {8457781752. , 8457781752. }, 0x00},
3750 			{0x12C0, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x05   , 0x0E   , {{0.          , 0.   , 0x00 , 0x01 , 0x01 }, {8589934591. , 8589934591. , 0x00 , 0x01 , 0x01 }, {134217216.  , 134217216. , 0x01 , 0x01 , 0x00 }, {68585259519., 68585259519., 0x01 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0x765B , 0xECB7 , 0x1A  , -1     , {0x07 , 0x1B }, {0x0D , 0x21 }, {0x00  , 0x00  }, {2097144.    , 2097144.    }, 0x00}
3751 		};
3752 
3753 		memcpy(reg, &data[tm], sizeof(struct st_timing));
3754 		rst = OK;
3755 	}
3756 
3757 	return rst;
3758 }
3759 
3760 /* ccd timing values for ua4900 scanner */
ua4900_timing_get(SANE_Int tm,struct st_timing * reg)3761 static SANE_Int ua4900_timing_get(SANE_Int tm, struct st_timing *reg)
3762 {
3763 	SANE_Int rst = ERROR;
3764 
3765 	if ((tm < 10)&&(reg != NULL))
3766 	{
3767 		/* Sony S575 sensor timing values for each resolution and color mode */
3768 		struct st_timing data[] =
3769 		{
3770 			/* res , cnpp, {cvtrp1  2    3  }, cvtrw, cvtrfpw, cvtrbpw, {{cphp1       , cphp2, cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}}, cphbp2s, cphbp2e, clamps, clampe , {cdss1, cdss2}, {cdsc1, cdsc2}, {cdscs1, cdscs2}, {adcclkp 1 y 2             }, adcclkp2e */
3771 			{0x04b0, 0x23, {0x00, 0x00, 0x00}, 0x1E , 0x03   , 0x03   , {{ 1073737728., 0.   , 0x01 , 0x01 , 0x00 }, {67645739007., 0.   , 0x01 , 0x01 , 0x01 }, {67645739007., 0.   , 0x01 , 0x01 , 0x01 }, { 1073737728., 0.   , 0x01 , 0x01 , 0x00 }, {25769803776., 0.   , 0x00 , 0x01 , 0x00 }, {         62., 0.   , 0x00 , 0x01 , 0x00 }}, 0x00   , 0x00   , 0x01  , 0x11000, {0x08 , 0x1c }, {0x0A , 0x1e }, {0x00  , 0x00  }, {67662254016., 0.          }, 0x00},
3772 			{0x0258, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x03   , 0x03   , {{     262143., 0.   , 0x00 , 0x01 , 0x00 }, {68719214592., 0.   , 0x00 , 0x01 , 0x01 }, {68719214592., 0.   , 0x00 , 0x01 , 0x01 }, {     262143., 3.   , 0x00 , 0x01 , 0x00 }, { 2080374784., 0.   , 0x00 , 0x01 , 0x00 }, {64424509455., 0.   , 0x00 , 0x01 , 0x00 }}, 0x00   , 0x00   , 0x01  , 0x05500, {0x10 , 0x1d }, {0x12 , 0x1f }, {0x00  , 0x00  }, {33831127008., 0.          }, 0x00},
3773 			{0x012c, 0x23, {0x00, 0x00, 0x00}, 0x1E , 0x03   , 0x03   , {{      32767., 0.   , 0x00 , 0x01 , 0x00 }, {68182605824., 0.   , 0x00 , 0x01 , 0x01 }, { 2130837500., 0.   , 0x00 , 0x01 , 0x01 }, {66588639235., 0.   , 0x00 , 0x01 , 0x00 }, {  117440512., 0.   , 0x00 , 0x01 , 0x00 }, {68182605825., 0.   , 0x00 , 0x01 , 0x00 }}, 0x00   , 0x00   , 0x01  , 0x02700, {0x12 , 0x1f }, {0x14 , 0x21 }, {0x00  , 0x00  }, { 8457781752., 0.          }, 0x00},
3774 			{0x00c8, 0x23, {0x00, 0x00, 0x00}, 0x1E , 0x03   , 0x03   , {{51539608575., 0.   , 0x00 , 0x01 , 0x00 }, {16642998272., 0.   , 0x00 , 0x01 , 0x01 }, { 2082408447., 0.   , 0x00 , 0x01 , 0x01 }, {66637068288., 0.   , 0x00 , 0x01 , 0x00 }, {   14680064., 0.   , 0x00 , 0x01 , 0x00 }, {68652367872., 0.   , 0x00 , 0x01 , 0x00 }}, 0x00   , 0x00   , 0x01  , 0x02700, {0x10 , 0x1f }, {0x12 , 0x21 }, {0x00  , 0x00  }, { 8457781752., 0.          }, 0x00},
3775 			{0x0064, 0x23, {0x00, 0x00, 0x00}, 0x1E , 0x03   , 0x03   , {{51539608575., 0.   , 0x00 , 0x01 , 0x00 }, {16642998272., 0.   , 0x00 , 0x01 , 0x01 }, { 2082408447., 0.   , 0x00 , 0x01 , 0x01 }, {66637068288., 0.   , 0x00 , 0x01 , 0x00 }, {   14680064., 0.   , 0x00 , 0x01 , 0x00 }, {68652367872., 0.   , 0x00 , 0x01 , 0x00 }}, 0x00   , 0x00   , 0x01  , 0x02700, {0x10 , 0x1f }, {0x12 , 0x21 }, {0x00  , 0x00  }, { 8457781752., 0.          }, 0x00},
3776 			{0x04b0, 0x23, {0x00, 0x00, 0x00}, 0x1E , 0x03   , 0x03   , {{  268434432., 0.   , 0x01 , 0x01 , 0x00 }, {68451042303., 0.   , 0x01 , 0x01 , 0x01 }, {68451042303., 0.   , 0x01 , 0x01 , 0x01 }, {  268434432., 0.   , 0x01 , 0x01 , 0x00 }, {51539607552., 0.   , 0x00 , 0x01 , 0x00 }, {30.         , 0.   , 0x00 , 0x01 , 0x00 }}, 0x00   , 0x00   , 0x01  , 0x11000, {0x08 , 0x1d }, {0x09 , 0x1e }, {0x00  , 0x00  }, {16777152.   , 0.          }, 0x00},
3777 			{0x0258, 0x1d, {0x00, 0x00, 0x00}, 0x0f , 0x03   , 0x03   , {{    2097088., 0.   , 0x00 , 0x01 , 0x00 }, {68717379632., 0.   , 0x00 , 0x01 , 0x01 }, {68717379632., 0.   , 0x00 , 0x01 , 0x01 }, {    2097088., 3.   , 0x00 , 0x01 , 0x00 }, { 1879048192., 0.   , 0x00 , 0x01 , 0x00 }, {60129542592., 0.   , 0x00 , 0x01 , 0x00 }}, 0x00   , 0x00   , 0x01  , 0x05500, {0x0d , 0x16 }, {0x0f , 0x18 }, {0x00  , 0x00  }, {134213632.  , 0.          }, 0x00},
3778 			{0x012c, 0x23, {0x00, 0x00, 0x00}, 0x1E , 0x03   , 0x03   , {{64424510463., 0.   , 0x00 , 0x01 , 0x00 }, { 4278190080., 0.   , 0x00 , 0x01 , 0x01 }, {  267390975., 0.   , 0x00 , 0x01 , 0x01 }, {68452085760., 0.   , 0x00 , 0x01 , 0x00 }, {    6291456., 0.   , 0x00 , 0x01 , 0x00 }, {68652367872., 0.   , 0x00 , 0x01 , 0x00 }}, 0x00   , 0x00   , 0x01  , 0x02700, {0x15 , 0x1f }, {0x17 , 0x21 }, {0x00  , 0x00  }, {2097144.    , 0.          }, 0x00},
3779 			{0x00C8, 0x23, {0x00, 0x00, 0x00}, 0x1E , 0x03   , 0x03   , {{51539608575., 0.   , 0x00 , 0x01 , 0x00 }, {16642998272., 0.   , 0x00 , 0x01 , 0x01 }, { 2082408447., 0.   , 0x00 , 0x01 , 0x01 }, {66637068288., 0.   , 0x00 , 0x01 , 0x00 }, {   14680064., 0.   , 0x00 , 0x01 , 0x00 }, {68652367872., 0.   , 0x00 , 0x01 , 0x00 }}, 0x00   , 0x00   , 0x01  , 0x02700, {0x17 , 0x1f }, {0x19 , 0x21 }, {0x00  , 0x00  }, {2097144.    , 0.          }, 0x00},
3780 			{0x0064, 0x23, {0x00, 0x00, 0x00}, 0x1E , 0x03   , 0x03   , {{51539608575., 0.   , 0x00 , 0x01 , 0x00 }, {16642998272., 0.   , 0x00 , 0x01 , 0x01 }, { 2082408447., 0.   , 0x00 , 0x01 , 0x01 }, {66637068288., 0.   , 0x00 , 0x01 , 0x00 }, {   14680064., 0.   , 0x00 , 0x01 , 0x00 }, {68652367872., 0.   , 0x00 , 0x01 , 0x00 }}, 0x00   , 0x00   , 0x01  , 0x02700, {0x17 , 0x1f }, {0x19 , 0x21 }, {0x00  , 0x00  }, {2097144.    , 0.          }, 0x00}
3781 		};
3782 
3783 		memcpy(reg, &data[tm], sizeof(struct st_timing));
3784 		rst = OK;
3785 	}
3786 
3787 	return rst;
3788 }
3789 
cfg_timing_get(SANE_Int sensortype,SANE_Int tm,struct st_timing * reg)3790 static SANE_Int cfg_timing_get(SANE_Int sensortype, SANE_Int tm, struct st_timing *reg)
3791 {
3792 	/* return timing values for current device */
3793 
3794 	SANE_Int rst = ERROR;
3795 
3796 	switch(RTS_Debug->dev_model)
3797 	{
3798 		case BQ5550:
3799 			rst = bq5550_timing_get(tm, reg);
3800 			break;
3801 
3802 		case UA4900:
3803 			rst = ua4900_timing_get(tm, reg);
3804 			break;
3805 
3806 		case HP4370:
3807 		case HPG3010:
3808 		case HPG3110:
3809 			rst = hp4370_timing_get(tm, reg);
3810 			break;
3811 
3812 		case HP3800:
3813 		case HPG2710:
3814 			rst = hp3800_timing_get(tm, reg);
3815 			break;
3816 
3817 		default:
3818 			/* hp3970 and hp4070 */
3819 			rst = hp3970_timing_get(sensortype, tm, reg);
3820 			break;
3821 	}
3822 
3823 	return rst;
3824 }
3825 
3826 /** SEC: Motor curves ---------- */
3827 
bq5550_motor()3828 static SANE_Int *bq5550_motor()
3829 {
3830 	SANE_Int *rst = NULL;
3831 	SANE_Int steps[]  =
3832 	{
3833 		/* motorcurve 1   */
3834 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
3835 		ACC_CURVE,CRV_NORMALSCAN, 20000 ,6323 ,4095 ,3270 ,2823 ,2533 ,2318 ,2151 ,2016 ,1905 ,1811 ,1730 ,1660 ,1599 ,1544 ,1494 ,1450 ,1409 ,1373 ,1339 ,1307 ,1278 ,1251 ,1225 ,1201 ,1179 ,1158 ,1138 ,1119 ,1101 ,1084 ,1067 ,1052 ,1037 ,1023 ,1009 ,996 ,984 ,972 ,960 ,949 ,938 ,928 ,918 ,909 ,899 ,890 ,882 ,873 ,865 ,857 ,849 ,842 ,835 ,828 ,821 ,814 ,807 ,801 ,795 ,789 ,783 ,777 ,772 ,766 ,761 ,756 ,751 ,746 ,741 ,736 ,731 ,727 ,722 ,718 ,714 ,709 ,705 ,701 ,697 ,693 ,690 ,686 ,682 ,678 ,675 ,671 ,668 ,665 ,661 ,658 ,655 ,652 ,649 ,645 ,642 ,640 ,637 ,634 ,631 ,628 ,625 ,623 ,620 ,617 ,615 ,612 ,610 ,607 ,605 ,602 ,600 ,597 ,595 ,593 ,591 ,588 ,586 ,584 ,582 ,580 ,577 ,575 ,573 ,571 ,569 ,567 ,565 ,563 ,562 ,560 ,558 ,556 ,554 ,552 ,550 ,549 ,547 ,545 ,543 ,542 ,540 ,538 ,537 ,535 ,534 ,532 ,530 ,529 ,527 ,526 ,524 ,523 ,521 ,520 ,518 ,517 ,515 ,514 ,513 ,511 ,510 ,508 ,507 ,506 ,504 ,503 ,502 ,501 ,499 ,498 ,497 ,495 ,494 ,493 ,492 ,491 ,489 ,488 ,487 ,486 ,485 ,484 ,482 ,481 ,480 ,479 ,478 ,477 ,476 ,475 ,474 ,473 ,472 ,470 ,469 ,468 ,467 ,466 ,465 ,464 ,463 ,462 ,461 ,460 ,460 ,459 ,458 ,457 ,456 ,455 ,454 ,453 ,452 ,451 ,450 ,449 ,449 ,448 ,447 ,446 ,445 ,444 ,443 ,443 ,442 ,441 ,440 ,439 ,438 ,438 ,437 ,436 ,435 ,434 ,434 ,433 ,432 ,431 ,431 ,430 ,429 ,428 ,428 ,427 ,426 ,425 ,425 ,424 ,423 ,422 ,422 ,421 ,420 ,420 ,419 ,418 ,418 ,417 ,416 ,416 ,415 ,414 ,414 ,413 ,412 ,412 ,411 ,410 ,410 ,409 ,408 ,408 ,407 ,407 ,406 ,405 ,405 ,404 ,404 ,403 ,402 ,402 ,401 ,401 ,400 ,399 ,399 ,398 ,398 ,397 ,397 ,396 ,395 ,395 ,394 ,394 ,393 ,393 ,392 ,392 ,391 ,390 ,390 ,389 ,389 ,388 ,388 ,387 ,387 ,386 ,386 ,385 ,385 ,384 ,384 ,383 ,383 ,382 ,382 ,381 ,381 ,380 ,380 ,379 ,379 ,378 ,378 ,377 ,377 ,377 ,376 ,376 ,375 ,375 ,374 ,374 ,373 ,373 ,372 ,372 ,372 ,371 ,371 ,370 ,370 ,369 ,369 ,368 ,368 ,368 ,367 ,367 ,366 ,366 ,365 ,365 ,365 ,364 ,364 ,363 ,363 ,363 ,362 ,362 ,361 ,361 ,361 ,360 ,360 ,359 ,359 ,359 ,358 ,358 ,357 ,357 ,357 ,356 ,356 ,356 ,355 ,355 ,354 ,354 ,354 ,353 ,353 ,353 ,352 ,352 ,351 ,351 ,351 ,350 ,350 ,350 ,349 ,349 ,349 ,348 ,348 ,348 ,347 ,347 ,347 ,346 ,346 ,346 ,345 ,345 ,345 ,344 ,344 ,344 ,343 ,343 ,343 ,342 ,342 ,342 ,341 ,341 ,341 ,340 ,340 ,340 ,339 ,339 ,339 ,338 ,338 ,338 ,337 ,337 ,337 ,337 ,336 ,336 ,336 ,335 ,335 ,335 ,334 ,334 ,334 ,334 ,333 ,333 ,333 ,332 ,332 ,332 ,332 ,331 ,331 ,331 ,330 ,330 ,330 ,330 ,329 ,329 ,329 ,328 ,328 ,328 ,328 ,327 ,327 ,327 ,326 ,326 ,326 ,326 ,325 ,325 ,325 ,325 ,324 ,324 ,324 ,324 ,323 ,323 ,323 ,323 ,322 ,322 ,322 ,321 ,321 ,321 ,321 ,320 ,320 ,320 ,320 ,319 ,319 ,319 ,319 ,318 ,318 ,318 ,318 ,317 ,317 ,317 ,317 ,317 ,316 ,316 ,316 ,316 ,315 ,315 ,315 ,315 ,314 ,314 ,314 ,314 ,313 ,313 ,313 ,313 ,313 ,312 ,312 ,312 ,312 ,311 ,311 ,311 ,311 ,311 ,310 ,310 ,310 ,310 ,309 ,309 ,309 ,309 ,309 ,308 ,308 ,308 ,308 ,307 ,307 ,307 ,307 ,307 ,306 ,306 ,306 ,306 ,306 ,305 ,305 ,305 ,305 ,305 ,304 ,304 ,304 ,304 ,303 ,303 ,303 ,303 ,303 ,302 ,302 ,302 ,302 ,302 ,301 ,301 ,301 ,301 ,301 ,300 ,300 ,300 ,300 ,300 ,300 ,299 ,299 ,299 ,299 ,299 ,298 ,298 ,298 ,298 ,298 ,297 ,297 ,297 ,297 ,297 ,297 ,296 ,296 ,296 ,296 ,296 ,295 ,295 ,295 ,295 ,295 ,295 ,294 ,294 ,294 ,294 ,294 ,293 ,293 ,293 ,293 ,293 ,293 ,292 ,292 ,292 ,292 ,292 ,292 ,291 ,291 ,291 ,291 ,291 ,290 ,290 ,290 ,290 ,290 ,290 ,289 ,289 ,289 ,289 ,289 ,289 ,288 ,288 ,288 ,288 ,288 ,288 ,288 ,287 ,287 ,287 ,287 ,287 ,287 ,286 ,286 ,286 ,286 ,286 ,286 ,285 ,285 ,285 ,285 ,285 ,285, 0,
3836 		ACC_CURVE,CRV_SMEARING  , 4000, 3877, 3377, 2777, 2127, 1724, 1449, 1250, 0,
3837 		DEC_CURVE,CRV_NORMALSCAN, 479 ,500 ,547 ,607 ,682 ,766 ,865 ,950 ,1040 ,1200 ,1369 ,1580 ,1810 ,2087 ,2500 ,3048 ,3877 ,4818 ,5822 ,6896, 0,
3838 		DEC_CURVE,CRV_SMEARING  , 1250, 1449, 1724, 2127, 2777, 3377, 3877, 4000, 0,
3839 		DEC_CURVE,CRV_BUFFERFULL, 479 ,500 ,547 ,607 ,682 ,766 ,865 ,950 ,1040 ,1200 ,1369 ,1580 ,1810 ,2087 ,2500 ,3048 ,3877 ,4818 ,5822 ,6896, 0,
3840 		-1
3841 	};
3842 
3843 	rst = (SANE_Int *)malloc(sizeof(steps));
3844 	if (rst != NULL)
3845 		memcpy(rst, &steps, sizeof(steps));
3846 
3847 	return rst;
3848 }
3849 
hp4370_motor()3850 static SANE_Int *hp4370_motor()
3851 {
3852 	SANE_Int *rst = NULL;
3853 	SANE_Int steps[]  =
3854 	{
3855 		/* motorcurve 1   */
3856 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
3857 		ACC_CURVE,CRV_NORMALSCAN, 2000, 1984, 1968, 1953, 1937, 1921, 1906, 1890, 1874, 1859, 1843, 1827, 1812, 1796, 1781, 1765, 1749, 1734, 1715, 1700, 1684, 1669, 1653, 1637, 1622, 1606, 1590, 1572, 1556, 1541, 1525, 1510, 1494, 1478, 1463, 1447, 1431, 1416, 1400, 1384, 1366, 1351, 1335, 1319, 1304, 1288, 1272, 1257, 1241, 1225, 1210, 1194, 1179, 1160, 1145, 1129, 1113, 1098, 1082, 1066, 1051, 1035, 1017, 1001, 986, 970, 954, 939, 923, 907, 892, 876, 861, 845, 829, 814, 798, 782, 767, 749, 0,
3858 		ACC_CURVE,CRV_PARKHOME  , 4705, 2913, 2253, 1894, 1662, 1498, 1374, 1276, 1196, 1129, 1073, 1024, 981, 944, 910, 880, 852, 827, 804, 783, 764, 746, 729, 713, 699, 685, 672, 659, 648, 637, 626, 616, 607, 598, 589, 581, 573, 565, 558, 551, 544, 538, 532, 526, 520, 514, 509, 503, 500, 0,
3859 		ACC_CURVE,CRV_SMEARING  , 200, 12, 14, 16, 0,
3860 		DEC_CURVE,CRV_NORMALSCAN, 749, 1166, 1583, 2000, 0,
3861 		DEC_CURVE,CRV_PARKHOME  , 500, 503, 509, 514, 520, 526, 532, 538, 544, 551, 558, 565, 573, 581, 589, 598, 607, 616, 626, 637, 648, 659, 672, 685, 699, 713, 729, 746, 764, 783, 804, 827, 852, 880, 910, 944, 981, 1024, 1073, 1129, 1196, 1276, 1374, 1498, 1662, 1894, 2253, 2913, 4705, 0,
3862 		DEC_CURVE,CRV_SMEARING  , 300, 234, 167, 100, 0,
3863 		DEC_CURVE,CRV_BUFFERFULL, 1100, 867, 633, 400, 0,
3864 		-2,
3865 
3866 		/* motorcurve 2   */
3867 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
3868 		ACC_CURVE,CRV_NORMALSCAN, 4705, 2664, 2061, 1732, 1521, 1370, 1257, 1167, 1094, 1033, 982, 937, 898, 864, 833, 805, 780, 757, 736, 717, 699, 683, 667, 653, 640, 627, 615, 604, 593, 583, 574, 564, 556, 547, 540, 532, 525, 518, 511, 505, 499, 493, 487, 481, 476, 471, 466, 461, 456, 452, 447, 443, 439, 435, 431, 427, 424, 420, 417, 413, 410, 407, 403, 400, 397, 394, 391, 389, 386, 383, 381, 378, 375, 373, 371, 368, 366, 364, 361, 359, 357, 355, 353, 351, 349, 347, 345, 343, 341, 339, 338, 336, 334, 332, 331, 329, 327, 326, 324, 323, 321, 320, 318, 317, 315, 314, 312, 311, 310, 308, 307, 306, 304, 303, 302, 301, 299, 298, 297, 296, 295, 293, 292, 291, 290, 289, 288, 287, 286, 285, 284, 283, 282, 281, 280, 279, 278, 277, 276, 275, 274, 273, 272, 271, 270, 270, 269, 268, 267, 266, 265, 264, 264, 263, 262, 261, 260, 260, 259, 258, 257, 257, 256, 255, 255, 254, 253, 252, 252, 251, 250, 250, 249, 248, 248, 247, 246, 246, 245, 244, 244, 243, 242, 242, 241, 241, 240, 239, 239, 238, 238, 237, 237, 236, 235, 235, 234, 234, 233, 233, 232, 232, 231, 231, 230, 230, 229, 229, 228, 227, 227, 227, 226, 226, 225, 225, 224, 224, 223, 223, 222, 222, 221, 221, 220, 220, 219, 219, 219, 218, 218, 217, 217, 216, 216, 216, 215, 215, 214, 214, 214, 213, 213, 212, 212, 212, 211, 211, 210, 210, 210, 209, 209, 208, 208, 208, 207, 207, 207, 206, 206, 206, 205, 205, 204, 204, 204, 203, 203, 203, 202, 202, 202, 201, 201, 201, 200, 200, 200, 199, 199, 199, 198, 198, 198, 197, 197, 197, 197, 196, 196, 196, 195, 195, 195, 194, 194, 194, 194, 193, 193, 193, 192, 192, 192, 192, 191, 191, 191, 190, 190, 190, 190, 189, 189, 189, 188, 188, 188, 188, 187, 187, 187, 187, 186, 186, 186, 186, 185, 185, 185, 185, 184, 184, 184, 184, 183, 183, 183, 183, 182, 182, 182, 182, 181, 181, 181, 181, 181, 180, 180, 180, 180, 179, 179, 179, 179, 178, 178, 178, 178, 178, 177, 177, 177, 177, 177, 176, 176, 176, 176, 175, 175, 175, 175, 175, 174, 174, 174, 174, 174, 173, 173, 173, 173, 173, 172, 172, 172, 172, 172, 171, 171, 171, 0,
3869 		ACC_CURVE,CRV_PARKHOME  , 4705, 2913, 2253, 1894, 1662, 1498, 1374, 1276, 1196, 1129, 1073, 1024, 981, 944, 910, 880, 852, 827, 804, 783, 764, 746, 729, 713, 699, 685, 672, 659, 648, 637, 626, 616, 607, 598, 589, 581, 573, 565, 558, 551, 544, 538, 532, 526, 520, 514, 509, 503, 500, 0,
3870 		ACC_CURVE,CRV_SMEARING  , 200, 12, 14, 16, 0,
3871 		DEC_CURVE,CRV_NORMALSCAN, 171, 172, 172, 173, 174, 174, 175, 176, 176, 177, 178, 178, 179, 180, 181, 181, 182, 183, 184, 184, 185, 186, 187, 188, 189, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 207, 208, 209, 210, 211, 213, 214, 215, 217, 218, 219, 221, 222, 224, 225, 227, 228, 230, 232, 233, 235, 237, 239, 241, 243, 245, 247, 249, 251, 253, 255, 258, 260, 262, 265, 268, 270, 273, 276, 279, 282, 285, 289, 292, 296, 299, 303, 307, 311, 316, 320, 325, 330, 335, 341, 347, 353, 359, 366, 373, 381, 390, 398, 408, 418, 429, 441, 455, 469, 485, 503, 523, 545, 571, 601, 636, 678, 730, 796, 883, 1005, 1195, 1544, 4705, 0,
3872 		DEC_CURVE,CRV_PARKHOME  , 500, 503, 509, 514, 520, 526, 532, 538, 544, 551, 558, 565, 573, 581, 589, 598, 607, 616, 626, 637, 648, 659, 672, 685, 699, 713, 729, 746, 764, 783, 804, 827, 852, 880, 910, 944, 981, 1024, 1073, 1129, 1196, 1276, 1374, 1498, 1662, 1894, 2253, 2913, 4705, 0,
3873 		DEC_CURVE,CRV_SMEARING  , 300, 234, 167, 100, 0,
3874 		DEC_CURVE,CRV_BUFFERFULL, 1100, 867, 633, 400, 0,
3875 		-2,
3876 
3877 		/* motorcurve 3   */
3878 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
3879 		ACC_CURVE,CRV_NORMALSCAN, 5360, 3655, 2855, 2422, 2142, 1944, 1795, 1678, 1582, 1503, 1434, 1374, 0,
3880 		ACC_CURVE,CRV_PARKHOME  , 5360, 3362, 2628, 2229, 1973, 1791, 1654, 1547, 1458, 1384, 1319, 1264, 1214, 1170, 1131, 1096, 1063, 1034, 1006, 981, 958, 937, 916, 897, 880, 863, 847, 832, 818, 805, 792, 780, 769, 758, 747, 737, 727, 718, 709, 700, 692, 684, 677, 669, 662, 655, 648, 642, 636, 629, 624, 618, 612, 607, 602, 596, 591, 587, 582, 577, 573, 568, 564, 560, 556, 552, 548, 544, 540, 537, 533, 530, 526, 523, 520, 516, 513, 510, 507, 504, 501, 498, 496, 493, 490, 488, 485, 482, 480, 477, 475, 472, 470, 468, 466, 463, 461, 459, 457, 455, 453, 450, 448, 446, 444, 443, 441, 439, 437, 435, 433, 431, 430, 428, 426, 425, 423, 421, 420, 418, 416, 415, 413, 412, 410, 409, 407, 406, 405, 403, 402, 400, 399, 398, 396, 395, 394, 392, 391, 390, 389, 387, 386, 385, 384, 382, 381, 380, 379, 378, 377, 376, 374, 373, 372, 371, 370, 369, 368, 367, 366, 365, 364, 363, 362, 361, 360, 359, 358, 357, 356, 355, 354, 353, 353, 352, 351, 350, 349, 348, 0,
3881 		ACC_CURVE,CRV_SMEARING  , 5360, 3362, 2628, 2229, 1973, 1791, 1654, 1547, 0,
3882 		DEC_CURVE,CRV_NORMALSCAN, 1374, 1434, 1503, 1582, 1678, 1795, 1944, 2142, 2422, 2855, 3655, 5360, 0,
3883 		DEC_CURVE,CRV_PARKHOME  , 348, 351, 353, 356, 359, 362, 365, 368, 371, 374, 378, 381, 385, 389, 392, 396, 400, 405, 409, 413, 418, 423, 428, 433, 439, 444, 450, 457, 463, 470, 477, 485, 493, 501, 510, 520, 530, 540, 552, 564, 577, 591, 607, 624, 642, 662, 684, 709, 737, 769, 805, 847, 897, 958, 1034, 1131, 1264, 1458, 1791, 2628, 5360, 0,
3884 		DEC_CURVE,CRV_SMEARING  , 1547, 1654, 1791, 1973, 2229, 2628, 3362, 5360, 0,
3885 		DEC_CURVE,CRV_BUFFERFULL, 1374, 1434, 1503, 1582, 1678, 1795, 1944, 2142, 2422, 2855, 3655, 5360, 0,
3886 		-2,
3887 
3888 		/* motorcurve 4   */
3889 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
3890 		ACC_CURVE,CRV_NORMALSCAN, 4705, 2664, 2061, 1732, 1521, 1370, 1257, 1167, 1094, 1033, 982, 937, 898, 864, 833, 805, 780, 757, 736, 717, 699, 683, 667, 653, 640, 627, 615, 604, 593, 583, 574, 564, 556, 547, 540, 532, 525, 518, 511, 505, 499, 493, 487, 481, 476, 471, 466, 461, 456, 452, 447, 443, 439, 435, 431, 427, 424, 420, 417, 413, 410, 407, 403, 400, 397, 394, 391, 389, 386, 383, 381, 378, 375, 373, 371, 368, 366, 364, 361, 359, 357, 355, 353, 351, 349, 347, 345, 343, 341, 339, 338, 336, 334, 332, 331, 329, 327, 326, 324, 323, 321, 320, 318, 317, 315, 314, 312, 311, 310, 308, 307, 306, 304, 303, 302, 301, 299, 298, 297, 296, 295, 293, 292, 291, 290, 289, 288, 287, 286, 285, 284, 283, 282, 281, 280, 279, 278, 277, 276, 275, 274, 273, 272, 271, 270, 270, 269, 268, 267, 266, 265, 264, 264, 263, 262, 261, 260, 260, 259, 258, 257, 257, 256, 255, 255, 254, 253, 252, 252, 251, 250, 250, 249, 248, 248, 247, 246, 246, 245, 244, 244, 243, 242, 242, 241, 241, 240, 239, 239, 238, 238, 237, 237, 236, 235, 235, 234, 234, 233, 233, 232, 232, 231, 231, 230, 230, 229, 229, 228, 227, 227, 227, 226, 226, 225, 225, 224, 224, 223, 223, 222, 222, 221, 221, 220, 220, 219, 219, 219, 218, 218, 217, 217, 216, 216, 216, 215, 215, 214, 214, 214, 213, 213, 212, 212, 212, 211, 211, 210, 210, 210, 209, 209, 208, 208, 208, 207, 207, 207, 206, 206, 206, 205, 205, 204, 204, 204, 203, 203, 203, 202, 202, 202, 201, 201, 201, 200, 200, 200, 199, 199, 199, 198, 198, 198, 197, 197, 197, 197, 196, 196, 196, 195, 195, 195, 194, 194, 194, 194, 193, 193, 193, 192, 192, 192, 192, 191, 191, 191, 190, 190, 190, 190, 189, 189, 189, 188, 188, 188, 188, 187, 187, 187, 187, 186, 186, 186, 186, 185, 185, 185, 185, 184, 184, 184, 184, 183, 183, 183, 183, 182, 182, 182, 182, 181, 181, 181, 181, 181, 180, 180, 180, 180, 179, 179, 179, 179, 178, 178, 178, 178, 178, 177, 177, 177, 177, 177, 176, 176, 176, 176, 175, 175, 175, 175, 175, 174, 174, 174, 174, 174, 173, 173, 173, 173, 173, 172, 172, 172, 172, 172, 171, 171, 171, 0,
3891 		ACC_CURVE,CRV_PARKHOME  , 4705, 2888, 2234, 1878, 1648, 1485, 1362, 1265, 1186, 1120, 1064, 1016, 973, 936, 903, 873, 845, 821, 798, 777, 758, 740, 723, 708, 693, 679, 666, 654, 643, 632, 621, 612, 602, 593, 585, 576, 569, 561, 554, 547, 540, 534, 528, 522, 516, 510, 505, 499, 494, 490, 485, 480, 476, 471, 467, 463, 459, 455, 451, 448, 444, 440, 437, 434, 430, 427, 424, 421, 418, 415, 412, 409, 407, 404, 401, 399, 396, 394, 391, 389, 387, 384, 382, 380, 378, 376, 374, 371, 369, 367, 366, 364, 362, 360, 358, 356, 354, 353, 351, 349, 348, 346, 344, 343, 341, 340, 338, 337, 335, 334, 332, 331, 329, 328, 327, 325, 324, 323, 321, 320, 319, 318, 316, 315, 314, 313, 312, 311, 309, 308, 307, 306, 305, 304, 303, 302, 301, 300, 299, 298, 297, 296, 295, 294, 293, 292, 291, 290, 289, 288, 287, 286, 285, 285, 284, 283, 282, 281, 280, 279, 279, 278, 277, 276, 275, 275, 274, 273, 272, 272, 271, 270, 269, 269, 268, 267, 267, 266, 265, 264, 264, 263, 262, 262, 261, 260, 260, 259, 259, 258, 257, 257, 256, 255, 255, 254, 254, 253, 252, 252, 251, 251, 250, 249, 249, 248, 248, 247, 247, 246, 246, 245, 245, 244, 243, 243, 242, 242, 241, 241, 240, 240, 239, 239, 238, 238, 237, 237, 237, 236, 236, 235, 235, 234, 234, 233, 233, 232, 232, 231, 231, 231, 230, 230, 229, 229, 228, 228, 228, 227, 227, 226, 226, 225, 225, 225, 224, 224, 223, 223, 223, 222, 222, 222, 221, 221, 220, 220, 220, 219, 219, 219, 218, 218, 217, 217, 217, 216, 216, 216, 215, 215, 215, 214, 214, 214, 213, 213, 213, 212, 212, 212, 211, 211, 211, 210, 210, 210, 209, 209, 209, 208, 208, 208, 207, 207, 207, 207, 206, 206, 206, 205, 205, 205, 204, 204, 204, 204, 203, 203, 203, 202, 202, 202, 202, 201, 201, 201, 200, 200, 200, 200, 199, 199, 199, 199, 198, 198, 198, 198, 197, 197, 197, 196, 196, 196, 196, 195, 195, 195, 195, 194, 194, 194, 194, 193, 193, 193, 193, 192, 192, 192, 192, 192, 191, 191, 191, 191, 190, 190, 190, 190, 189, 189, 189, 189, 189, 188, 188, 188, 188, 187, 187, 187, 187, 187, 186, 186, 186, 186, 186, 185, 185, 185, 185, 184, 184, 184, 184, 184, 183, 183, 183, 183, 183, 182, 182, 182, 182, 182, 181, 181, 181, 181, 181, 180, 180, 180, 180, 180, 180, 179, 179, 179, 179, 179, 178, 178, 178, 178, 178, 177, 177, 177, 177, 177, 177, 176, 176, 176, 176, 176, 176, 175, 175, 175, 175, 175, 174, 174, 174, 174, 174, 174, 173, 173, 173, 173, 173, 173, 172, 172, 172, 172, 172, 172, 171, 171, 171, 171, 0,
3892 		ACC_CURVE,CRV_SMEARING  , 4705, 3056, 2724, 2497, 1498, 1498, 1374, 1276, 1196, 1130, 1073, 1025, 982, 944, 911, 880, 853, 828, 805, 784, 764, 746, 730, 714, 699, 685, 675, 0,
3893 		DEC_CURVE,CRV_NORMALSCAN, 171, 172, 172, 173, 174, 174, 175, 176, 176, 177, 178, 178, 179, 180, 181, 181, 182, 183, 184, 184, 185, 186, 187, 188, 189, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 207, 208, 209, 210, 211, 213, 214, 215, 217, 218, 219, 221, 222, 224, 225, 227, 228, 230, 232, 233, 235, 237, 239, 241, 243, 245, 247, 249, 251, 253, 255, 258, 260, 262, 265, 268, 270, 273, 276, 279, 282, 285, 289, 292, 296, 299, 303, 307, 311, 316, 320, 325, 330, 335, 341, 347, 353, 359, 366, 373, 381, 390, 398, 408, 418, 429, 441, 455, 469, 485, 503, 523, 545, 571, 601, 636, 678, 730, 796, 883, 1005, 1195, 1544, 4705, 0,
3894 		DEC_CURVE,CRV_PARKHOME  , 171, 172, 172, 173, 173, 174, 174, 175, 175, 176, 176, 177, 177, 178, 179, 179, 180, 180, 181, 182, 182, 183, 183, 184, 185, 185, 186, 187, 187, 188, 189, 189, 190, 191, 192, 192, 193, 194, 195, 195, 196, 197, 198, 199, 199, 200, 201, 202, 203, 204, 205, 206, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 217, 218, 219, 220, 221, 222, 223, 225, 226, 227, 228, 230, 231, 232, 234, 235, 237, 238, 240, 241, 243, 244, 246, 247, 249, 251, 253, 254, 256, 258, 260, 262, 264, 266, 268, 271, 273, 275, 278, 280, 282, 285, 288, 290, 293, 296, 299, 302, 305, 309, 312, 316, 319, 323, 327, 331, 336, 340, 345, 350, 355, 360, 365, 371, 377, 384, 391, 398, 406, 414, 422, 432, 441, 452, 463, 476, 489, 504, 520, 538, 558, 580, 605, 633, 667, 706, 752, 810, 883, 979, 1116, 1326, 1714, 4705, 0,
3895 		DEC_CURVE,CRV_SMEARING  , 675, 685, 699, 714, 730, 746, 764, 784, 805, 828, 853, 880, 911, 944, 982, 1025, 1073, 1130, 1196, 1276, 1374, 1498, 1498, 2497, 2724, 3056, 4705, 0,
3896 		DEC_CURVE,CRV_BUFFERFULL, 171, 172, 172, 173, 174, 174, 175, 176, 176, 177, 178, 178, 179, 180, 181, 181, 182, 183, 184, 184, 185, 186, 187, 188, 189, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 207, 208, 209, 210, 211, 213, 214, 215, 217, 218, 219, 221, 222, 224, 225, 227, 228, 230, 232, 233, 235, 237, 239, 241, 243, 245, 247, 249, 251, 253, 255, 258, 260, 262, 265, 268, 270, 273, 276, 279, 282, 285, 289, 292, 296, 299, 303, 307, 311, 316, 320, 325, 330, 335, 341, 347, 353, 359, 366, 373, 381, 390, 398, 408, 418, 429, 441, 455, 469, 485, 503, 523, 545, 571, 601, 636, 678, 730, 796, 883, 1005, 1195, 1544, 4705, 0,
3897 		-2,
3898 
3899 		/* motorcurve 5   */
3900 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
3901 		ACC_CURVE,CRV_NORMALSCAN, 3763, 3763, 3763, 3763, 3763, 3763, 2444, 2178, 1997, 1198, 1198, 1098, 1020, 956, 903, 858, 819, 785, 754, 727, 703, 681, 662, 644, 626, 610, 596, 582, 571, 558, 547, 537, 527, 518, 509, 500, 492, 485, 478, 471, 464, 458, 452, 446, 440, 435, 430, 425, 420, 415, 410, 407, 402, 398, 394, 391, 386, 383, 380, 376, 373, 369, 366, 364, 360, 357, 355, 352, 349, 347, 344, 341, 338, 337, 334, 332, 329, 328, 325, 323, 321, 319, 317, 315, 313, 311, 310, 308, 306, 304, 302, 301, 299, 297, 295, 294, 293, 291, 290, 288, 286, 285, 284, 283, 281, 280, 278, 277, 275, 275, 274, 272, 271, 270, 268, 267, 266, 265, 264, 263, 262, 261, 259, 258, 257, 257, 256, 255, 254, 253, 251, 250, 249, 248, 248, 247, 246, 245, 244, 243, 243, 242, 241, 240, 239, 239, 238, 237, 236, 235, 235, 234, 233, 232, 231, 230, 230, 230, 229, 228, 228, 227, 226, 225, 225,224, 223, 222, 222, 221, 221, 221, 220, 219, 219, 218, 217, 217, 216, 215, 215, 214, 213, 213, 212, 212, 212, 211, 211, 210, 209, 209, 208, 208, 207, 207, 206, 206, 205, 204, 204, 203, 203, 203, 203, 202, 202, 201, 201, 200, 200, 199, 199, 198, 198, 197, 197, 196, 196, 195, 195, 194, 194, 194, 194, 194, 193, 193, 192, 192, 191, 191, 190, 190, 190, 189, 189, 188, 188, 188, 187, 187, 186, 186, 185, 185, 185, 185, 185, 185, 184, 184, 183, 183, 183, 182, 182, 182, 181, 181, 180, 180, 180, 179, 179, 179, 178, 178, 178, 177, 177, 177, 176, 176, 176, 176, 176, 176, 175, 175, 175, 174, 174, 174, 173, 173, 173, 172, 172, 172, 171, 171, 171, 171, 170, 170, 170, 169, 169, 169, 169, 168, 168, 168, 167, 167, 167, 167, 167, 167, 167, 166, 166, 166, 166, 165, 165, 165, 165, 164, 164, 164, 163, 163, 163, 163, 162, 162, 162, 162, 161, 161, 161, 161, 160, 160, 160, 160, 159, 159, 159, 159, 159, 158, 158, 158, 158, 158, 158, 158, 158, 157, 157, 157, 157, 157, 156, 156, 156, 156, 155, 155, 155, 155, 155, 154, 154, 154, 154, 154, 153, 153, 153, 153, 152, 152, 152, 152, 152, 151, 151, 151, 151, 151, 150, 150, 150, 150, 150, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 148, 148, 148, 148, 148, 147, 147, 147, 147, 147, 147, 146, 146, 146, 146, 146, 145, 145, 145, 145, 145, 145, 144, 144, 144, 144, 144, 144, 143, 143, 143, 143, 143, 143, 142, 142, 142, 142, 142, 142, 141, 141, 141, 141, 141, 141, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 139, 139, 139, 139, 139, 139, 139, 138, 138, 138, 138, 138, 138, 138, 137, 137, 137, 137, 137, 137, 137, 136, 136, 136, 136, 136, 136, 136, 135, 135, 135, 135, 135, 135, 135, 134, 134, 134, 134, 134, 134, 134, 134, 133, 133, 133, 133, 133, 133, 133, 133, 132, 132, 132, 132, 132, 132, 132, 132, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 130, 130, 130, 130, 130, 130, 130, 130, 129, 129, 129, 129, 129, 129, 129, 129, 129, 128, 128, 128, 128, 128, 128, 128, 128, 128, 127, 127, 127, 127, 127, 127, 127, 127, 127, 126, 126, 126, 126, 126, 126, 126, 126, 126, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 101, 101, 101, 101, 101, 101, 101, 101, 101,101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 0,
3902 		ACC_CURVE,CRV_PARKHOME  , 3763, 2330, 1803, 1515, 1330, 1198, 1099, 1021, 957, 904, 859, 819, 785, 755, 728, 704, 682, 662, 644, 626, 611, 597, 583, 571, 559, 548, 537, 527, 518, 509, 501, 493, 485, 478, 472, 464, 458, 453, 446, 441, 436, 430, 425, 420, 416, 411, 407, 402, 399, 394, 391, 387, 383, 380, 376, 374, 370, 366, 364, 361, 358, 355, 352, 349, 347, 344, 342, 339, 337, 335, 332, 330, 328, 326, 323, 321, 320, 318, 315, 313, 311, 310, 308, 306, 304, 302, 301, 300, 298, 296, 294, 293, 292, 290, 289, 287, 285, 284, 283, 282, 280, 279, 277, 276, 275, 274, 273, 271, 270, 269, 267, 266, 266, 265, 263, 262, 261, 260, 259, 258, 257, 256, 255, 254, 253, 252, 251, 250, 249, 248, 248, 247, 246, 245, 244, 243, 242, 241, 240, 239, 239, 239, 238, 237, 236, 235, 234, 233, 233, 232, 231, 230, 230, 230, 229, 228, 227, 227, 226, 225, 224, 224, 223, 222, 221, 221, 221, 220, 220, 219, 218, 218, 217, 216, 216, 215, 214, 214, 213, 213, 212, 212, 212, 211, 211, 210, 209, 209, 208, 208, 207, 207, 206, 205, 205, 204, 204, 203, 203, 203, 203, 202, 202, 201, 201, 200, 200, 199, 199, 198, 198, 197, 197, 196, 196, 195, 195, 194, 194, 194, 194, 194, 193, 193, 192, 192, 191, 191, 191, 190, 190, 189, 189, 188, 188, 188, 187, 187, 186, 186, 186, 185, 185, 185, 185, 185, 184, 184, 184, 183, 183, 182, 182, 182, 181, 181, 181, 180, 180, 180, 179, 179, 178, 178, 178, 177, 177, 177, 176, 176, 176, 176, 176, 176, 175, 175, 175, 174, 174, 174, 174, 173, 173, 173, 172, 172, 172, 171, 171, 171, 170, 170, 170, 170, 169, 169, 169, 168, 168, 168, 168, 167, 167, 167, 167, 167, 167, 167, 166, 166, 166, 166, 165, 165, 165, 165, 164, 164, 164, 163, 163, 163, 163, 162, 162, 162, 162, 161, 161, 161, 161, 160, 160, 160, 160, 160, 159, 159, 159, 159, 158, 158, 158, 158, 158, 158, 158, 158, 157, 157, 157, 157, 157, 156, 156, 156, 156, 155, 155, 155, 155, 155, 154, 154, 154, 154, 154, 153, 153, 153, 153, 153, 152, 152, 152, 152, 152, 151, 151, 151, 151, 151, 150, 150, 150, 150, 150, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 148, 148, 148, 148, 148, 148, 147, 147, 147, 147, 147, 147, 146, 146, 146, 146, 146, 145, 145, 145, 145, 145, 145, 144, 144, 144, 144, 144, 144, 143, 143, 143, 143, 143, 143, 142, 142, 142, 142, 142, 142, 141, 141, 141, 141, 141, 141, 141, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 139, 139, 139, 139, 139, 139, 139, 138, 0,
3903 		ACC_CURVE,CRV_SMEARING  , 3763, 2330, 1803, 1515, 1330, 1198, 1099, 1021, 957, 904, 859, 819, 785, 755, 728, 704, 682, 662, 644, 626, 611, 597, 583, 571, 559, 548, 537, 527, 518, 509, 501, 493, 485, 478, 472, 464, 458, 453, 446, 441, 436, 430, 425, 420, 416, 411, 407, 402, 399, 394, 391, 387, 383, 380, 376, 374, 370, 366, 364, 361, 358, 355, 352, 349, 347, 344, 342, 339, 337, 335, 332, 330, 328, 326, 323, 321, 320, 318, 315, 313, 311, 310, 308, 306, 304, 302, 301, 300, 298, 296, 294, 293, 292, 290, 289, 287, 285, 284, 283, 282, 280, 279, 277, 276, 275, 274, 273, 271, 270, 269, 267, 266, 266, 265, 263, 262, 261, 260, 259, 258, 257, 256, 255, 254, 253, 252, 251, 250, 249, 248, 248, 247, 246, 245, 244, 243, 242, 241, 240, 239, 239, 239, 238, 237, 236, 235, 234, 233, 233, 232, 231, 230, 230, 230, 229, 228, 227, 227, 226, 225, 224, 224, 223, 222, 221, 221, 221, 220, 220, 219, 218, 218, 217, 216, 216, 215, 214, 214, 213, 213, 212, 212, 212, 211, 211, 210, 209, 209, 208, 208, 207, 207, 206, 205, 205, 204, 204, 203, 203, 203, 203, 202, 202, 201, 201, 200, 200, 199, 199, 198, 198, 197, 197, 196, 196, 195, 195, 194, 194, 194, 194, 194, 193, 193, 192, 192, 191, 191, 191, 190, 190, 189, 189, 188, 188, 188, 187, 187, 186, 186, 186, 185, 185, 185, 185, 185, 184, 184, 184, 183, 183, 182, 182, 182, 181, 181, 181, 180, 180, 180, 179, 179, 178, 178, 178, 177, 177, 177, 176, 176, 176, 176, 176, 176, 175, 175, 175, 174, 174, 174, 174, 173, 173, 173, 172, 172, 172, 171, 171, 171, 170, 170, 170, 170, 169, 169, 169, 168, 168, 168, 168, 167, 167, 167, 167, 167, 167, 167, 166, 166, 166, 166, 165, 165, 165, 165, 164, 164, 164, 163, 163, 163, 163, 162, 162, 162, 162, 161, 161, 161, 161, 160, 160, 160, 160, 160, 159, 159, 159, 159, 158, 158, 158, 158, 158, 158, 158, 158, 157, 157, 157, 157, 157, 156, 156, 156, 156, 155, 155, 155, 155, 155, 154, 154, 154, 154, 154, 153, 153, 153, 153, 153, 152, 152, 152, 152, 152, 151, 151, 151, 151, 151, 150, 150, 150, 150, 150, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 148, 148, 148, 148, 148, 148, 147, 147, 147, 147, 147, 147, 146, 146, 146, 146, 146, 145, 145, 145, 145, 145, 145, 144, 144, 144, 144, 144, 144, 143, 143, 143, 143, 143, 143, 142, 142, 142, 142, 142, 142, 141, 141, 141, 141, 141, 141, 141, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 139, 139, 139, 139, 139, 139, 139, 138, 0,
3904 		DEC_CURVE,CRV_NORMALSCAN, 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, 278, 280, 282, 284, 286, 288, 290, 292, 294, 296, 298, 300, 302, 304, 306, 308, 310, 312, 314, 316, 318, 320, 322, 324, 326, 328, 330, 332, 334, 336, 338, 340, 342, 345, 348, 351, 354, 357, 360, 363, 366, 369, 372, 375, 378, 381, 384, 387, 391, 395, 399, 403, 407, 411, 415, 419, 422, 425, 429, 433, 437, 441, 445, 449, 453, 458, 463, 468, 473, 478, 483, 489, 495, 501, 507, 514, 521, 528, 536, 544, 553, 562, 572, 582, 593, 604, 616, 629, 643, 658, 674, 692, 711, 732, 755, 781, 810, 843, 880, 923, 974,1035, 1110, 1205, 1331, 1510, 1796, 2368, 3400, 4922, 0,
3905 		DEC_CURVE,CRV_PARKHOME  , 138, 142, 146, 149, 153, 158, 162, 167, 171, 176, 180, 186, 193, 202, 209, 216, 223, 232, 243, 254, 266, 279, 292, 306, 320, 335, 337, 351, 367, 380, 396, 414, 437, 464, 493, 520, 549, 583, 611, 644, 675, 711, 755, 785, 819, 859, 904, 957, 1021, 1099, 1198, 1330, 1515, 1803, 2330, 3763, 0,
3906 		DEC_CURVE,CRV_SMEARING  , 138, 139, 139, 139, 139, 139, 139, 139, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 141, 141, 141, 141, 141, 141, 141, 142, 142, 142, 142, 142, 142, 143, 143, 143, 143, 143, 143, 144, 144, 144, 144, 144, 144, 145, 145, 145, 145, 145, 145, 146, 146, 146, 146, 146, 147, 147, 147, 147, 147, 147, 148, 148, 148, 148, 148, 148, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 150, 150, 150, 150, 150, 151, 151, 151, 151, 151, 152, 152, 152, 152, 152, 153, 153, 153, 153, 153, 154, 154, 154, 154, 154, 155, 155, 155, 155, 155, 156, 156, 156, 156, 157, 157, 157, 157, 157, 158, 158, 158, 158, 158, 158, 158, 158, 159, 159, 159, 159, 160, 160, 160, 160, 160, 161, 161, 161, 161, 162, 162, 162, 162, 163, 163, 163, 163, 164, 164, 164, 165, 165, 165, 165, 166, 166, 166, 166, 167, 167, 167, 167, 167, 167, 167, 168, 168, 168, 168, 169, 169, 169, 170, 170, 170, 170, 171, 171, 171, 172, 172, 172, 173, 173, 173, 174, 174, 174, 174, 175, 175, 175, 176, 176, 176, 176, 176, 176, 177, 177, 177, 178, 178, 178, 179, 179, 180, 180, 180, 181, 181, 181, 182, 182, 182, 183, 183, 184, 184, 184, 185, 185, 185, 185, 185, 186, 186, 186, 187, 187, 188, 188, 188, 189, 189, 190, 190, 191, 191, 191, 192, 192, 193, 193, 194, 194, 194, 194, 194, 195, 195, 196, 196, 197, 197, 198, 198, 199, 199, 200, 200, 201, 201, 202, 202, 203, 203, 203, 203, 204, 204, 205, 205, 206, 207, 207, 208, 208, 209, 209, 210, 211, 211, 212, 212, 212, 213, 213, 214, 214, 215, 216, 216, 217, 218, 218, 219, 220, 220, 221, 221, 221, 222, 223, 224, 224, 225, 226, 227, 227, 228, 229, 230, 230, 230, 231, 232, 233, 233, 234, 235, 236, 237, 238, 239, 239, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 265, 266, 266, 267, 269, 270, 271, 273, 274, 275, 276, 277, 279, 280, 282, 283, 284, 285, 287, 289, 290, 292, 293, 294, 296, 298, 300, 301, 302, 304, 306, 308, 310, 311, 313, 315, 318, 320, 321, 323, 326, 328, 330, 332, 335, 337, 339, 342, 344, 347, 349, 352, 355, 358, 361, 364, 366, 370, 374, 376, 380, 383, 387, 391, 394, 399, 402, 407, 411, 416, 420, 425, 430, 436, 441, 446, 453, 458, 464, 472, 478, 485, 493, 501, 509, 518, 527, 537, 548, 559, 571, 583, 597, 611, 626, 644, 662, 682, 704, 728, 755, 785, 819, 859, 904, 957, 1021, 1099, 1198, 1330, 1515, 1803, 2330, 3763, 0,
3907 		DEC_CURVE,CRV_BUFFERFULL, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 94, 94, 94, 95, 95, 95, 95, 95, 96, 96, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 102, 102, 103, 104, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 113, 115, 117, 119, 121, 122, 124, 127, 130, 132, 135, 139, 142, 146, 149, 153, 158, 162, 167, 171, 176, 180, 186, 193, 202, 209, 216, 223, 232, 243, 254, 266, 279, 292, 306, 320, 335, 337, 351, 367, 380, 396, 414, 437, 464, 493, 520, 549, 583, 611, 644, 675, 711, 755, 785, 819, 859, 904, 957, 1021, 1099, 1198, 1330, 1515, 1803, 2330, 3763, 0,
3908 		-2,
3909 
3910 		/* motorcurve 6   */
3911 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
3912 		ACC_CURVE,CRV_NORMALSCAN, 4705, 2664, 2061, 1732, 1521, 1370, 1257, 1167, 1094, 1033, 982, 937, 898, 864, 833, 805, 780, 757, 736, 717, 699, 683, 667, 653, 640, 627, 615, 604, 593, 583, 574, 564, 556, 547, 540, 532, 525, 518, 511, 505, 499, 493, 487, 481, 476, 471, 466, 461, 456, 452, 447, 443, 439, 435, 431, 427, 424, 420, 417, 413, 410, 407, 403, 400, 397, 394, 391, 389, 386, 383, 381, 378, 375, 373, 371, 368, 366, 364, 361, 359, 357, 355, 353, 351, 349, 347, 345, 343, 341, 339, 338, 336, 334, 332, 331, 329, 327, 326, 324, 323, 321, 320, 318, 317, 315, 314, 312, 311, 310, 308, 307, 306, 304, 303, 302, 301, 299, 298, 297, 296, 295, 293, 292, 291, 290, 289, 288, 287, 286, 285, 284, 283, 282, 281, 280, 279, 278, 277, 276, 275, 274, 273, 272, 271, 270, 270, 269, 268, 267, 266, 265, 264, 264, 263, 262, 261, 260, 260, 259, 258, 257, 257, 256, 255, 255, 254, 253, 252, 252, 251, 250, 250, 249, 248, 248, 247, 246, 246, 245, 244, 244, 243, 242, 242, 241, 241, 240, 239, 239, 238, 238, 237, 237, 236, 235, 235, 234, 234, 233, 233, 232, 232, 231, 231, 230, 230, 229, 229, 228, 227, 227, 227, 226, 226, 225, 225, 224, 224, 223, 223, 222, 222, 221, 221, 220, 220, 219, 219, 219, 218, 218, 217, 217, 216, 216, 216, 215, 215, 214, 214, 214, 213, 213, 212, 212, 212, 211, 211, 210, 210, 210, 209, 209, 208, 208, 208, 207, 207, 207, 206, 206, 206, 205, 205, 204, 204, 204, 203, 203, 203, 202, 202, 202, 201, 201, 201, 200, 200, 200, 199, 199, 199, 198, 198, 198, 197, 197, 197, 197, 196, 196, 196, 195, 195, 195, 194, 194, 194, 194, 193, 193, 193, 192, 192, 192, 192, 191, 191, 191, 190, 190, 190, 190, 189, 189, 189, 188, 188, 188, 188, 187, 187, 187, 187, 186, 186, 186, 186, 185, 185, 185, 185, 184, 184, 184, 184, 183, 183, 183, 183, 182, 182, 182, 182, 181, 181, 181, 181, 181, 180, 180, 180, 180, 179, 179, 179, 179, 178, 178, 178, 178, 178, 177, 177, 177, 177, 177, 176, 176, 176, 176, 175, 175, 175, 175, 175, 174, 174, 174, 174, 174, 173, 173, 173, 173, 173, 172, 172, 172, 172, 172, 171, 171, 171, 0,
3913 		ACC_CURVE,CRV_PARKHOME  , 4705, 2888, 2234, 1878, 1648, 1485, 1362, 1265, 1186, 1120, 1064, 1016, 973, 936, 903, 873, 845, 821, 798, 777, 758, 740, 723, 708, 693, 679, 666, 654, 643, 632, 621, 612, 602, 593, 585, 576, 569, 561, 554, 547, 540, 534, 528, 522, 516, 510, 505, 499, 494, 490, 485, 480, 476, 471, 467, 463, 459, 455, 451, 448, 444, 440, 437, 434, 430, 427, 424, 421, 418, 415, 412, 409, 407, 404, 401, 399, 396, 394, 391, 389, 387, 384, 382, 380, 378, 376, 374, 371, 369, 367, 366, 364, 362, 360, 358, 356, 354, 353, 351, 349, 348, 346, 344, 343, 341, 340, 338, 337, 335, 334, 332, 331, 329, 328, 327, 325, 324, 323, 321, 320, 319, 318, 316, 315, 314, 313, 312, 311, 309, 308, 307, 306, 305, 304, 303, 302, 301, 300, 299, 298, 297, 296, 295, 294, 293, 292, 291, 290, 289, 288, 287, 286, 285, 285, 284, 283, 282, 281, 280, 279, 279, 278, 277, 276, 275, 275, 274, 273, 272, 272, 271, 270, 269, 269, 268, 267, 267, 266, 265, 264, 264, 263, 262, 262, 261, 260, 260, 259, 259, 258, 257, 257, 256, 255, 255, 254, 254, 253, 252, 252, 251, 251, 250, 249, 249, 248, 248, 247, 247, 246, 246, 245, 245, 244, 243, 243, 242, 242, 241, 241, 240, 240, 239, 239, 238, 238, 237, 237, 237, 236, 236, 235, 235, 234, 234, 233, 233, 232, 232, 231, 231, 231, 230, 230, 229, 229, 228, 228, 228, 227, 227, 226, 226, 225, 225, 225, 224, 224, 223, 223, 223, 222, 222, 222, 221, 221, 220, 220, 220, 219, 219, 219, 218, 218, 217, 217, 217, 216, 216, 216, 215, 215, 215, 214, 214, 214, 213, 213, 213, 212, 212, 212, 211, 211, 211, 210, 210, 210, 209, 209, 209, 208, 208, 208, 207, 207, 207, 207, 206, 206, 206, 205, 205, 205, 204, 204, 204, 204, 203, 203, 203, 202, 202, 202, 202, 201, 201, 201, 200, 200, 200, 200, 199, 199, 199, 199, 198, 198, 198, 198, 197, 197, 197, 196, 196, 196, 196, 195, 195, 195, 195, 194, 194, 194, 194, 193, 193, 193, 193, 192, 192, 192, 192, 192, 191, 191, 191, 191, 190, 190, 190, 190, 189, 189, 189, 189, 189, 188, 188, 188, 188, 187, 187, 187, 187, 187, 186, 186, 186, 186, 186, 185, 185, 185, 185, 184, 184, 184, 184, 184, 183, 183, 183, 183, 183, 182, 182, 182, 182, 182, 181, 181, 181, 181, 181, 180, 180, 180, 180, 180, 180, 179, 179, 179, 179, 179, 178, 178, 178, 178, 178, 177, 177, 177, 177, 177, 177, 176, 176, 176, 176, 176, 176, 175, 175, 175, 175, 175, 174, 174, 174, 174, 174, 174, 173, 173, 173, 173, 173, 173, 172, 172, 172, 172, 172, 172, 171, 171, 171, 171, 0,
3914 		ACC_CURVE,CRV_SMEARING  , 4705, 3056, 2724, 2497, 1498, 1498, 1374, 1276, 1196, 1130, 1073, 1025, 982, 944, 911, 880, 853, 828, 805, 784, 764, 746, 730, 714, 699, 685, 675, 0,
3915 		DEC_CURVE,CRV_NORMALSCAN, 523, 545, 571, 601, 636, 678, 730, 796, 883, 1005, 1195, 1544, 4705, 0,
3916 		DEC_CURVE,CRV_PARKHOME  , 171, 172, 172, 173, 173, 174, 174, 175, 175, 176, 176, 177, 177, 178, 179, 179, 180, 180, 181, 182, 182, 183, 183, 184, 185, 185, 186, 187, 187, 188, 189, 189, 190, 191, 192, 192, 193, 194, 195, 195, 196, 197, 198, 199, 199, 200, 201, 202, 203, 204, 205, 206, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 217, 218, 219, 220, 221, 222, 223, 225, 226, 227, 228, 230, 231, 232, 234, 235, 237, 238, 240, 241, 243, 244, 246, 247, 249, 251, 253, 254, 256, 258, 260, 262, 264, 266, 268, 271, 273, 275, 278, 280, 282, 285, 288, 290, 293, 296, 299, 302, 305, 309, 312, 316, 319, 323, 327, 331, 336, 340, 345, 350, 355, 360, 365, 371, 377, 384, 391, 398, 406, 414, 422, 432, 441, 452, 463, 476, 489, 504, 520, 538, 558, 580, 605, 633, 667, 706, 752, 810, 883, 979, 1116, 1326, 1714, 4705, 0,
3917 		DEC_CURVE,CRV_SMEARING  , 675, 685, 699, 714, 730, 746, 764, 784, 805, 828, 853, 880, 911, 944, 982, 1025, 1073, 1130, 1196, 1276, 1374, 1498, 1498, 2497, 2724, 3056, 4705, 0,
3918 		DEC_CURVE,CRV_BUFFERFULL, 171, 172, 172, 173, 174, 174, 175, 176, 176, 177, 178, 178, 179, 180, 181, 181, 182, 183, 184, 184, 185, 186, 187, 188, 189, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 207, 208, 209, 210, 211, 213, 214, 215, 217, 218, 219, 221, 222, 224, 225, 227, 228, 230, 232, 233, 235, 237, 239, 241, 243, 245, 247, 249, 251, 253, 255, 258, 260, 262, 265, 268, 270, 273, 276, 279, 282, 285, 289, 292, 296, 299, 303, 307, 311, 316, 320, 325, 330, 335, 341, 347, 353, 359, 366, 373, 381, 390, 398, 408, 418, 429, 441, 455, 469, 485, 503, 523, 545, 571, 601, 636, 678, 730, 796, 883, 1005, 1195, 1544, 4705, 0,
3919 		-2,
3920 
3921 		/* motorcurve 7   */
3922 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
3923 		ACC_CURVE,CRV_NORMALSCAN, 3763, 3763, 3763, 3763, 3763, 3763, 2444, 2178, 1997, 1198, 1198, 1098, 1020, 956, 903, 858, 819, 785, 754, 727, 703, 681, 662, 644, 626, 610, 596, 582, 571, 558, 547, 537, 527, 518, 509, 500, 492, 485, 478, 471, 464, 458, 452, 446, 440, 435, 430, 425, 420, 415, 410, 407, 402, 398, 394, 391, 386, 383, 380, 376, 373, 369, 366, 364, 360, 357, 355, 352, 349, 347, 344, 341, 338, 337, 334, 332, 329, 328, 325, 323, 321, 319, 317, 315, 313, 311, 310, 308, 306, 304, 302, 301, 299, 297, 295, 294, 293, 291, 290, 288, 286, 285, 284, 283, 281, 280, 278, 277, 275, 275, 274, 272, 271, 270, 268, 267, 266, 265, 264, 263, 262, 261, 259, 258, 257, 257, 256, 255, 254, 253, 251, 250, 249, 248, 248, 247, 246, 245, 244, 243, 243, 242, 241, 240, 239, 239, 238, 237, 236, 235, 235, 234, 233, 232, 231, 230, 230, 230, 229, 228, 228, 227, 226, 225, 225,224, 223, 222, 222, 221, 221, 221, 220, 219, 219, 218, 217, 217, 216, 215, 215, 214, 213, 213, 212, 212, 212, 211, 211, 210, 209, 209, 208, 208, 207, 207, 206, 206, 205, 204, 204, 203, 203, 203, 203, 202, 202, 201, 201, 200, 200, 199, 199, 198, 198, 197, 197, 196, 196, 195, 195, 194, 194, 194, 194, 194, 193, 193, 192, 192, 191, 191, 190, 190, 190, 189, 189, 188, 188, 188, 187, 187, 186, 186, 185, 185, 185, 185, 185, 185, 184, 184, 183, 183, 183, 182, 182, 182, 181, 181, 180, 180, 180, 179, 179, 179, 178, 178, 178, 177, 177, 177, 176, 176, 176, 176, 176, 176, 175, 175, 175, 174, 174, 174, 173, 173, 173, 172, 172, 172, 171, 171, 171, 171, 170, 170, 170, 169, 169, 169, 169, 168, 168, 168, 167, 167, 167, 167, 167, 167, 167, 166, 166, 166, 166, 165, 165, 165, 165, 164, 164, 164, 163, 163, 163, 163, 162, 162, 162, 162, 161, 161, 161, 161, 160, 160, 160, 160, 159, 159, 159, 159, 159, 158, 158, 158, 158, 158, 158, 158, 158, 157, 157, 157, 157, 157, 156, 156, 156, 156, 155, 155, 155, 155, 155, 154, 154, 154, 154, 154, 153, 153, 153, 153, 152, 152, 152, 152, 152, 151, 151, 151, 151, 151, 150, 150, 150, 150, 150, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 148, 148, 148, 148, 148, 147, 147, 147, 147, 147, 147, 146, 146, 146, 146, 146, 145, 145, 145, 145, 145, 145, 144, 144, 144, 144, 144, 144, 143, 143, 143, 143, 143, 143, 142, 142, 142, 142, 142, 142, 141, 141, 141, 141, 141, 141, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 139, 139, 139, 139, 139, 139, 139, 138, 138, 138, 138, 138, 138, 138, 137, 137, 137, 137, 137, 137, 137, 136, 136, 136, 136, 136, 136, 136, 135, 135, 135, 135, 135, 135, 135, 134, 134, 134, 134, 134, 134, 134, 134, 133, 133, 133, 133, 133, 133, 133, 133, 132, 132, 132, 132, 132, 132, 132, 132, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 130, 130, 130, 130, 130, 130, 130, 130, 129, 129, 129, 129, 129, 129, 129, 129, 129, 128, 128, 128, 128, 128, 128, 128, 128, 128, 127, 127, 127, 127, 127, 127, 127, 127, 127, 126, 126, 126, 126, 126, 126, 126, 126, 126, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 101, 101, 101, 101, 101, 101, 101, 101, 101,101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 0,
3924 		ACC_CURVE,CRV_PARKHOME  , 3763, 2330, 1803, 1515, 1330, 1198, 1099, 1021, 957, 904, 859, 819, 785, 755, 728, 704, 682, 662, 644, 626, 611, 597, 583, 571, 559, 548, 537, 527, 518, 509, 501, 493, 485, 478, 472, 464, 458, 453, 446, 441, 436, 430, 425, 420, 416, 411, 407, 402, 399, 394, 391, 387, 383, 380, 376, 374, 370, 366, 364, 361, 358, 355, 352, 349, 347, 344, 342, 339, 337, 335, 332, 330, 328, 326, 323, 321, 320, 318, 315, 313, 311, 310, 308, 306, 304, 302, 301, 300, 298, 296, 294, 293, 292, 290, 289, 287, 285, 284, 283, 282, 280, 279, 277, 276, 275, 274, 273, 271, 270, 269, 267, 266, 266, 265, 263, 262, 261, 260, 259, 258, 257, 256, 255, 254, 253, 252, 251, 250, 249, 248, 248, 247, 246, 245, 244, 243, 242, 241, 240, 239, 239, 239, 238, 237, 236, 235, 234, 233, 233, 232, 231, 230, 230, 230, 229, 228, 227, 227, 226, 225, 224, 224, 223, 222, 221, 221, 221, 220, 220, 219, 218, 218, 217, 216, 216, 215, 214, 214, 213, 213, 212, 212, 212, 211, 211, 210, 209, 209, 208, 208, 207, 207, 206, 205, 205, 204, 204, 203, 203, 203, 203, 202, 202, 201, 201, 200, 200, 199, 199, 198, 198, 197, 197, 196, 196, 195, 195, 194, 194, 194, 194, 194, 193, 193, 192, 192, 191, 191, 191, 190, 190, 189, 189, 188, 188, 188, 187, 187, 186, 186, 186, 185, 185, 185, 185, 185, 184, 184, 184, 183, 183, 182, 182, 182, 181, 181, 181, 180, 180, 180, 179, 179, 178, 178, 178, 177, 177, 177, 176, 176, 176, 176, 176, 176, 175, 175, 175, 174, 174, 174, 174, 173, 173, 173, 172, 172, 172, 171, 171, 171, 170, 170, 170, 170, 169, 169, 169, 168, 168, 168, 168, 167, 167, 167, 167, 167, 167, 167, 166, 166, 166, 166, 165, 165, 165, 165, 164, 164, 164, 163, 163, 163, 163, 162, 162, 162, 162, 161, 161, 161, 161, 160, 160, 160, 160, 160, 159, 159, 159, 159, 158, 158, 158, 158, 158, 158, 158, 158, 157, 157, 157, 157, 157, 156, 156, 156, 156, 155, 155, 155, 155, 155, 154, 154, 154, 154, 154, 153, 153, 153, 153, 153, 152, 152, 152, 152, 152, 151, 151, 151, 151, 151, 150, 150, 150, 150, 150, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 148, 148, 148, 148, 148, 148, 147, 147, 147, 147, 147, 147, 146, 146, 146, 146, 146, 145, 145, 145, 145, 145, 145, 144, 144, 144, 144, 144, 144, 143, 143, 143, 143, 143, 143, 142, 142, 142, 142, 142, 142, 141, 141, 141, 141, 141, 141, 141, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 139, 139, 139, 139, 139, 139, 139, 138, 0,
3925 		ACC_CURVE,CRV_SMEARING  , 3763, 2330, 1803, 1515, 1330, 1198, 1099, 1021, 957, 904, 859, 819, 785, 755, 728, 704, 682, 662, 644, 626, 611, 597, 583, 571, 559, 548, 537, 527, 518, 509, 501, 493, 485, 478, 472, 464, 458, 453, 446, 441, 436, 430, 425, 420, 416, 411, 407, 402, 399, 394, 391, 387, 383, 380, 376, 374, 370, 366, 364, 361, 358, 355, 352, 349, 347, 344, 342, 339, 337, 335, 332, 330, 328, 326, 323, 321, 320, 318, 315, 313, 311, 310, 308, 306, 304, 302, 301, 300, 298, 296, 294, 293, 292, 290, 289, 287, 285, 284, 283, 282, 280, 279, 277, 276, 275, 274, 273, 271, 270, 269, 267, 266, 266, 265, 263, 262, 261, 260, 259, 258, 257, 256, 255, 254, 253, 252, 251, 250, 249, 248, 248, 247, 246, 245, 244, 243, 242, 241, 240, 239, 239, 239, 238, 237, 236, 235, 234, 233, 233, 232, 231, 230, 230, 230, 229, 228, 227, 227, 226, 225, 224, 224, 223, 222, 221, 221, 221, 220, 220, 219, 218, 218, 217, 216, 216, 215, 214, 214, 213, 213, 212, 212, 212, 211, 211, 210, 209, 209, 208, 208, 207, 207, 206, 205, 205, 204, 204, 203, 203, 203, 203, 202, 202, 201, 201, 200, 200, 199, 199, 198, 198, 197, 197, 196, 196, 195, 195, 194, 194, 194, 194, 194, 193, 193, 192, 192, 191, 191, 191, 190, 190, 189, 189, 188, 188, 188, 187, 187, 186, 186, 186, 185, 185, 185, 185, 185, 184, 184, 184, 183, 183, 182, 182, 182, 181, 181, 181, 180, 180, 180, 179, 179, 178, 178, 178, 177, 177, 177, 176, 176, 176, 176, 176, 176, 175, 175, 175, 174, 174, 174, 174, 173, 173, 173, 172, 172, 172, 171, 171, 171, 170, 170, 170, 170, 169, 169, 169, 168, 168, 168, 168, 167, 167, 167, 167, 167, 167, 167, 166, 166, 166, 166, 165, 165, 165, 165, 164, 164, 164, 163, 163, 163, 163, 162, 162, 162, 162, 161, 161, 161, 161, 160, 160, 160, 160, 160, 159, 159, 159, 159, 158, 158, 158, 158, 158, 158, 158, 158, 157, 157, 157, 157, 157, 156, 156, 156, 156, 155, 155, 155, 155, 155, 154, 154, 154, 154, 154, 153, 153, 153, 153, 153, 152, 152, 152, 152, 152, 151, 151, 151, 151, 151, 150, 150, 150, 150, 150, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 148, 148, 148, 148, 148, 148, 147, 147, 147, 147, 147, 147, 146, 146, 146, 146, 146, 145, 145, 145, 145, 145, 145, 144, 144, 144, 144, 144, 144, 143, 143, 143, 143, 143, 143, 142, 142, 142, 142, 142, 142, 141, 141, 141, 141, 141, 141, 141, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 139, 139, 139, 139, 139, 139, 139, 138, 0,
3926 		DEC_CURVE,CRV_NORMALSCAN, 522, 522, 528, 536, 544, 553, 562, 572, 582, 593, 604, 616, 629, 643, 658, 674, 692, 711, 732, 755, 781, 810, 843, 880, 923, 974, 1035, 1110, 1205, 1331, 1510, 1796, 2368, 3400, 4922, 0,
3927 		DEC_CURVE,CRV_PARKHOME  , 138, 142, 146, 149, 153, 158, 162, 167, 171, 176, 180, 186, 193, 202, 209, 216, 223, 232, 243, 254, 266, 279, 292, 306, 320, 335, 337, 351, 367, 380, 396, 414, 437, 464, 493, 520, 549, 583, 611, 644, 675, 711, 755, 785, 819, 859, 904, 957, 1021, 1099, 1198, 1330, 1515, 1803, 2330, 3763, 0,
3928 		DEC_CURVE,CRV_SMEARING  , 138, 139, 139, 139, 139, 139, 139, 139, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 141, 141, 141, 141, 141, 141, 141, 142, 142, 142, 142, 142, 142, 143, 143, 143, 143, 143, 143, 144, 144, 144, 144, 144, 144, 145, 145, 145, 145, 145, 145, 146, 146, 146, 146, 146, 147, 147, 147, 147, 147, 147, 148, 148, 148, 148, 148, 148, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 150, 150, 150, 150, 150, 151, 151, 151, 151, 151, 152, 152, 152, 152, 152, 153, 153, 153, 153, 153, 154, 154, 154, 154, 154, 155, 155, 155, 155, 155, 156, 156, 156, 156, 157, 157, 157, 157, 157, 158, 158, 158, 158, 158, 158, 158, 158, 159, 159, 159, 159, 160, 160, 160, 160, 160, 161, 161, 161, 161, 162, 162, 162, 162, 163, 163, 163, 163, 164, 164, 164, 165, 165, 165, 165, 166, 166, 166, 166, 167, 167, 167, 167, 167, 167, 167, 168, 168, 168, 168, 169, 169, 169, 170, 170, 170, 170, 171, 171, 171, 172, 172, 172, 173, 173, 173, 174, 174, 174, 174, 175, 175, 175, 176, 176, 176, 176, 176, 176, 177, 177, 177, 178, 178, 178, 179, 179, 180, 180, 180, 181, 181, 181, 182, 182, 182, 183, 183, 184, 184, 184, 185, 185, 185, 185, 185, 186, 186, 186, 187, 187, 188, 188, 188, 189, 189, 190, 190, 191, 191, 191, 192, 192, 193, 193, 194, 194, 194, 194, 194, 195, 195, 196, 196, 197, 197, 198, 198, 199, 199, 200, 200, 201, 201, 202, 202, 203, 203, 203, 203, 204, 204, 205, 205, 206, 207, 207, 208, 208, 209, 209, 210, 211, 211, 212, 212, 212, 213, 213, 214, 214, 215, 216, 216, 217, 218, 218, 219, 220, 220, 221, 221, 221, 222, 223, 224, 224, 225, 226, 227, 227, 228, 229, 230, 230, 230, 231, 232, 233, 233, 234, 235, 236, 237, 238, 239, 239, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 265, 266, 266, 267, 269, 270, 271, 273, 274, 275, 276, 277, 279, 280, 282, 283, 284, 285, 287, 289, 290, 292, 293, 294, 296, 298, 300, 301, 302, 304, 306, 308, 310, 311, 313, 315, 318, 320, 321, 323, 326, 328, 330, 332, 335, 337, 339, 342, 344, 347, 349, 352, 355, 358, 361, 364, 366, 370, 374, 376, 380, 383, 387, 391, 394, 399, 402, 407, 411, 416, 420, 425, 430, 436, 441, 446, 453, 458, 464, 472, 478, 485, 493, 501, 509, 518, 527, 537, 548, 559, 571, 583, 597, 611, 626, 644, 662, 682, 704, 728, 755, 785, 819, 859, 904, 957, 1021, 1099, 1198, 1330, 1515, 1803, 2330, 3763, 0,
3929 		DEC_CURVE,CRV_BUFFERFULL, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 94, 94, 94, 95, 95, 95, 95, 95, 96, 96, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 102, 102, 103, 104, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 113, 115, 117, 119, 121, 122, 124, 127, 130, 132, 135, 139, 142, 146, 149, 153, 158, 162, 167, 171, 176, 180, 186, 193, 202, 209, 216, 223, 232, 243, 254, 266, 279, 292, 306, 320, 335, 337, 351, 367, 380, 396, 414, 437, 464, 493, 520, 549, 583, 611, 644, 675, 711, 755, 785, 819, 859, 904, 957, 1021, 1099, 1198, 1330, 1515, 1803, 2330, 3763, 0,
3930 		-2,
3931 
3932 		/* motorcurve 8   */
3933 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
3934 		ACC_CURVE,CRV_NORMALSCAN, 1046, 1046, 1046, 1046, 1046, 1046, 647, 501, 421, 370, 333, 305, 284, 266, 251, 239, 228, 218, 210, 202, 196, 190, 184, 179, 174, 170, 166, 162, 159, 155, 152, 149, 147, 144, 142, 139, 137, 135, 133, 131, 129, 127, 126, 124, 123, 121, 120, 118, 117, 116, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 100, 99, 98, 97, 96, 96, 95, 94, 94, 93, 92, 92, 91, 91, 90, 89, 89, 88, 88, 87, 87, 86, 86, 85, 85, 84, 84, 83, 83, 82, 82, 82, 81, 81, 80, 80, 79, 79, 79, 78, 78, 78, 77, 77, 76, 76, 76, 75, 75, 75, 74, 74, 74, 74, 73, 73, 73, 72, 72, 72, 71, 71, 71, 71, 70, 70, 70, 70, 69, 69, 69, 69, 68, 68, 68, 68, 67, 67, 67, 67, 66, 66, 66, 66, 65, 65, 65, 65, 64, 64, 64, 64, 63, 63, 63, 63, 62, 62, 62, 62, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 59, 58, 58, 58, 58, 58, 58, 57, 57, 57, 57, 57, 57, 57, 56, 56, 56, 56, 56, 56, 56, 56, 55, 55, 55, 55, 55, 55, 55, 55, 54, 54, 54, 54, 54, 54, 54, 54, 53, 53, 53, 53, 53, 53, 53, 53, 52, 52, 52, 52, 52, 52, 52, 52, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 23, 23, 0,
3935 		ACC_CURVE,CRV_PARKHOME  , 1045, 678, 604, 554, 332, 332, 304, 283, 265, 250, 238, 227, 217, 209, 201, 195, 189, 183, 178,173, 169, 165, 161, 158, 154, 151, 148, 146, 143, 141, 138, 136, 134, 132, 130, 128, 126, 125, 123, 122, 120, 119, 117, 116, 115, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103,102, 101, 100, 99, 99, 98, 97, 96, 95, 95, 94, 93, 93, 92, 91, 91, 90, 90, 89, 88, 88, 87, 87, 86, 86, 85, 85, 84, 84, 83, 83, 82, 82, 81, 81, 81, 80, 80, 79, 79, 78, 78, 78, 77, 77, 77, 76, 76, 75, 75, 75, 74, 74, 74, 73, 73, 73, 73, 72, 72, 72, 71, 71, 71, 70, 70, 70, 70, 69, 69, 69, 69, 68, 68, 68, 68, 67, 67, 67, 67, 66, 66, 66, 66, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 61, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 58, 58, 58, 58, 58, 58, 58, 57, 57, 57, 57, 57, 57, 57, 56, 56, 56, 56, 56, 56, 56, 55, 55, 55, 55, 55, 55, 55, 55, 54, 54, 54, 54, 54, 54, 54, 54, 53, 53, 53, 53, 53, 53, 53, 53, 53, 52, 52, 52, 52, 52, 52, 52, 52, 52, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 39, 0,
3936 		ACC_CURVE,CRV_SMEARING  , 1045, 678, 604, 554, 332, 332, 304, 283, 265, 250, 238, 227, 217, 209, 201, 195, 189, 183, 178,173, 169, 165, 161, 158, 154, 151, 148, 146, 143, 141, 138, 136, 134, 132, 130, 128, 126, 125, 123, 122, 120, 119, 117, 116, 115, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103,102, 101, 100, 99, 99, 98, 97, 96, 95, 95, 94, 93, 93, 92, 91, 91, 90, 90, 89, 88, 88, 87, 87, 86, 86, 85, 85, 84, 84, 83, 83, 82, 82, 81, 81, 81, 80, 80, 79, 79, 78, 78, 78, 77, 77, 77, 76, 76, 75, 75, 75, 74, 74, 74, 73, 73, 73, 73, 72, 72, 72, 71, 71, 71, 70, 70, 70, 70, 69, 69, 69, 69, 68, 68, 68, 68, 67, 67, 67, 67, 66, 66, 66, 66, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 61, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 58, 58, 58, 58, 58, 58, 58, 57, 57, 57, 57, 57, 57, 57, 56, 56, 56, 56, 56, 56, 56, 55, 55, 55, 55, 55, 55, 55, 55, 54, 54, 54, 54, 54, 54, 54, 54, 53, 53, 53, 53, 53, 53, 53, 53, 53, 52, 52, 52, 52, 52, 52, 52, 52, 52, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 39, 0,
3937 		DEC_CURVE,CRV_NORMALSCAN, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 32, 33, 33, 34, 34, 35, 35, 36, 37, 38, 38, 39, 40, 41, 42, 43, 45, 46, 47, 48, 50, 51, 53, 54, 57, 59, 61, 63, 65, 68, 71, 75, 78, 82, 86, 90, 94, 94, 98, 103, 106, 111, 116, 122, 130, 138, 145, 153, 163, 171, 180, 188, 198, 211, 219, 228, 239, 252, 267, 284, 306, 334, 370, 422, 502, 648, 1045, 0,
3938 		DEC_CURVE,CRV_PARKHOME  , 39, 40, 41, 42, 43, 45, 46, 47, 48, 50, 51, 53, 54, 57, 59, 61, 63, 65, 68, 71, 75, 78, 82, 86, 90, 94, 94, 98, 103, 106, 111, 116, 122, 130, 138, 145, 153, 163, 171, 180, 188, 198, 211, 219, 228, 239, 252, 267, 284, 306, 334, 370, 422, 502, 648, 1045, 0,
3939 		DEC_CURVE,CRV_SMEARING  , 39, 39, 39, 39, 39, 39, 39, 39, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 54, 54, 54, 54, 54, 54, 54, 54, 54, 55, 55, 55, 55, 55, 55, 55, 55, 55, 56, 56, 56, 56, 56, 56, 56, 56, 57, 57, 57, 57, 57, 57, 57, 57, 58, 58, 58, 58, 58, 58, 58, 59, 59, 59, 59, 59, 59, 59, 60, 60, 60, 60, 60, 60, 60, 61, 61, 61, 61, 61, 61, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 67, 67, 67, 67, 67, 68, 68, 68, 68, 69, 69, 69, 69, 70, 70, 70, 70, 71, 71, 71, 71, 72, 72, 72, 73, 73, 73, 73, 74, 74, 74, 75, 75, 75, 76, 76, 76, 77, 77, 77, 78, 78, 78, 79, 79, 79, 80, 80, 81, 81, 81, 82, 82, 83, 83, 84, 84, 84, 85, 85, 86, 86, 87, 87, 88, 88, 89, 90, 90, 91, 91, 92, 93, 93, 94, 94, 95, 96, 96, 97, 98, 99, 99, 100, 101, 102, 103, 104, 105, 105, 106, 107, 108, 109, 110, 112, 113, 114, 115, 116, 118, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 136, 138, 140, 142, 145, 147, 150, 153, 156, 159, 163, 167, 171, 175, 180, 185, 190, 196, 203, 211, 219, 228, 239, 252, 267, 284, 306, 334, 370, 422, 502, 648, 1045, 0,
3940 		DEC_CURVE,CRV_BUFFERFULL, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 32, 33, 33, 34, 34, 35, 35, 36, 37, 38, 38, 39, 40, 41, 42, 43, 45, 46, 47, 48, 50, 51, 53, 54, 57, 59, 61, 63, 65, 68, 71, 75, 78, 82, 86, 90, 94, 94, 98, 103, 106, 111, 116, 122, 130, 138, 145, 153, 163, 171, 180, 188, 198, 211, 219, 228, 239, 252, 267, 284, 306, 334, 370, 422, 502, 648, 1045, 0,
3941 		-1
3942 	};
3943 
3944 	rst = (SANE_Int *)malloc(sizeof(steps));
3945 	if (rst != NULL)
3946 		memcpy(rst, &steps, sizeof(steps));
3947 
3948 	return rst;
3949 }
3950 
hp3970_motor()3951 static SANE_Int *hp3970_motor()
3952 {
3953 	SANE_Int *rst = NULL;
3954 	SANE_Int steps[]  =
3955 	{
3956 		/* motorcurve 1   */
3957 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
3958 		ACC_CURVE,CRV_NORMALSCAN, 2000, 1984, 1968, 1953, 1937, 1921, 1906, 1890, 1874, 1859, 1843, 1827, 1812, 1796, 1781, 1765, 1749, 1734, 1715, 1700, 1684, 1669, 1653, 1637, 1622, 1606, 1590, 1572, 1556, 1541, 1525, 1510, 1494, 1478, 1463, 1447, 1431, 1416, 1400, 1384, 1366, 1351, 1335, 1319, 1304, 1288, 1272, 1257, 1241, 1225, 1210, 1194, 1179, 1160, 1145, 1129, 1113, 1098, 1082, 1066, 1051, 1035, 1017, 1001, 986, 970, 954, 939, 923, 907, 892, 876, 861, 845, 829, 814, 798, 782, 767, 749, 0,
3959 		ACC_CURVE,CRV_PARKHOME  , 4705, 2913, 2253, 1894, 1662, 1498, 1374, 1276, 1196, 1129, 1073, 1024, 981, 944, 910, 880, 852, 827, 804, 783, 764, 746, 729, 713, 699, 685, 672, 659, 648, 637, 626, 616, 607, 598, 589, 581, 573, 565, 558, 551, 544, 538, 532, 526, 520, 514, 509, 503, 500, 0,
3960 		ACC_CURVE,CRV_SMEARING  , 200, 12, 14, 16, 0,
3961 		DEC_CURVE,CRV_NORMALSCAN, 749, 1166, 1583, 2000, 0,
3962 		DEC_CURVE,CRV_PARKHOME  , 500, 503, 509, 514, 520, 526, 532, 538, 544, 551, 558, 565, 573, 581, 589, 598, 607, 616, 626, 637, 648, 659, 672, 685, 699, 713, 729, 746, 764, 783, 804, 827, 852, 880, 910, 944, 981, 1024, 1073, 1129, 1196, 1276, 1374, 1498, 1662, 1894, 2253, 2913, 4705, 0,
3963 		DEC_CURVE,CRV_SMEARING  , 300, 234, 167, 100, 0,
3964 		DEC_CURVE,CRV_BUFFERFULL, 1100, 867, 633, 400, 0,
3965 		-2,
3966 
3967 		/* motorcurve 2   */
3968 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
3969 		ACC_CURVE,CRV_NORMALSCAN, 4705, 2664, 2061, 1732, 1521, 1370, 1257, 1167, 1094, 1033, 982, 937, 898, 864, 833, 805, 780, 757, 736, 717, 699, 683, 667, 653, 640, 627, 615, 604, 593, 583, 574, 564, 556, 547, 540, 532, 525, 518, 511, 505, 499, 493, 487, 481, 476, 471, 466, 461, 456, 452, 447, 443, 439, 435, 431, 427, 424, 420, 417, 413, 410, 407, 403, 400, 397, 394, 391, 389, 386, 383, 381, 378, 375, 373, 371, 368, 366, 364, 361, 359, 357, 355, 353, 351, 349, 347, 345, 343, 341, 339, 338, 336, 334, 332, 331, 329, 327, 326, 324, 323, 321, 320, 318, 317, 315, 314, 312, 311, 310, 308, 307, 306, 304, 303, 302, 301, 299, 298, 297, 296, 295, 293, 292, 291, 290, 289, 288, 287, 286, 285, 284, 283, 282, 281, 280, 279, 278, 277, 276, 275, 274, 273, 272, 271, 270, 270, 269, 268, 267, 266, 265, 264, 264, 263, 262, 261, 260, 260, 259, 258, 257, 257, 256, 255, 255, 254, 253, 252, 252, 251, 250, 250, 249, 248, 248, 247, 246, 246, 245, 244, 244, 243, 242, 242, 241, 241, 240, 239, 239, 238, 238, 237, 237, 236, 235, 235, 234, 234, 233, 233, 232, 232, 231, 231, 230, 230, 229, 229, 228, 227, 227, 227, 226, 226, 225, 225, 224, 224, 223, 223, 222, 222, 221, 221, 220, 220, 219, 219, 219, 218, 218, 217, 217, 216, 216, 216, 215, 215, 214, 214, 214, 213, 213, 212, 212, 212, 211, 211, 210, 210, 210, 209, 209, 208, 208, 208, 207, 207, 207, 206, 206, 206, 205, 205, 204, 204, 204, 203, 203, 203, 202, 202, 202, 201, 201, 201, 200, 200, 200, 199, 199, 199, 198, 198, 198, 197, 197, 197, 197, 196, 196, 196, 195, 195, 195, 194, 194, 194, 194, 193, 193, 193, 192, 192, 192, 192, 191, 191, 191, 190, 190, 190, 190, 189, 189, 189, 188, 188, 188, 188, 187, 187, 187, 187, 186, 186, 186, 186, 185, 185, 185, 185, 184, 184, 184, 184, 183, 183, 183, 183, 182, 182, 182, 182, 181, 181, 181, 181, 181, 180, 180, 180, 180, 179, 179, 179, 179, 178, 178, 178, 178, 178, 177, 177, 177, 177, 177, 176, 176, 176, 176, 175, 175, 175, 175, 175, 174, 174, 174, 174, 174, 173, 173, 173, 173, 173, 172, 172, 172, 172, 172, 171, 171, 171, 0,
3970 		ACC_CURVE,CRV_PARKHOME  , 4705, 2913, 2253, 1894, 1662, 1498, 1374, 1276, 1196, 1129, 1073, 1024, 981, 944, 910, 880, 852, 827, 804, 783, 764, 746, 729, 713, 699, 685, 672, 659, 648, 637, 626, 616, 607, 598, 589, 581, 573, 565, 558, 551, 544, 538, 532, 526, 520, 514, 509, 503, 500, 0,
3971 		ACC_CURVE,CRV_SMEARING  , 200, 12, 14, 16, 0,
3972 		DEC_CURVE,CRV_NORMALSCAN, 171, 172, 172, 173, 174, 174, 175, 176, 176, 177, 178, 178, 179, 180, 181, 181, 182, 183, 184, 184, 185, 186, 187, 188, 189, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 207, 208, 209, 210, 211, 213, 214, 215, 217, 218, 219, 221, 222, 224, 225, 227, 228, 230, 232, 233, 235, 237, 239, 241, 243, 245, 247, 249, 251, 253, 255, 258, 260, 262, 265, 268, 270, 273, 276, 279, 282, 285, 289, 292, 296, 299, 303, 307, 311, 316, 320, 325, 330, 335, 341, 347, 353, 359, 366, 373, 381, 390, 398, 408, 418, 429, 441, 455, 469, 485, 503, 523, 545, 571, 601, 636, 678, 730, 796, 883, 1005, 1195, 1544, 4705, 0,
3973 		DEC_CURVE,CRV_PARKHOME  , 500, 503, 509, 514, 520, 526, 532, 538, 544, 551, 558, 565, 573, 581, 589, 598, 607, 616, 626, 637, 648, 659, 672, 685, 699, 713, 729, 746, 764, 783, 804, 827, 852, 880, 910, 944, 981, 1024, 1073, 1129, 1196, 1276, 1374, 1498, 1662, 1894, 2253, 2913, 4705, 0,
3974 		DEC_CURVE,CRV_SMEARING  , 300, 234, 167, 100, 0,
3975 		DEC_CURVE,CRV_BUFFERFULL, 1100, 867, 633, 400, 0,
3976 		-2,
3977 
3978 		/* motorcurve 3   */
3979 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
3980 		ACC_CURVE,CRV_NORMALSCAN, 5360, 3655, 2855, 2422, 2142, 1944, 1795, 1678, 1582, 1503, 1434, 1374, 0,
3981 		ACC_CURVE,CRV_PARKHOME  , 5360, 3362, 2628, 2229, 1973, 1791, 1654, 1547, 1458, 1384, 1319, 1264, 1214, 1170, 1131, 1096, 1063, 1034, 1006, 981, 958, 937, 916, 897, 880, 863, 847, 832, 818, 805, 792, 780, 769, 758, 747, 737, 727, 718, 709, 700, 692, 684, 677, 669, 662, 655, 648, 642, 636, 629, 624, 618, 612, 607, 602, 596, 591, 587, 582, 577, 573, 568, 564, 560, 556, 552, 548, 544, 540, 537, 533, 530, 526, 523, 520, 516, 513, 510, 507, 504, 501, 498, 496, 493, 490, 488, 485, 482, 480, 477, 475, 472, 470, 468, 466, 463, 461, 459, 457, 455, 453, 450, 448, 446, 444, 443, 441, 439, 437, 435, 433, 431, 430, 428, 426, 425, 423, 421, 420, 418, 416, 415, 413, 412, 410, 409, 407, 406, 405, 403, 402, 400, 399, 398, 396, 395, 394, 392, 391, 390, 389, 387, 386, 385, 384, 382, 381, 380, 379, 378, 377, 376, 374, 373, 372, 371, 370, 369, 368, 367, 366, 365, 364, 363, 362, 361, 360, 359, 358, 357, 356, 355, 354, 353, 353, 352, 351, 350, 349, 348, 0,
3982 		ACC_CURVE,CRV_SMEARING  , 5360, 3362, 2628, 2229, 1973, 1791, 1654, 1547, 0,
3983 		DEC_CURVE,CRV_NORMALSCAN, 1374, 1434, 1503, 1582, 1678, 1795, 1944, 2142, 2422, 2855, 3655, 5360, 0,
3984 		DEC_CURVE,CRV_PARKHOME  , 348, 351, 353, 356, 359, 362, 365, 368, 371, 374, 378, 381, 385, 389, 392, 396, 400, 405, 409, 413, 418, 423, 428, 433, 439, 444, 450, 457, 463, 470, 477, 485, 493, 501, 510, 520, 530, 540, 552, 564, 577, 591, 607, 624, 642, 662, 684, 709, 737, 769, 805, 847, 897, 958, 1034, 1131, 1264, 1458, 1791, 2628, 5360, 0,
3985 		DEC_CURVE,CRV_SMEARING  , 1547, 1654, 1791, 1973, 2229, 2628, 3362, 5360, 0,
3986 		DEC_CURVE,CRV_BUFFERFULL, 1374, 1434, 1503, 1582, 1678, 1795, 1944, 2142, 2422, 2855, 3655, 5360, 0,
3987 		-2,
3988 
3989 		/* motorcurve 4   */
3990 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
3991 		ACC_CURVE,CRV_NORMALSCAN, 4705, 2664, 2061, 1732, 1521, 1370, 1257, 1167, 1094, 1033, 982, 937, 898, 864, 833, 805, 780, 757, 736, 717, 699, 683, 667, 653, 640, 627, 615, 604, 593, 583, 574, 564, 556, 547, 540, 532, 525, 518, 511, 505, 499, 493, 487, 481, 476, 471, 466, 461, 456, 452, 447, 443, 439, 435, 431, 427, 424, 420, 417, 413, 410, 407, 403, 400, 397, 394, 391, 389, 386, 383, 381, 378, 375, 373, 371, 368, 366, 364, 361, 359, 357, 355, 353, 351, 349, 347, 345, 343, 341, 339, 338, 336, 334, 332, 331, 329, 327, 326, 324, 323, 321, 320, 318, 317, 315, 314, 312, 311, 310, 308, 307, 306, 304, 303, 302, 301, 299, 298, 297, 296, 295, 293, 292, 291, 290, 289, 288, 287, 286, 285, 284, 283, 282, 281, 280, 279, 278, 277, 276, 275, 274, 273, 272, 271, 270, 270, 269, 268, 267, 266, 265, 264, 264, 263, 262, 261, 260, 260, 259, 258, 257, 257, 256, 255, 255, 254, 253, 252, 252, 251, 250, 250, 249, 248, 248, 247, 246, 246, 245, 244, 244, 243, 242, 242, 241, 241, 240, 239, 239, 238, 238, 237, 237, 236, 235, 235, 234, 234, 233, 233, 232, 232, 231, 231, 230, 230, 229, 229, 228, 227, 227, 227, 226, 226, 225, 225, 224, 224, 223, 223, 222, 222, 221, 221, 220, 220, 219, 219, 219, 218, 218, 217, 217, 216, 216, 216, 215, 215, 214, 214, 214, 213, 213, 212, 212, 212, 211, 211, 210, 210, 210, 209, 209, 208, 208, 208, 207, 207, 207, 206, 206, 206, 205, 205, 204, 204, 204, 203, 203, 203, 202, 202, 202, 201, 201, 201, 200, 200, 200, 199, 199, 199, 198, 198, 198, 197, 197, 197, 197, 196, 196, 196, 195, 195, 195, 194, 194, 194, 194, 193, 193, 193, 192, 192, 192, 192, 191, 191, 191, 190, 190, 190, 190, 189, 189, 189, 188, 188, 188, 188, 187, 187, 187, 187, 186, 186, 186, 186, 185, 185, 185, 185, 184, 184, 184, 184, 183, 183, 183, 183, 182, 182, 182, 182, 181, 181, 181, 181, 181, 180, 180, 180, 180, 179, 179, 179, 179, 178, 178, 178, 178, 178, 177, 177, 177, 177, 177, 176, 176, 176, 176, 175, 175, 175, 175, 175, 174, 174, 174, 174, 174, 173, 173, 173, 173, 173, 172, 172, 172, 172, 172, 171, 171, 171, 0,
3992 		ACC_CURVE,CRV_PARKHOME  , 4705, 2888, 2234, 1878, 1648, 1485, 1362, 1265, 1186, 1120, 1064, 1016, 973, 936, 903, 873, 845, 821, 798, 777, 758, 740, 723, 708, 693, 679, 666, 654, 643, 632, 621, 612, 602, 593, 585, 576, 569, 561, 554, 547, 540, 534, 528, 522, 516, 510, 505, 499, 494, 490, 485, 480, 476, 471, 467, 463, 459, 455, 451, 448, 444, 440, 437, 434, 430, 427, 424, 421, 418, 415, 412, 409, 407, 404, 401, 399, 396, 394, 391, 389, 387, 384, 382, 380, 378, 376, 374, 371, 369, 367, 366, 364, 362, 360, 358, 356, 354, 353, 351, 349, 348, 346, 344, 343, 341, 340, 338, 337, 335, 334, 332, 331, 329, 328, 327, 325, 324, 323, 321, 320, 319, 318, 316, 315, 314, 313, 312, 311, 309, 308, 307, 306, 305, 304, 303, 302, 301, 300, 299, 298, 297, 296, 295, 294, 293, 292, 291, 290, 289, 288, 287, 286, 285, 285, 284, 283, 282, 281, 280, 279, 279, 278, 277, 276, 275, 275, 274, 273, 272, 272, 271, 270, 269, 269, 268, 267, 267, 266, 265, 264, 264, 263, 262, 262, 261, 260, 260, 259, 259, 258, 257, 257, 256, 255, 255, 254, 254, 253, 252, 252, 251, 251, 250, 249, 249, 248, 248, 247, 247, 246, 246, 245, 245, 244, 243, 243, 242, 242, 241, 241, 240, 240, 239, 239, 238, 238, 237, 237, 237, 236, 236, 235, 235, 234, 234, 233, 233, 232, 232, 231, 231, 231, 230, 230, 229, 229, 228, 228, 228, 227, 227, 226, 226, 225, 225, 225, 224, 224, 223, 223, 223, 222, 222, 222, 221, 221, 220, 220, 220, 219, 219, 219, 218, 218, 217, 217, 217, 216, 216, 216, 215, 215, 215, 214, 214, 214, 213, 213, 213, 212, 212, 212, 211, 211, 211, 210, 210, 210, 209, 209, 209, 208, 208, 208, 207, 207, 207, 207, 206, 206, 206, 205, 205, 205, 204, 204, 204, 204, 203, 203, 203, 202, 202, 202, 202, 201, 201, 201, 200, 200, 200, 200, 199, 199, 199, 199, 198, 198, 198, 198, 197, 197, 197, 196, 196, 196, 196, 195, 195, 195, 195, 194, 194, 194, 194, 193, 193, 193, 193, 192, 192, 192, 192, 192, 191, 191, 191, 191, 190, 190, 190, 190, 189, 189, 189, 189, 189, 188, 188, 188, 188, 187, 187, 187, 187, 187, 186, 186, 186, 186, 186, 185, 185, 185, 185, 184, 184, 184, 184, 184, 183, 183, 183, 183, 183, 182, 182, 182, 182, 182, 181, 181, 181, 181, 181, 180, 180, 180, 180, 180, 180, 179, 179, 179, 179, 179, 178, 178, 178, 178, 178, 177, 177, 177, 177, 177, 177, 176, 176, 176, 176, 176, 176, 175, 175, 175, 175, 175, 174, 174, 174, 174, 174, 174, 173, 173, 173, 173, 173, 173, 172, 172, 172, 172, 172, 172, 171, 171, 171, 171, 0,
3993 		ACC_CURVE,CRV_SMEARING  , 4705, 3056, 2724, 2497, 1498, 1498, 1374, 1276, 1196, 1130, 1073, 1025, 982, 944, 911, 880, 853, 828, 805, 784, 764, 746, 730, 714, 699, 685, 675, 0,
3994 		DEC_CURVE,CRV_NORMALSCAN, 171, 172, 172, 173, 174, 174, 175, 176, 176, 177, 178, 178, 179, 180, 181, 181, 182, 183, 184, 184, 185, 186, 187, 188, 189, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 207, 208, 209, 210, 211, 213, 214, 215, 217, 218, 219, 221, 222, 224, 225, 227, 228, 230, 232, 233, 235, 237, 239, 241, 243, 245, 247, 249, 251, 253, 255, 258, 260, 262, 265, 268, 270, 273, 276, 279, 282, 285, 289, 292, 296, 299, 303, 307, 311, 316, 320, 325, 330, 335, 341, 347, 353, 359, 366, 373, 381, 390, 398, 408, 418, 429, 441, 455, 469, 485, 503, 523, 545, 571, 601, 636, 678, 730, 796, 883, 1005, 1195, 1544, 4705, 0,
3995 		DEC_CURVE,CRV_PARKHOME  , 171, 172, 172, 173, 173, 174, 174, 175, 175, 176, 176, 177, 177, 178, 179, 179, 180, 180, 181, 182, 182, 183, 183, 184, 185, 185, 186, 187, 187, 188, 189, 189, 190, 191, 192, 192, 193, 194, 195, 195, 196, 197, 198, 199, 199, 200, 201, 202, 203, 204, 205, 206, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 217, 218, 219, 220, 221, 222, 223, 225, 226, 227, 228, 230, 231, 232, 234, 235, 237, 238, 240, 241, 243, 244, 246, 247, 249, 251, 253, 254, 256, 258, 260, 262, 264, 266, 268, 271, 273, 275, 278, 280, 282, 285, 288, 290, 293, 296, 299, 302, 305, 309, 312, 316, 319, 323, 327, 331, 336, 340, 345, 350, 355, 360, 365, 371, 377, 384, 391, 398, 406, 414, 422, 432, 441, 452, 463, 476, 489, 504, 520, 538, 558, 580, 605, 633, 667, 706, 752, 810, 883, 979, 1116, 1326, 1714, 4705, 0,
3996 		DEC_CURVE,CRV_SMEARING  , 675, 685, 699, 714, 730, 746, 764, 784, 805, 828, 853, 880, 911, 944, 982, 1025, 1073, 1130, 1196, 1276, 1374, 1498, 1498, 2497, 2724, 3056, 4705, 0,
3997 		DEC_CURVE,CRV_BUFFERFULL, 171, 172, 172, 173, 174, 174, 175, 176, 176, 177, 178, 178, 179, 180, 181, 181, 182, 183, 184, 184, 185, 186, 187, 188, 189, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 207, 208, 209, 210, 211, 213, 214, 215, 217, 218, 219, 221, 222, 224, 225, 227, 228, 230, 232, 233, 235, 237, 239, 241, 243, 245, 247, 249, 251, 253, 255, 258, 260, 262, 265, 268, 270, 273, 276, 279, 282, 285, 289, 292, 296, 299, 303, 307, 311, 316, 320, 325, 330, 335, 341, 347, 353, 359, 366, 373, 381, 390, 398, 408, 418, 429, 441, 455, 469, 485, 503, 523, 545, 571, 601, 636, 678, 730, 796, 883, 1005, 1195, 1544, 4705, 0,
3998 		-2,
3999 
4000 		/* motorcurve 5   */
4001 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
4002 		ACC_CURVE,CRV_NORMALSCAN, 3763, 3763, 3763, 3763, 3763, 3763, 2444, 2178, 1997, 1198, 1198, 1098, 1020, 956, 903, 858, 819, 785, 754, 727, 703, 681, 662, 644, 626, 610, 596, 582, 571, 558, 547, 537, 527, 518, 509, 500, 492, 485, 478, 471, 464, 458, 452, 446, 440, 435, 430, 425, 420, 415, 410, 407, 402, 398, 394, 391, 386, 383, 380, 376, 373, 369, 366, 364, 360, 357, 355, 352, 349, 347, 344, 341, 338, 337, 334, 332, 329, 328, 325, 323, 321, 319, 317, 315, 313, 311, 310, 308, 306, 304, 302, 301, 299, 297, 295, 294, 293, 291, 290, 288, 286, 285, 284, 283, 281, 280, 278, 277, 275, 275, 274, 272, 271, 270, 268, 267, 266, 265, 264, 263, 262, 261, 259, 258, 257, 257, 256, 255, 254, 253, 251, 250, 249, 248, 248, 247, 246, 245, 244, 243, 243, 242, 241, 240, 239, 239, 238, 237, 236, 235, 235, 234, 233, 232, 231, 230, 230, 230, 229, 228, 228, 227, 226, 225, 225,224, 223, 222, 222, 221, 221, 221, 220, 219, 219, 218, 217, 217, 216, 215, 215, 214, 213, 213, 212, 212, 212, 211, 211, 210, 209, 209, 208, 208, 207, 207, 206, 206, 205, 204, 204, 203, 203, 203, 203, 202, 202, 201, 201, 200, 200, 199, 199, 198, 198, 197, 197, 196, 196, 195, 195, 194, 194, 194, 194, 194, 193, 193, 192, 192, 191, 191, 190, 190, 190, 189, 189, 188, 188, 188, 187, 187, 186, 186, 185, 185, 185, 185, 185, 185, 184, 184, 183, 183, 183, 182, 182, 182, 181, 181, 180, 180, 180, 179, 179, 179, 178, 178, 178, 177, 177, 177, 176, 176, 176, 176, 176, 176, 175, 175, 175, 174, 174, 174, 173, 173, 173, 172, 172, 172, 171, 171, 171, 171, 170, 170, 170, 169, 169, 169, 169, 168, 168, 168, 167, 167, 167, 167, 167, 167, 167, 166, 166, 166, 166, 165, 165, 165, 165, 164, 164, 164, 163, 163, 163, 163, 162, 162, 162, 162, 161, 161, 161, 161, 160, 160, 160, 160, 159, 159, 159, 159, 159, 158, 158, 158, 158, 158, 158, 158, 158, 157, 157, 157, 157, 157, 156, 156, 156, 156, 155, 155, 155, 155, 155, 154, 154, 154, 154, 154, 153, 153, 153, 153, 152, 152, 152, 152, 152, 151, 151, 151, 151, 151, 150, 150, 150, 150, 150, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 148, 148, 148, 148, 148, 147, 147, 147, 147, 147, 147, 146, 146, 146, 146, 146, 145, 145, 145, 145, 145, 145, 144, 144, 144, 144, 144, 144, 143, 143, 143, 143, 143, 143, 142, 142, 142, 142, 142, 142, 141, 141, 141, 141, 141, 141, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 139, 139, 139, 139, 139, 139, 139, 138, 138, 138, 138, 138, 138, 138, 137, 137, 137, 137, 137, 137, 137, 136, 136, 136, 136, 136, 136, 136, 135, 135, 135, 135, 135, 135, 135, 134, 134, 134, 134, 134, 134, 134, 134, 133, 133, 133, 133, 133, 133, 133, 133, 132, 132, 132, 132, 132, 132, 132, 132, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 130, 130, 130, 130, 130, 130, 130, 130, 129, 129, 129, 129, 129, 129, 129, 129, 129, 128, 128, 128, 128, 128, 128, 128, 128, 128, 127, 127, 127, 127, 127, 127, 127, 127, 127, 126, 126, 126, 126, 126, 126, 126, 126, 126, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 101, 101, 101, 101, 101, 101, 101, 101, 101,101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 0,
4003 		ACC_CURVE,CRV_PARKHOME  , 3763, 2330, 1803, 1515, 1330, 1198, 1099, 1021, 957, 904, 859, 819, 785, 755, 728, 704, 682, 662, 644, 626, 611, 597, 583, 571, 559, 548, 537, 527, 518, 509, 501, 493, 485, 478, 472, 464, 458, 453, 446, 441, 436, 430, 425, 420, 416, 411, 407, 402, 399, 394, 391, 387, 383, 380, 376, 374, 370, 366, 364, 361, 358, 355, 352, 349, 347, 344, 342, 339, 337, 335, 332, 330, 328, 326, 323, 321, 320, 318, 315, 313, 311, 310, 308, 306, 304, 302, 301, 300, 298, 296, 294, 293, 292, 290, 289, 287, 285, 284, 283, 282, 280, 279, 277, 276, 275, 274, 273, 271, 270, 269, 267, 266, 266, 265, 263, 262, 261, 260, 259, 258, 257, 256, 255, 254, 253, 252, 251, 250, 249, 248, 248, 247, 246, 245, 244, 243, 242, 241, 240, 239, 239, 239, 238, 237, 236, 235, 234, 233, 233, 232, 231, 230, 230, 230, 229, 228, 227, 227, 226, 225, 224, 224, 223, 222, 221, 221, 221, 220, 220, 219, 218, 218, 217, 216, 216, 215, 214, 214, 213, 213, 212, 212, 212, 211, 211, 210, 209, 209, 208, 208, 207, 207, 206, 205, 205, 204, 204, 203, 203, 203, 203, 202, 202, 201, 201, 200, 200, 199, 199, 198, 198, 197, 197, 196, 196, 195, 195, 194, 194, 194, 194, 194, 193, 193, 192, 192, 191, 191, 191, 190, 190, 189, 189, 188, 188, 188, 187, 187, 186, 186, 186, 185, 185, 185, 185, 185, 184, 184, 184, 183, 183, 182, 182, 182, 181, 181, 181, 180, 180, 180, 179, 179, 178, 178, 178, 177, 177, 177, 176, 176, 176, 176, 176, 176, 175, 175, 175, 174, 174, 174, 174, 173, 173, 173, 172, 172, 172, 171, 171, 171, 170, 170, 170, 170, 169, 169, 169, 168, 168, 168, 168, 167, 167, 167, 167, 167, 167, 167, 166, 166, 166, 166, 165, 165, 165, 165, 164, 164, 164, 163, 163, 163, 163, 162, 162, 162, 162, 161, 161, 161, 161, 160, 160, 160, 160, 160, 159, 159, 159, 159, 158, 158, 158, 158, 158, 158, 158, 158, 157, 157, 157, 157, 157, 156, 156, 156, 156, 155, 155, 155, 155, 155, 154, 154, 154, 154, 154, 153, 153, 153, 153, 153, 152, 152, 152, 152, 152, 151, 151, 151, 151, 151, 150, 150, 150, 150, 150, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 148, 148, 148, 148, 148, 148, 147, 147, 147, 147, 147, 147, 146, 146, 146, 146, 146, 145, 145, 145, 145, 145, 145, 144, 144, 144, 144, 144, 144, 143, 143, 143, 143, 143, 143, 142, 142, 142, 142, 142, 142, 141, 141, 141, 141, 141, 141, 141, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 139, 139, 139, 139, 139, 139, 139, 138, 0,
4004 		ACC_CURVE,CRV_SMEARING  , 3763, 2330, 1803, 1515, 1330, 1198, 1099, 1021, 957, 904, 859, 819, 785, 755, 728, 704, 682, 662, 644, 626, 611, 597, 583, 571, 559, 548, 537, 527, 518, 509, 501, 493, 485, 478, 472, 464, 458, 453, 446, 441, 436, 430, 425, 420, 416, 411, 407, 402, 399, 394, 391, 387, 383, 380, 376, 374, 370, 366, 364, 361, 358, 355, 352, 349, 347, 344, 342, 339, 337, 335, 332, 330, 328, 326, 323, 321, 320, 318, 315, 313, 311, 310, 308, 306, 304, 302, 301, 300, 298, 296, 294, 293, 292, 290, 289, 287, 285, 284, 283, 282, 280, 279, 277, 276, 275, 274, 273, 271, 270, 269, 267, 266, 266, 265, 263, 262, 261, 260, 259, 258, 257, 256, 255, 254, 253, 252, 251, 250, 249, 248, 248, 247, 246, 245, 244, 243, 242, 241, 240, 239, 239, 239, 238, 237, 236, 235, 234, 233, 233, 232, 231, 230, 230, 230, 229, 228, 227, 227, 226, 225, 224, 224, 223, 222, 221, 221, 221, 220, 220, 219, 218, 218, 217, 216, 216, 215, 214, 214, 213, 213, 212, 212, 212, 211, 211, 210, 209, 209, 208, 208, 207, 207, 206, 205, 205, 204, 204, 203, 203, 203, 203, 202, 202, 201, 201, 200, 200, 199, 199, 198, 198, 197, 197, 196, 196, 195, 195, 194, 194, 194, 194, 194, 193, 193, 192, 192, 191, 191, 191, 190, 190, 189, 189, 188, 188, 188, 187, 187, 186, 186, 186, 185, 185, 185, 185, 185, 184, 184, 184, 183, 183, 182, 182, 182, 181, 181, 181, 180, 180, 180, 179, 179, 178, 178, 178, 177, 177, 177, 176, 176, 176, 176, 176, 176, 175, 175, 175, 174, 174, 174, 174, 173, 173, 173, 172, 172, 172, 171, 171, 171, 170, 170, 170, 170, 169, 169, 169, 168, 168, 168, 168, 167, 167, 167, 167, 167, 167, 167, 166, 166, 166, 166, 165, 165, 165, 165, 164, 164, 164, 163, 163, 163, 163, 162, 162, 162, 162, 161, 161, 161, 161, 160, 160, 160, 160, 160, 159, 159, 159, 159, 158, 158, 158, 158, 158, 158, 158, 158, 157, 157, 157, 157, 157, 156, 156, 156, 156, 155, 155, 155, 155, 155, 154, 154, 154, 154, 154, 153, 153, 153, 153, 153, 152, 152, 152, 152, 152, 151, 151, 151, 151, 151, 150, 150, 150, 150, 150, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 148, 148, 148, 148, 148, 148, 147, 147, 147, 147, 147, 147, 146, 146, 146, 146, 146, 145, 145, 145, 145, 145, 145, 144, 144, 144, 144, 144, 144, 143, 143, 143, 143, 143, 143, 142, 142, 142, 142, 142, 142, 141, 141, 141, 141, 141, 141, 141, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 139, 139, 139, 139, 139, 139, 139, 138, 0,
4005 		DEC_CURVE,CRV_NORMALSCAN, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 87, 87, 87, 87, 87, 87, 87, 87, 88, 88, 88, 88, 88, 88, 88, 88, 89, 89, 89, 89, 89, 89, 89, 90, 90, 90, 90, 90, 90, 91, 91, 91, 91, 91, 92, 92, 92, 92, 93, 93, 93, 93, 94, 94, 94, 95, 95, 95, 95, 95, 96, 96, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 102, 102, 103, 104, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 113, 115, 117, 119, 121, 122, 124, 127, 130, 132, 135, 139, 142, 146, 149, 153, 158, 162, 167, 171, 176, 180, 186, 193, 202, 209, 216, 223, 232, 243, 254, 266, 279, 292, 306, 320, 335, 337, 351, 367, 380, 396, 414, 437, 464, 493, 520, 549, 583, 611, 644, 675, 711, 755, 785, 819, 859, 904, 957, 1021, 1099, 1198, 1330, 1515, 1803, 2330, 3763, 0,
4006 		DEC_CURVE,CRV_PARKHOME  , 138, 142, 146, 149, 153, 158, 162, 167, 171, 176, 180, 186, 193, 202, 209, 216, 223, 232, 243, 254, 266, 279, 292, 306, 320, 335, 337, 351, 367, 380, 396, 414, 437, 464, 493, 520, 549, 583, 611, 644, 675, 711, 755, 785, 819, 859, 904, 957, 1021, 1099, 1198, 1330, 1515, 1803, 2330, 3763, 0,
4007 		DEC_CURVE,CRV_SMEARING  , 138, 139, 139, 139, 139, 139, 139, 139, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 141, 141, 141, 141, 141, 141, 141, 142, 142, 142, 142, 142, 142, 143, 143, 143, 143, 143, 143, 144, 144, 144, 144, 144, 144, 145, 145, 145, 145, 145, 145, 146, 146, 146, 146, 146, 147, 147, 147, 147, 147, 147, 148, 148, 148, 148, 148, 148, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 150, 150, 150, 150, 150, 151, 151, 151, 151, 151, 152, 152, 152, 152, 152, 153, 153, 153, 153, 153, 154, 154, 154, 154, 154, 155, 155, 155, 155, 155, 156, 156, 156, 156, 157, 157, 157, 157, 157, 158, 158, 158, 158, 158, 158, 158, 158, 159, 159, 159, 159, 160, 160, 160, 160, 160, 161, 161, 161, 161, 162, 162, 162, 162, 163, 163, 163, 163, 164, 164, 164, 165, 165, 165, 165, 166, 166, 166, 166, 167, 167, 167, 167, 167, 167, 167, 168, 168, 168, 168, 169, 169, 169, 170, 170, 170, 170, 171, 171, 171, 172, 172, 172, 173, 173, 173, 174, 174, 174, 174, 175, 175, 175, 176, 176, 176, 176, 176, 176, 177, 177, 177, 178, 178, 178, 179, 179, 180, 180, 180, 181, 181, 181, 182, 182, 182, 183, 183, 184, 184, 184, 185, 185, 185, 185, 185, 186, 186, 186, 187, 187, 188, 188, 188, 189, 189, 190, 190, 191, 191, 191, 192, 192, 193, 193, 194, 194, 194, 194, 194, 195, 195, 196, 196, 197, 197, 198, 198, 199, 199, 200, 200, 201, 201, 202, 202, 203, 203, 203, 203, 204, 204, 205, 205, 206, 207, 207, 208, 208, 209, 209, 210, 211, 211, 212, 212, 212, 213, 213, 214, 214, 215, 216, 216, 217, 218, 218, 219, 220, 220, 221, 221, 221, 222, 223, 224, 224, 225, 226, 227, 227, 228, 229, 230, 230, 230, 231, 232, 233, 233, 234, 235, 236, 237, 238, 239, 239, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 265, 266, 266, 267, 269, 270, 271, 273, 274, 275, 276, 277, 279, 280, 282, 283, 284, 285, 287, 289, 290, 292, 293, 294, 296, 298, 300, 301, 302, 304, 306, 308, 310, 311, 313, 315, 318, 320, 321, 323, 326, 328, 330, 332, 335, 337, 339, 342, 344, 347, 349, 352, 355, 358, 361, 364, 366, 370, 374, 376, 380, 383, 387, 391, 394, 399, 402, 407, 411, 416, 420, 425, 430, 436, 441, 446, 453, 458, 464, 472, 478, 485, 493, 501, 509, 518, 527, 537, 548, 559, 571, 583, 597, 611, 626, 644, 662, 682, 704, 728, 755, 785, 819, 859, 904, 957, 1021, 1099, 1198, 1330, 1515, 1803, 2330, 3763, 0,
4008 		DEC_CURVE,CRV_BUFFERFULL, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 94, 94, 94, 95, 95, 95, 95, 95, 96, 96, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 102, 102, 103, 104, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 113, 115, 117, 119, 121, 122, 124, 127, 130, 132, 135, 139, 142, 146, 149, 153, 158, 162, 167, 171, 176, 180, 186, 193, 202, 209, 216, 223, 232, 243, 254, 266, 279, 292, 306, 320, 335, 337, 351, 367, 380, 396, 414, 437, 464, 493, 520, 549, 583, 611, 644, 675, 711, 755, 785, 819, 859, 904, 957, 1021, 1099, 1198, 1330, 1515, 1803, 2330, 3763, 0,
4009 		-2,
4010 
4011 		/* motorcurve 6   */
4012 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
4013 		ACC_CURVE,CRV_NORMALSCAN, 23999, 0,
4014 		ACC_CURVE,CRV_PARKHOME  , 5360, 3362, 2628, 2229, 1973, 1791, 1654, 1547, 1458, 1384, 1319, 1264, 1214, 1170, 1131, 1096, 1063, 1034, 1006, 981, 958, 937, 916, 897, 880, 863, 847, 832, 818, 805, 792, 780, 769, 758, 747, 737, 727, 718, 709, 700, 692, 0,
4015 		ACC_CURVE,CRV_SMEARING  , 23999, 0,
4016 		DEC_CURVE,CRV_NORMALSCAN, 23999, 0,
4017 		DEC_CURVE,CRV_PARKHOME  , 692, 700, 709, 718, 727, 737, 747, 758, 769, 780, 792, 805, 818, 832, 847, 863, 880, 897, 916, 937, 958, 981, 1006, 1034, 1063, 1096, 1131, 1170, 1214, 1264, 1319, 1384, 1458, 1547, 1654, 1791, 1973, 2229, 2628, 3362, 5360, 0,
4018 		DEC_CURVE,CRV_SMEARING  , 23999, 0,
4019 		DEC_CURVE,CRV_BUFFERFULL, 23999, 0,
4020 		-2,
4021 
4022 		/* motorcurve 7   */
4023 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
4024 		ACC_CURVE,CRV_NORMALSCAN, 6667, 0,
4025 		ACC_CURVE,CRV_PARKHOME  , 5360, 3362, 2628, 2229, 1973, 1791, 1654, 1547, 1458, 1384, 1319, 1264, 1214, 1170, 1131, 1096, 1063, 1034, 1006, 981, 958, 937, 916, 897, 880, 863, 847, 832, 818, 805, 792, 780, 769, 758, 747, 737, 727, 718, 709, 700, 692, 0,
4026 		ACC_CURVE,CRV_SMEARING  , 6667, 0,
4027 		DEC_CURVE,CRV_NORMALSCAN, 6667, 0,
4028 		DEC_CURVE,CRV_PARKHOME  , 692, 700, 709, 718, 727, 737, 747, 758, 769, 780, 792, 805, 818, 832, 847, 863, 880, 897, 916, 937, 958, 981, 1006, 1034, 1063, 1096, 1131, 1170, 1214, 1264, 1319, 1384, 1458, 1547, 1654, 1791, 1973, 2229, 2628, 3362, 5360, 0,
4029 		DEC_CURVE,CRV_SMEARING  , 6667, 0,
4030 		DEC_CURVE,CRV_BUFFERFULL, 6667, 0,
4031 		-2,
4032 
4033 		/* motorcurve 8   */
4034 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
4035 		ACC_CURVE,CRV_NORMALSCAN, 1046, 1046, 1046, 1046, 1046, 1046, 647, 501, 421, 370, 333, 305, 284, 266, 251, 239, 228, 218, 210, 202, 196, 190, 184, 179, 174, 170, 166, 162, 159, 155, 152, 149, 147, 144, 142, 139, 137, 135, 133, 131, 129, 127, 126, 124, 123, 121, 120, 118, 117, 116, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 100, 99, 98, 97, 96, 96, 95, 94, 94, 93, 92, 92, 91, 91, 90, 89, 89, 88, 88, 87, 87, 86, 86, 85, 85, 84, 84, 83, 83, 82, 82, 82, 81, 81, 80, 80, 79, 79, 79, 78, 78, 78, 77, 77, 76, 76, 76, 75, 75, 75, 74, 74, 74, 74, 73, 73, 73, 72, 72, 72, 71, 71, 71, 71, 70, 70, 70, 70, 69, 69, 69, 69, 68, 68, 68, 68, 67, 67, 67, 67, 66, 66, 66, 66, 65, 65, 65, 65, 64, 64, 64, 64, 63, 63, 63, 63, 62, 62, 62, 62, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 59, 58, 58, 58, 58, 58, 58, 57, 57, 57, 57, 57, 57, 57, 56, 56, 56, 56, 56, 56, 56, 56, 55, 55, 55, 55, 55, 55, 55, 55, 54, 54, 54, 54, 54, 54, 54, 54, 53, 53, 53, 53, 53, 53, 53, 53, 52, 52, 52, 52, 52, 52, 52, 52, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 23, 23, 0,
4036 		ACC_CURVE,CRV_PARKHOME  , 1045, 678, 604, 554, 332, 332, 304, 283, 265, 250, 238, 227, 217, 209, 201, 195, 189, 183, 178,173, 169, 165, 161, 158, 154, 151, 148, 146, 143, 141, 138, 136, 134, 132, 130, 128, 126, 125, 123, 122, 120, 119, 117, 116, 115, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103,102, 101, 100, 99, 99, 98, 97, 96, 95, 95, 94, 93, 93, 92, 91, 91, 90, 90, 89, 88, 88, 87, 87, 86, 86, 85, 85, 84, 84, 83, 83, 82, 82, 81, 81, 81, 80, 80, 79, 79, 78, 78, 78, 77, 77, 77, 76, 76, 75, 75, 75, 74, 74, 74, 73, 73, 73, 73, 72, 72, 72, 71, 71, 71, 70, 70, 70, 70, 69, 69, 69, 69, 68, 68, 68, 68, 67, 67, 67, 67, 66, 66, 66, 66, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 61, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 58, 58, 58, 58, 58, 58, 58, 57, 57, 57, 57, 57, 57, 57, 56, 56, 56, 56, 56, 56, 56, 55, 55, 55, 55, 55, 55, 55, 55, 54, 54, 54, 54, 54, 54, 54, 54, 53, 53, 53, 53, 53, 53, 53, 53, 53, 52, 52, 52, 52, 52, 52, 52, 52, 52, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 39, 0,
4037 		ACC_CURVE,CRV_SMEARING  , 1045, 678, 604, 554, 332, 332, 304, 283, 265, 250, 238, 227, 217, 209, 201, 195, 189, 183, 178,173, 169, 165, 161, 158, 154, 151, 148, 146, 143, 141, 138, 136, 134, 132, 130, 128, 126, 125, 123, 122, 120, 119, 117, 116, 115, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103,102, 101, 100, 99, 99, 98, 97, 96, 95, 95, 94, 93, 93, 92, 91, 91, 90, 90, 89, 88, 88, 87, 87, 86, 86, 85, 85, 84, 84, 83, 83, 82, 82, 81, 81, 81, 80, 80, 79, 79, 78, 78, 78, 77, 77, 77, 76, 76, 75, 75, 75, 74, 74, 74, 73, 73, 73, 73, 72, 72, 72, 71, 71, 71, 70, 70, 70, 70, 69, 69, 69, 69, 68, 68, 68, 68, 67, 67, 67, 67, 66, 66, 66, 66, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 61, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 58, 58, 58, 58, 58, 58, 58, 57, 57, 57, 57, 57, 57, 57, 56, 56, 56, 56, 56, 56, 56, 55, 55, 55, 55, 55, 55, 55, 55, 54, 54, 54, 54, 54, 54, 54, 54, 53, 53, 53, 53, 53, 53, 53, 53, 53, 52, 52, 52, 52, 52, 52, 52, 52, 52, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 39, 0,
4038 		DEC_CURVE,CRV_NORMALSCAN, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 32, 33, 33, 34, 34, 35, 35, 36, 37, 38, 38, 39, 40, 41, 42, 43, 45, 46, 47, 48, 50, 51, 53, 54, 57, 59, 61, 63, 65, 68, 71, 75, 78, 82, 86, 90, 94, 94, 98, 103, 106, 111, 116, 122, 130, 138, 145, 153, 163, 171, 180, 188, 198, 211, 219, 228, 239, 252, 267, 284, 306, 334, 370, 422, 502, 648, 1045, 0,
4039 		DEC_CURVE,CRV_PARKHOME  , 39, 40, 41, 42, 43, 45, 46, 47, 48, 50, 51, 53, 54, 57, 59, 61, 63, 65, 68, 71, 75, 78, 82, 86, 90, 94, 94, 98, 103, 106, 111, 116, 122, 130, 138, 145, 153, 163, 171, 180, 188, 198, 211, 219, 228, 239, 252, 267, 284, 306, 334, 370, 422, 502, 648, 1045, 0,
4040 		DEC_CURVE,CRV_SMEARING  , 39, 39, 39, 39, 39, 39, 39, 39, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 54, 54, 54, 54, 54, 54, 54, 54, 54, 55, 55, 55, 55, 55, 55, 55, 55, 55, 56, 56, 56, 56, 56, 56, 56, 56, 57, 57, 57, 57, 57, 57, 57, 57, 58, 58, 58, 58, 58, 58, 58, 59, 59, 59, 59, 59, 59, 59, 60, 60, 60, 60, 60, 60, 60, 61, 61, 61, 61, 61, 61, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 67, 67, 67, 67, 67, 68, 68, 68, 68, 69, 69, 69, 69, 70, 70, 70, 70, 71, 71, 71, 71, 72, 72, 72, 73, 73, 73, 73, 74, 74, 74, 75, 75, 75, 76, 76, 76, 77, 77, 77, 78, 78, 78, 79, 79, 79, 80, 80, 81, 81, 81, 82, 82, 83, 83, 84, 84, 84, 85, 85, 86, 86, 87, 87, 88, 88, 89, 90, 90, 91, 91, 92, 93, 93, 94, 94, 95, 96, 96, 97, 98, 99, 99, 100, 101, 102, 103, 104, 105, 105, 106, 107, 108, 109, 110, 112, 113, 114, 115, 116, 118, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 136, 138, 140, 142, 145, 147, 150, 153, 156, 159, 163, 167, 171, 175, 180, 185, 190, 196, 203, 211, 219, 228, 239, 252, 267, 284, 306, 334, 370, 422, 502, 648, 1045, 0,
4041 		DEC_CURVE,CRV_BUFFERFULL, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 32, 33, 33, 34, 34, 35, 35, 36, 37, 38, 38, 39, 40, 41, 42, 43, 45, 46, 47, 48, 50, 51, 53, 54, 57, 59, 61, 63, 65, 68, 71, 75, 78, 82, 86, 90, 94, 94, 98, 103, 106, 111, 116, 122, 130, 138, 145, 153, 163, 171, 180, 188, 198, 211, 219, 228, 239, 252, 267, 284, 306, 334, 370, 422, 502, 648, 1045, 0,
4042 		-1
4043 	};
4044 
4045 	rst = (SANE_Int *)malloc(sizeof(steps));
4046 	if (rst != NULL)
4047 		memcpy(rst, &steps, sizeof(steps));
4048 
4049 	return rst;
4050 }
4051 
hp3800_motor()4052 static SANE_Int *hp3800_motor()
4053 {
4054 	SANE_Int *rst = NULL;
4055 	SANE_Int steps[]  =
4056 	{
4057 		/* motorcurve 1   */
4058 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
4059 		ACC_CURVE,CRV_NORMALSCAN,2000,1984,1968,1953,1937,1921,1906,1890,1874,1859,1843,1827,1812,1796,1781,1765,1749,1734,1715,1700,1684,1669,1653,1637,1622,1606,1590,1572,1556,1541,1525,1510,1494,1478,1463,1447,1431,1416,1400,1384,1366,1351,1335,1319,1304,1288,1272,1257,1241,1225,1210,1194,1179,1160,1145,1129,1113,1098,1082,1066,1051,1035,1017,1001,986,970,954,939,923,907,892,876,861,845,829,814,798,782,767,749, 0,
4060 		ACC_CURVE,CRV_PARKHOME  ,4705,2913,2253,1894,1662,1498,1374,1276,1196,1129,1073,1024,981,944,910,880,852,827,804,783,764,746,729,713,699,685,672,659,648,637,626,616,607,598,589,581,573,565,558,551,544,538,532,526,520,514,509,503,500, 0,
4061 		ACC_CURVE,CRV_SMEARING  ,200,12,14,16, 0,
4062 		DEC_CURVE,CRV_NORMALSCAN,749,1166,1583,2000, 0,
4063 		DEC_CURVE,CRV_PARKHOME  ,500,503,509,514,520,526,532,538,544,551,558,565,573,581,589,598,607,616,626,637,648,659,672,685,699,713,729,746,764,783,804,827,852,880,910,944,981,1024,1073,1129,1196,1276,1374,1498,1662,1894,2253,2913,4705, 0,
4064 		DEC_CURVE,CRV_SMEARING  ,300,234,167,100, 0,
4065 		DEC_CURVE,CRV_BUFFERFULL,1100,867,633,400, 0,
4066 		-2,
4067 
4068 		/* motorcurve 2   */
4069 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
4070 		ACC_CURVE,CRV_NORMALSCAN,4705,2664,2061,1732,1521,1370,1257,1167,1094,1033,982,937,898,864,833,805,780,757,736,717,699,683,667,653,640,627,615,604,593,583,574,564,556,547,540,532,525,518,511,505,499,493,487,481,476,471,466,461,456,452,447,443,439,435,431,427,424,420,417,413,410,407,403,400,397,394,391,389,386,383,381,378,375,373,371,368,366,364,361,359,357,355,353,351,349,347,345,343,341,339,338,336,334,332,331,329,327,326,324,323,321,320,318,317,315,314,312,311,310,308,307,306,304,303,302,301,299,298,297,296,295,293,292,291,290,289,288,287,286,285,284,283,282,281,280,279,278,277,276,275,274,273,272,271,270,270,269,268,267,266,265,264,264,263,262,261,260,260,259,258,257,257,256,255,255,254,253,252,252,251,250,250,249,248,248,247,246,246,245,244,244,243,242,242,241,241,240,239,239,238,238,237,237,236,235,235,234,234,233,233,232,232,231,231,230,230,229,229,228,227,227,227,226,226,225,225,224,224,223,223,222,222,221,221,220,220,219,219,219,218,218,217,217,216,216,216,215,215,214,214,214,213,213,212,212,212,211,211,210,210,210,209,209,208,208,208,207,207,207,206,206,206,205,205,204,204,204,203,203,203,202,202,202,201,201,201,200,200,200,199,199,199,198,198,198,197,197,197,197,196,196,196,195,195,195,194,194,194,194,193,193,193,192,192,192,192,191,191,191,190,190,190,190,189,189,189,188,188,188,188,187,187,187,187,186,186,186,186,185,185,185,185,184,184,184,184,183,183,183,183,182,182,182,182,181,181,181,181,181,180,180,180,180,179,179,179,179,178,178,178,178,178,177,177,177,177,177,176,176,176,176,175,175,175,175,175,174,174,174,174,174,173,173,173,173,173,172,172,172,172,172,171,171,171, 0,
4071 		ACC_CURVE,CRV_PARKHOME  ,4705,2913,2253,1894,1662,1498,1374,1276,1196,1129,1073,1024,981,944,910,880,852,827,804,783,764,746,729,713,699,685,672,659,648,637,626,616,607,598,589,581,573,565,558,551,544,538,532,526,520,514,509,503,500, 0,
4072 		ACC_CURVE,CRV_SMEARING  ,200,12,14,16, 0,
4073 		DEC_CURVE,CRV_NORMALSCAN,171,172,172,173,174,174,175,176,176,177,178,178,179,180,181,181,182,183,184,184,185,186,187,188,189,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,207,208,209,210,211,213,214,215,217,218,219,221,222,224,225,227,228,230,232,233,235,237,239,241,243,245,247,249,251,253,255,258,260,262,265,268,270,273,276,279,282,285,289,292,296,299,303,307,311,316,320,325,330,335,341,347,353,359,366,373,381,390,398,408,418,429,441,455,469,485,503,523,545,571,601,636,678,730,796,883,1005,1195,1544,4705, 0,
4074 		DEC_CURVE,CRV_PARKHOME  ,500,503,509,514,520,526,532,538,544,551,558,565,573,581,589,598,607,616,626,637,648,659,672,685,699,713,729,746,764,783,804,827,852,880,910,944,981,1024,1073,1129,1196,1276,1374,1498,1662,1894,2253,2913,4705, 0,
4075 		DEC_CURVE,CRV_SMEARING  ,300,234,167,100, 0,
4076 		DEC_CURVE,CRV_BUFFERFULL,1100,867,633,400, 0,
4077 		-2,
4078 
4079 		/* motorcurve 3   */
4080 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
4081 		ACC_CURVE,CRV_NORMALSCAN,5360,3655,2855,2422,2142,1944,1795,1678,1582,1503,1434,1374, 0,
4082 		ACC_CURVE,CRV_PARKHOME  ,5360,3362,2628,2229,1973,1791,1654,1547,1458,1384,1319,1264,1214,1170,1131,1096,1063,1034,1006,981,958,937,916,897,880,863,847,832,818,805,792,780,769,758,747,737,727,718,709,700,692,684,677,669,662,655,648,642,636,629,624,618,612,607,602,596,591,587,582,577,573,568,564,560,556,552,548,544,540,537,533,530,526,523,520,516,513,510,507,504,501,498,496,493,490,488,485,482,480,477,475,472,470,468,466,463,461,459,457,455,453,450,448,446,444,443,441,439,437,435,433,431,430,428,426,425,423,421,420,418,416,415,413,412,410,409,407,406,405,403,402,400,399,398,396,395,394,392,391,390,389,387,386,385,384,382,381,380,379,378,377,376,374,373,372,371,370,369,368,367,366,365,364,363,362,361,360,359,358,357,356,355,354,353,353,352,351,350,349,348, 0,
4083 		ACC_CURVE,CRV_SMEARING  ,5360,3362,2628,2229,1973,1791,1654,1547, 0,
4084 		DEC_CURVE,CRV_NORMALSCAN,1374,1434,1503,1582,1678,1795,1944,2142,2422,2855,3655,5360, 0,
4085 		DEC_CURVE,CRV_PARKHOME  ,348,351,353,356,359,362,365,368,371,374,378,381,385,389,392,396,400,405,409,413,418,423,428,433,439,444,450,457,463,470,477,485,493,501,510,520,530,540,552,564,577,591,607,624,642,662,684,709,737,769,805,847,897,958,1034,1131,1264,1458,1791,2628,5360, 0,
4086 		DEC_CURVE,CRV_SMEARING  ,1547,1654,1791,1973,2229,2628,3362,5360, 0,
4087 		DEC_CURVE,CRV_BUFFERFULL,1374,1434,1503,1582,1678,1795,1944,2142,2422,2855,3655,5360, 0,
4088 		-2,
4089 
4090 		/* motorcurve 4   */
4091 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
4092 		ACC_CURVE,CRV_NORMALSCAN,4705,2664,2061,1732,1521,1370,1257,1167,1094,1033,982,937,898,864,833,805,780,757,736,717,699,683,667,653,640,627,615,604,593,583,574,564,556,547,540,532,525,518,511,505,499,493,487,481,476,471,466,461,456,452,447,443,439,435,431,427,424,420,417,413,410,407,403,400,397,394,391,389,386,383,381,378,375,373,371,368,366,364,361,359,357,355,353,351,349,347,345,343,341,339,338,336,334,332,331,329,327,326,324,323,321,320,318,317,315,314,312,311,310,308,307,306,304,303,302,301,299,298,297,296,295,293,292,291,290,289,288,287,286,285,284,283,282,281,280,279,278,277,276,275,274,273,272,271,270,270,269,268,267,266,265,264,264,263,262,261,260,260,259,258,257,257,256,255,255,254,253,252,252,251,250,250,249,248,248,247,246,246,245,244,244,243,242,242,241,241,240,239,239,238,238,237,237,236,235,235,234,234,233,233,232,232,231,231,230,230,229,229,228,227,227,227,226,226,225,225,224,224,223,223,222,222,221,221,220,220,219,219,219,218,218,217,217,216,216,216,215,215,214,214,214,213,213,212,212,212,211,211,210,210,210,209,209,208,208,208,207,207,207,206,206,206,205,205,204,204,204,203,203,203,202,202,202,201,201,201,200,200,200,199,199,199,198,198,198,197,197,197,197,196,196,196,195,195,195,194,194,194,194,193,193,193,192,192,192,192,191,191,191,190,190,190,190,189,189,189,188,188,188,188,187,187,187,187,186,186,186,186,185,185,185,185,184,184,184,184,183,183,183,183,182,182,182,182,181,181,181,181,181,180,180,180,180,179,179,179,179,178,178,178,178,178,177,177,177,177,177,176,176,176,176,175,175,175,175,175,174,174,174,174,174,173,173,173,173,173,172,172,172,172,172,171,171,171, 0,
4093 		ACC_CURVE,CRV_PARKHOME  ,4705,2888,2234,1878,1648,1485,1362,1265,1186,1120,1064,1016,973,936,903,873,845,821,798,777,758,740,723,708,693,679,666,654,643,632,621,612,602,593,585,576,569,561,554,547,540,534,528,522,516,510,505,499,494,490,485,480,476,471,467,463,459,455,451,448,444,440,437,434,430,427,424,421,418,415,412,409,407,404,401,399,396,394,391,389,387,384,382,380,378,376,374,371,369,367,366,364,362,360,358,356,354,353,351,349,348,346,344,343,341,340,338,337,335,334,332,331,329,328,327,325,324,323,321,320,319,318,316,315,314,313,312,311,309,308,307,306,305,304,303,302,301,300,299,298,297,296,295,294,293,292,291,290,289,288,287,286,285,285,284,283,282,281,280,279,279,278,277,276,275,275,274,273,272,272,271,270,269,269,268,267,267,266,265,264,264,263,262,262,261,260,260,259,259,258,257,257,256,255,255,254,254,253,252,252,251,251,250,249,249,248,248,247,247,246,246,245,245,244,243,243,242,242,241,241,240,240,239,239,238,238,237,237,237,236,236,235,235,234,234,233,233,232,232,231,231,231,230,230,229,229,228,228,228,227,227,226,226,225,225,225,224,224,223,223,223,222,222,222,221,221,220,220,220,219,219,219,218,218,217,217,217,216,216,216,215,215,215,214,214,214,213,213,213,212,212,212,211,211,211,210,210,210,209,209,209,208,208,208,207,207,207,207,206,206,206,205,205,205,204,204,204,204,203,203,203,202,202,202,202,201,201,201,200,200,200,200,199,199,199,199,198,198,198,198,197,197,197,196,196,196,196,195,195,195,195,194,194,194,194,193,193,193,193,192,192,192,192,192,191,191,191,191,190,190,190,190,189,189,189,189,189,188,188,188,188,187,187,187,187,187,186,186,186,186,186,185,185,185,185,184,184,184,184,184,183,183,183,183,183,182,182,182,182,182,181,181,181,181,181,180,180,180,180,180,180,179,179,179,179,179,178,178,178,178,178,177,177,177,177,177,177,176,176,176,176,176,176,175,175,175,175,175,174,174,174,174,174,174,173,173,173,173,173,173,172,172,172,172,172,172,171,171,171,171, 0,
4094 		ACC_CURVE,CRV_SMEARING  ,4705,3056,2724,2497,1498,1498,1374,1276,1196,1130,1073,1025,982,944,911,880,853,828,805,784,764,746,730,714,699,685,675, 0,
4095 		DEC_CURVE,CRV_NORMALSCAN,171,172,172,173,174,174,175,176,176,177,178,178,179,180,181,181,182,183,184,184,185,186,187,188,189,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,207,208,209,210,211,213,214,215,217,218,219,221,222,224,225,227,228,230,232,233,235,237,239,241,243,245,247,249,251,253,255,258,260,262,265,268,270,273,276,279,282,285,289,292,296,299,303,307,311,316,320,325,330,335,341,347,353,359,366,373,381,390,398,408,418,429,441,455,469,485,503,523,545,571,601,636,678,730,796,883,1005,1195,1544,4705, 0,
4096 		DEC_CURVE,CRV_PARKHOME  ,171,172,172,173,173,174,174,175,175,176,176,177,177,178,179,179,180,180,181,182,182,183,183,184,185,185,186,187,187,188,189,189,190,191,192,192,193,194,195,195,196,197,198,199,199,200,201,202,203,204,205,206,206,207,208,209,210,211,212,213,214,215,217,218,219,220,221,222,223,225,226,227,228,230,231,232,234,235,237,238,240,241,243,244,246,247,249,251,253,254,256,258,260,262,264,266,268,271,273,275,278,280,282,285,288,290,293,296,299,302,305,309,312,316,319,323,327,331,336,340,345,350,355,360,365,371,377,384,391,398,406,414,422,432,441,452,463,476,489,504,520,538,558,580,605,633,667,706,752,810,883,979,1116,1326,1714,4705, 0,
4097 		DEC_CURVE,CRV_SMEARING  ,675,685,699,714,730,746,764,784,805,828,853,880,911,944,982,1025,1073,1130,1196,1276,1374,1498,1498,2497,2724,3056,4705, 0,
4098 		DEC_CURVE,CRV_BUFFERFULL,171,172,172,173,174,174,175,176,176,177,178,178,179,180,181,181,182,183,184,184,185,186,187,188,189,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,207,208,209,210,211,213,214,215,217,218,219,221,222,224,225,227,228,230,232,233,235,237,239,241,243,245,247,249,251,253,255,258,260,262,265,268,270,273,276,279,282,285,289,292,296,299,303,307,311,316,320,325,330,335,341,347,353,359,366,373,381,390,398,408,418,429,441,455,469,485,503,523,545,571,601,636,678,730,796,883,1005,1195,1544,4705, 0,
4099 		-2,
4100 
4101 		/* motorcurve 5   */
4102 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
4103 		ACC_CURVE,CRV_NORMALSCAN,3763,3763,3763,3763,3763,3763,2444,2178,1997,1198,1198,1098,1020,956,903,858,819,785,754,727,703,681,662,644,626,610,596,582,571,558,547,537,527,518,509,500,492,485,478,471,464,458,452,446,440,435,430,425,420,415,410,407,402,398,394,391,386,383,380,376,373,369,366,364,360,357,355,352,349,347,344,341,338,337,334,332,329,328,325,323,321,319,317,315,313,311,310,308,306,304,302,301,299,297,295,294,293,291,290,288,286,285,284,283,281,280,278,277,275,275,274,272,271,270,268,267,266,265,264,263,262,261,259,258,257,257,256,255,254,253,251,250,249,248,248,247,246,245,244,243,243,242,241,240,239,239,238,237,236,235,235,234,233,232,231,230,230,230,229,228,228,227,226,225,225,224,223,222,222,221,221,221,220,219,219,218,217,217,216,215,215,214,213,213,212,212,212,211,211,210,209,209,208,208,207,207,206,206,205,204,204,203,203,203,203,202,202,201,201,200,200,199,199,198,198,197,197,196,196,195,195,194,194,194,194,194,193,193,192,192,191,191,190,190,190,189,189,188,188,188,187,187,186,186,185,185,185,185,185,185,184,184,183,183,183,182,182,182,181,181,180,180,180,179,179,179,178,178,178,177,177,177,176,176,176,176,176,176,175,175,175,174,174,174,173,173,173,172,172,172,171,171,171,171,170,170,170,169,169,169,169,168,168,168,167,167,167,167,167,167,167,166,166,166,166,165,165,165,165,164,164,164,163,163,163,163,162,162,162,162,161,161,161,161,160,160,160,160,159,159,159,159,159,158,158,158,158,158,158,158,158,157,157,157,157,157,156,156,156,156,155,155,155,155,155,154,154,154,154,154,153,153,153,153,152,152,152,152,152,151,151,151,151,151,150,150,150,150,150,149,149,149,149,149,149,149,149,149,149,149,148,148,148,148,148,147,147,147,147,147,147,146,146,146,146,146,145,145,145,145,145,145,144,144,144,144,144,144,143,143,143,143,143,143,142,142,142,142,142,142,141,141,141,141,141,141,140,140,140,140,140,140,140,140,140,140,140,140,140,139,139,139,139,139,139,139,138,138,138,138,138,138,138,137,137,137,137,137,137,137,136,136,136,136,136,136,136,135,135,135,135,135,135,135,134,134,134,134,134,134,134,134,133,133,133,133,133,133,133,133,132,132,132,132,132,132,132,132,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,130,130,130,130,130,130,130,130,129,129,129,129,129,129,129,129,129,128,128,128,128,128,128,128,128,128,127,127,127,127,127,127,127,127,127,126,126,126,126,126,126,126,126,126,125,125,125,125,125,125,125,125,125,125,124,124,124,124,124,124,124,124,124,124,123,123,123,123,123,123,123,123,123,123,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,121,121,121,121,121,121,121,121,121,121,121,120,120,120,120,120,120,120,120,120,120,120,119,119,119,119,119,119,119,119,119,119,119,119,118,118,118,118,118,118,118,118,118,118,118,118,117,117,117,117,117,117,117,117,117,117,117,117,116,116,116,116,116,116,116,116,116,116,116,116,115,115,115,115,115,115,115,115,115,115,115,115,115,114,114,114,114,114,114,114,114,114,114,114,114,114,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,111,111,111,111,111,111,111,111,111,111,111,111,111,111,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93, 0,
4104 		ACC_CURVE,CRV_PARKHOME  ,3763,2330,1803,1515,1330,1198,1099,1021,957,904,859,819,785,755,728,704,682,662,644,626,611,597,583,571,559,548,537,527,518,509,501,493,485,478,472,464,458,453,446,441,436,430,425,420,416,411,407,402,399,394,391,387,383,380,376,374,370,366,364,361,358,355,352,349,347,344,342,339,337,335,332,330,328,326,323,321,320,318,315,313,311,310,308,306,304,302,301,300,298,296,294,293,292,290,289,287,285,284,283,282,280,279,277,276,275,274,273,271,270,269,267,266,266,265,263,262,261,260,259,258,257,256,255,254,253,252,251,250,249,248,248,247,246,245,244,243,242,241,240,239,239,239,238,237,236,235,234,233,233,232,231,230,230,230,229,228,227,227,226,225,224,224,223,222,221,221,221,220,220,219,218,218,217,216,216,215,214,214,213,213,212,212,212,211,211,210,209,209,208,208,207,207,206,205,205,204,204,203,203,203,203,202,202,201,201,200,200,199,199,198,198,197,197,196,196,195,195,194,194,194,194,194,193,193,192,192,191,191,191,190,190,189,189,188,188,188,187,187,186,186,186,185,185,185,185,185,184,184,184,183,183,182,182,182,181,181,181,180,180,180,179,179,178,178,178,177,177,177,176,176,176,176,176,176,175,175,175,174,174,174,174,173,173,173,172,172,172,171,171,171,170,170,170,170,169,169,169,168,168,168,168,167,167,167,167,167,167,167,166,166,166,166,165,165,165,165,164,164,164,163,163,163,163,162,162,162,162,161,161,161,161,160,160,160,160,160,159,159,159,159,158,158,158,158,158,158,158,158,157,157,157,157,157,156,156,156,156,155,155,155,155,155,154,154,154,154,154,153,153,153,153,153,152,152,152,152,152,151,151,151,151,151,150,150,150,150,150,149,149,149,149,149,149,149,149,149,149,148,148,148,148,148,148,147,147,147,147,147,147,146,146,146,146,146,145,145,145,145,145,145,144,144,144,144,144,144,143,143,143,143,143,143,142,142,142,142,142,142,141,141,141,141,141,141,141,140,140,140,140,140,140,140,140,140,140,140,140,140,139,139,139,139,139,139,139,138, 0,
4105 		ACC_CURVE,CRV_SMEARING  ,3763,2330,1803,1515,1330,1198,1099,1021,957,904,859,819,785,755,728,704,682,662,644,626,611,597,583,571,559,548,540, 0,
4106 		DEC_CURVE,CRV_NORMALSCAN,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,87,87,87,87,87,87,87,87,88,88,88,88,88,88,88,88,89,89,89,89,89,89,89,90,90,90,90,90,90,91,91,91,91,91,92,92,92,92,93,93,93,93,94,94,94,95,95,95,95,95,96,96,97,97,98,98,99,99,100,100,101,101,102,102,103,104,104,105,106,107,108,109,110,111,112,113,113,115,117,119,121,122,124,127,130,132,135,139,142,146,149,153,158,162,167,171,176,180,186,193,202,209,216,223,232,243,254,266,279,292,306,320,335,337,351,367,380,396,414,437,464,493,520,549,583,611,644,675,711,755,785,819,859,904,957,1021,1099,1198,1330,1515,1803,2330,3763, 0,
4107 		DEC_CURVE,CRV_PARKHOME  ,138,142,146,149,153,158,162,167,171,176,180,186,193,202,209,216,223,232,243,254,266,279,292,306,320,335,337,351,367,380,396,414,437,464,493,520,549,583,611,644,675,711,755,785,819,859,904,957,1021,1099,1198,1330,1515,1803,2330,3763, 0,
4108 		DEC_CURVE,CRV_SMEARING  ,138,139,139,139,139,139,139,139,140,140,140,140,140,140,140,140,140,140,140,140,140,141,141,141,141,141,141,141,142,142,142,142,142,142,143,143,143,143,143,143,144,144,144,144,144,144,145,145,145,145,145,145,146,146,146,146,146,147,147,147,147,147,147,148,148,148,148,148,148,149,149,149,149,149,149,149,149,149,149,150,150,150,150,150,151,151,151,151,151,152,152,152,152,152,153,153,153,153,153,154,154,154,154,154,155,155,155,155,155,156,156,156,156,157,157,157,157,157,158,158,158,158,158,158,158,158,159,159,159,159,160,160,160,160,160,161,161,161,161,162,162,162,162,163,163,163,163,164,164,164,165,165,165,165,166,166,166,166,167,167,167,167,167,167,167,168,168,168,168,169,169,169,170,170,170,170,171,171,171,172,172,172,173,173,173,174,174,174,174,175,175,175,176,176,176,176,176,176,177,177,177,178,178,178,179,179,180,180,180,181,181,181,182,182,182,183,183,184,184,184,185,185,185,185,185,186,186,186,187,187,188,188,188,189,189,190,190,191,191,191,192,192,193,193,194,194,194,194,194,195,195,196,196,197,197,198,198,199,199,200,200,201,201,202,202,203,203,203,203,204,204,205,205,206,207,207,208,208,209,209,210,211,211,212,212,212,213,213,214,214,215,216,216,217,218,218,219,220,220,221,221,221,222,223,224,224,225,226,227,227,228,229,230,230,230,231,232,233,233,234,235,236,237,238,239,239,239,240,241,242,243,244,245,246,247,248,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,265,266,266,267,269,270,271,273,274,275,276,277,279,280,282,283,284,285,287,289,290,292,293,294,296,298,300,301,302,304,306,308,310,311,313,315,318,320,321,323,326,328,330,332,335,337,339,342,344,347,349,352,355,358,361,364,366,370,374,376,380,383,387,391,394,399,402,407,411,416,420,425,430,436,441,446,453,458,464,472,478,485,493,501,509,518,527,537,548,559,571,583,597,611,626,644,662,682,704,728,755,785,819,859,904,957,1021,1099,1198,1330,1515,1803,2330,3763, 0,
4109 		DEC_CURVE,CRV_BUFFERFULL,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,94,94,94,95,95,95,95,95,96,96,97,97,98,98,99,99,100,100,101,101,102,102,103,104,104,105,106,107,108,109,110,111,112,113,113,115,117,119,121,122,124,127,130,132,135,139,142,146,149,153,158,162,167,171,176,180,186,193,202,209,216,223,232,243,254,266,279,292,306,320,335,337,351,367,380,396,414,437,464,493,520,549,583,611,644,675,711,755,785,819,859,904,957,1021,1099,1198,1330,1515,1803,2330,3763, 0,
4110 		-2,
4111 
4112 		/* motorcurve 6   */
4113 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
4114 		ACC_CURVE,CRV_NORMALSCAN,23999, 0,
4115 		ACC_CURVE,CRV_PARKHOME  ,5360,3362,2628,2229,1973,1791,1654,1547,1458,1384,1319,1264,1214,1170,1131,1096,1063,1034,1006,981,958,937,916,897,880,863,847,832,818,805,792,780,769,758,747,737,727,718,709,700,692, 0,
4116 		ACC_CURVE,CRV_SMEARING  ,23999, 0,
4117 		DEC_CURVE,CRV_NORMALSCAN,23999, 0,
4118 		DEC_CURVE,CRV_PARKHOME  ,692,700,709,718,727,737,747,758,769,780,792,805,818,832,847,863,880,897,916,937,958,981,1006,1034,1063,1096,1131,1170,1214,1264,1319,1384,1458,1547,1654,1791,1973,2229,2628,3362,5360, 0,
4119 		DEC_CURVE,CRV_SMEARING  ,23999, 0,
4120 		DEC_CURVE,CRV_BUFFERFULL,23999, 0,
4121 		-2,
4122 
4123 		/* motorcurve 7   */
4124 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
4125 		ACC_CURVE,CRV_NORMALSCAN,6667, 0,
4126 		ACC_CURVE,CRV_PARKHOME  ,5360,3362,2628,2229,1973,1791,1654,1547,1458,1384,1319,1264,1214,1170,1131,1096,1063,1034,1006,981,958,937,916,897,880,863,847,832,818,805,792,780,769,758,747,737,727,718,709,700,692, 0,
4127 		ACC_CURVE,CRV_SMEARING  ,6667, 0,
4128 		DEC_CURVE,CRV_NORMALSCAN,6667, 0,
4129 		DEC_CURVE,CRV_PARKHOME  ,692,700,709,718,727,737,747,758,769,780,792,805,818,832,847,863,880,897,916,937,958,981,1006,1034,1063,1096,1131,1170,1214,1264,1319,1384,1458,1547,1654,1791,1973,2229,2628,3362,5360, 0,
4130 		DEC_CURVE,CRV_SMEARING  ,6667, 0,
4131 		DEC_CURVE,CRV_BUFFERFULL,6667, 0,
4132 		-2,
4133 
4134 		/* motorcurve 8   */
4135 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
4136 		ACC_CURVE,CRV_NORMALSCAN,1046,1046,1046,1046,1046,1046,647,501,421,370,333,305,284,266,251,239,228,218,210,202,196,190,184,179,174,170,166,162,159,155,152,149,147,144,142,139,137,135,133,131,129,127,126,124,123,121,120,118,117,116,114,113,112,111,110,109,108,107,106,105,104,103,102,101,100,100,99,98,97,96,96,95,94,94,93,92,92,91,91,90,89,89,88,88,87,87,86,86,85,85,84,84,83,83,82,82,82,81,81,80,80,79,79,79,78,78,78,77,77,76,76,76,75,75,75,74,74,74,74,73,73,73,72,72,72,71,71,71,71,70,70,70,70,69,69,69,69,68,68,68,68,67,67,67,67,66,66,66,66,65,65,65,65,64,64,64,64,63,63,63,63,62,62,62,62,61,61,61,61,61,60,60,60,60,60,60,59,59,59,59,59,59,59,58,58,58,58,58,58,57,57,57,57,57,57,57,56,56,56,56,56,56,56,56,55,55,55,55,55,55,55,55,54,54,54,54,54,54,54,54,53,53,53,53,53,53,53,53,52,52,52,52,52,52,52,52,51,51,51,51,51,51,51,51,51,51,51,51,50,50,50,50,50,50,50,50,50,50,50,49,49,49,49,49,49,49,49,49,49,49,49,48,48,48,48,48,48,48,48,48,48,48,48,47,47,47,47,47,47,47,47,47,47,47,47,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,23, 0,
4137 		ACC_CURVE,CRV_PARKHOME  ,1045,678,604,554,332,332,304,283,265,250,238,227,217,209,201,195,189,183,178,173,169,165,161,158,154,151,148,146,143,141,138,136,134,132,130,128,126,125,123,122,120,119,117,116,115,113,112,111,110,109,108,107,106,105,104,103,102,101,100,99,99,98,97,96,95,95,94,93,93,92,91,91,90,90,89,88,88,87,87,86,86,85,85,84,84,83,83,82,82,81,81,81,80,80,79,79,78,78,78,77,77,77,76,76,75,75,75,74,74,74,73,73,73,73,72,72,72,71,71,71,70,70,70,70,69,69,69,69,68,68,68,68,67,67,67,67,66,66,66,66,65,65,65,65,65,64,64,64,64,64,63,63,63,63,63,62,62,62,62,62,61,61,61,61,61,61,60,60,60,60,60,60,59,59,59,59,59,59,58,58,58,58,58,58,58,57,57,57,57,57,57,57,56,56,56,56,56,56,56,55,55,55,55,55,55,55,55,54,54,54,54,54,54,54,54,53,53,53,53,53,53,53,53,53,52,52,52,52,52,52,52,52,52,51,51,51,51,51,51,51,51,51,51,50,50,50,50,50,50,50,50,50,50,50,49,49,49,49,49,49,49,49,49,49,49,48,48,48,48,48,48,48,48,48,48,48,48,47,47,47,47,47,47,47,47,47,47,47,47,47,46,46,46,46,46,46,46,46,46,46,46,46,46,46,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,39, 0,
4138 		ACC_CURVE,CRV_SMEARING  ,1045,678,604,554,332,332,304,283,265,250,238,227,217,209,201,195,189,183,178,173,169,165,161,158,154,151,148,146,143,141,138,136,134,132,130,128,126,125,123,122,120,119,117,116,115,113,112,111,110,109,108,107,106,105,104,103,102,101,100,99,99,98,97,96,95,95,94,93,93,92,91,91,90,90,89,88,88,87,87,86,86,85,85,84,84,83,83,82,82,81,81,81,80,80,79,79,78,78,78,77,77,77,76,76,75,75,75,74,74,74,73,73,73,73,72,72,72,71,71,71,70,70,70,70,69,69,69,69,68,68,68,68,67,67,67,67,66,66,66,66,65,65,65,65,65,64,64,64,64,64,63,63,63,63,63,62,62,62,62,62,61,61,61,61,61,61,60,60,60,60,60,60,59,59,59,59,59,59,58,58,58,58,58,58,58,57,57,57,57,57,57,57,56,56,56,56,56,56,56,55,55,55,55,55,55,55,55,54,54,54,54,54,54,54,54,53,53,53,53,53,53,53,53,53,52,52,52,52,52,52,52,52,52,51,51,51,51,51,51,51,51,51,51,50,50,50,50,50,50,50,50,50,50,50,49,49,49,49,49,49,49,49,49,49,49,48,48,48,48,48,48,48,48,48,48,48,48,47,47,47,47,47,47,47,47,47,47,47,47,47,46,46,46,46,46,46,46,46,46,46,46,46,46,46,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,39, 0,
4139 		DEC_CURVE,CRV_NORMALSCAN,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,27,27,27,27,27,27,27,27,27,27,27,27,28,28,28,28,28,28,28,28,29,29,29,29,29,29,29,30,30,30,30,31,31,31,31,32,32,32,32,33,33,34,34,35,35,36,37,38,38,39,40,41,42,43,45,46,47,48,50,51,53,54,57,59,61,63,65,68,71,75,78,82,86,90,94,94,98,103,106,111,116,122,130,138,145,153,163,171,180,188,198,211,219,228,239,252,267,284,306,334,370,422,502,648,1045, 0,
4140 		DEC_CURVE,CRV_PARKHOME  ,39,40,41,42,43,45,46,47,48,50,51,53,54,57,59,61,63,65,68,71,75,78,82,86,90,94,94,98,103,106,111,116,122,130,138,145,153,163,171,180,188,198,211,219,228,239,252,267,284,306,334,370,422,502,648,1045, 0,
4141 		DEC_CURVE,CRV_SMEARING  ,39,39,39,39,39,39,39,39,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,49,49,49,49,49,49,49,49,49,49,49,49,50,50,50,50,50,50,50,50,50,50,50,50,51,51,51,51,51,51,51,51,51,51,51,52,52,52,52,52,52,52,52,52,52,53,53,53,53,53,53,53,53,53,53,54,54,54,54,54,54,54,54,54,55,55,55,55,55,55,55,55,55,56,56,56,56,56,56,56,56,57,57,57,57,57,57,57,57,58,58,58,58,58,58,58,59,59,59,59,59,59,59,60,60,60,60,60,60,60,61,61,61,61,61,61,62,62,62,62,62,62,63,63,63,63,63,64,64,64,64,64,65,65,65,65,65,66,66,66,66,66,67,67,67,67,67,68,68,68,68,69,69,69,69,70,70,70,70,71,71,71,71,72,72,72,73,73,73,73,74,74,74,75,75,75,76,76,76,77,77,77,78,78,78,79,79,79,80,80,81,81,81,82,82,83,83,84,84,84,85,85,86,86,87,87,88,88,89,90,90,91,91,92,93,93,94,94,95,96,96,97,98,99,99,100,101,102,103,104,105,105,106,107,108,109,110,112,113,114,115,116,118,119,120,122,123,125,127,128,130,132,134,136,138,140,142,145,147,150,153,156,159,163,167,171,175,180,185,190,196,203,211,219,228,239,252,267,284,306,334,370,422,502,648,1045, 0,
4142 		DEC_CURVE,CRV_BUFFERFULL,1045,648,502,422,370,334,306,284,267,252,239,228,219,211,198,188,180,171,163,153,145,138,130,122,116,111,106,103,98,94,94,90,86,82,78,75,71,68,65,63,61,59,57,54,53,51,50,48,47,46,45,43,42,41,40,39,38,38,37,36,35,35,34,34,33,33,32,32,32,32,31,31,31,31,30,30,30,30,29,29,29,29,29,29,29,28,28,28,28,28,28,28,28,27,27,27,27,27,27,27,27,27,27,27,27,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25, 0,
4143 		-2,
4144 
4145 		/* motorcurve 9   */
4146 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
4147 		ACC_CURVE,CRV_NORMALSCAN,3136,3136,3136,3136,3136,3136,2036,1815,1664,998,998,915,850,797,752,715,682,654,628,606,586,568,551,536,522,509,497,485,475,465,456,447,439,431,424,417,410,404,398,392,387,381,376,371,367,362,358,354,350,346,342,338,335,331,328,325,322,319,316,313,310,308,305,302,300,298,295,293,291,288,286,284,282,280,278,276,274,272,271,269,267,265,264,262,261,259,257,256,254,253,252,250,249,247,246,245,244,242,241,240,239,237,236,235,234,233,232,231,230,228,227,226,225,224,223,222,221,221,220,219,218,217,216,215,214,213,213,212,211,210,209,209,208,207,206,206,205,204,203,203,202,201,200,200,199,198,198,197,196,196,195,195,194,193,193,192,192,191,190,190,189,189,188,187,187,186,186,185,185,184,184,183,183,182,182,181,181,180,180,179,179,178,178,177,177,176,176,175,175,175,174,174,173,173,172,172,172,171,171,170,170,170,169,169,168,168,168,167,167,166, 0,
4148 		ACC_CURVE,CRV_PARKHOME  ,3136,3136,3136,3136,3136,3136,2036,1815,1664,998,998,915,850,797,752,715,682,654,628,606,586,568,551,536,522,509,497,485,475,465,456,447,439,431,424,417,410,404,398,392,387,381,376,371,367,362,358,354,350,346,342,338,335,331,328,325,322,319,316,313,310,308,305,302,300,298,295,293,291,288,286,284,282,280,278,276,274,272,271,269,267,265,264,262,261,259,257,256,254,253,252,250,249,247,246,245,244,242,241,240,239,237,236,235,234,233,232,231,230,228,227,226,225,224,223,222,221,221,220,219,218,217,216,215,214,213,213,212,211,210,209,209,208,207,206,206,205,204,203,203,202,201,200,200,199,198,198,197,196,196,195,195,194,193,193,192,192,191,190,190,189,189,188,187,187,186,186,185,185,184,184,183,183,182,182,181,181,180,180,179,179,178,178,177,177,176,176,175,175,175,174,174,173,173,172,172,172,171,171,170,170,170,169,169,168,168,168,167,167,166,166,166, 0,
4149 		ACC_CURVE,CRV_SMEARING  ,3136,3136,3136,3136,3136,3136,2036,1815,1664,998,998,915,850,797,752,715,682,654,628,606,586,568,551,536,522,509,497,485,475,465,456,455, 0,
4150 		DEC_CURVE,CRV_NORMALSCAN,455,456,465,475,485,497,509,522,536,551,568,586,606,628,654,682,715,752,797,850,915,998,998,1664,1815,2036,3136,3136,3136,3136,3136,3136, 0,
4151 		DEC_CURVE,CRV_PARKHOME  ,455,456,465,475,485,497,509,522,536,551,568,586,606,628,654,682,715,752,797,850,915,998,998,1664,1815,2036,3136,3136,3136,3136,3136,3136, 0,
4152 		DEC_CURVE,CRV_SMEARING  ,455,456,465,475,485,497,509,522,536,551,568,586,606,628,654,682,715,752,797,850,915,998,998,1664,1815,2036,3136,3136,3136,3136,3136,3136, 0,
4153 		DEC_CURVE,CRV_BUFFERFULL,110,110,111,111,112,112,113,113,114,114,115,115,116,116,117,117,118,118,119,119,120,120,121,121,122,122,123,123,124,124,125,125,126,126,127,127,128,128,129,129,130,131,132,133,133,134,135,136,137,138,139,140,141,143,144,145,146,147,149,150,151,153,154,156,157,159,161,162,164,166,168,170,172,174,176,179,181,184,186,189,192,195,198,202,206,209,213,218,222,227,233,239,245,252,259,267,276,282,286,291,298,305,310,319,325,331,342,354,362,376,387,404,417,431,456,475,509,551,586,654,715,850,998,1664,3136,3136, 0,
4154 		-2,
4155 
4156 		/* motorcurve 10  */
4157 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
4158 		ACC_CURVE,CRV_NORMALSCAN,3136,3136,3136,3136,3136,3136,2036,1815,1664,998,998,915,850,797,752,715,682,654,628,606,586,568,551,536,522,509,497,485,475,465,456,447,439,431,424,417,410,404,398,392,387,381,376, 0,
4159 		ACC_CURVE,CRV_PARKHOME  ,3136,3136,3136,3136,3136,3136,2036,1815,1664,998,998,915,850,797,752,715,682,654,628,606,586,568,551,536,522,509,497,485,475,465,456,447,439,431,424,417,410,404,398,392,387,381,376,371,367,362,358,354,350,346,342,338,335,331,328,325,322,319,316,313,310,308,305,302,300,298,295,293,291,288,286,284,282,280,278,276,274,272,271,269,267,265,264,262,261,259,257,256,254,253,252,250,249,247,246,245,244,242,241,240,239,237,236,235,234,233,232,231,230,228,227,226,225,224,223,222,221,221,220,219,218,217,216,215,214,213,213,212,211,210,209,209,208,207,206,206,205,204,203,203,202,201,200,200,199,198,198,197,196,196,195,195,194,193,193,192,192,191,190,190,189,189,188,187,187,186,186,185,185,184,184,183,183,182,182,181,181,180,180,179,179,178,178,177,177,176,176,175,175,175,174,174,173,173,172,172,172,171,171,170,170,170,169,169,168,168,168,167,167,166, 0,
4160 		ACC_CURVE,CRV_SMEARING  ,3136,3136,3136,3136,3136,3136,2036,1815,1664,998,998,915,850,797,752,715,682,654,628,606,586,568,551,536,522,509,497,485,475,465,456,455, 0,
4161 		DEC_CURVE,CRV_NORMALSCAN,381,392,404,417,431,447,465,485,508,535,566,604,650,709,787,897,1067,2227,3136, 0,
4162 		DEC_CURVE,CRV_PARKHOME  ,455,456,465,475,485,497,509,522,536,551,568,586,606,628,654,682,715,752,797,850,915,998,998,1664,1815,2036,3136, 0,
4163 		DEC_CURVE,CRV_SMEARING  ,455,456,465,475,485,497,509,522,536,551,568,586,606,628,654,682,715,752,797,850,915,998,998,1664,1815,2036,3136, 0,
4164 		DEC_CURVE,CRV_BUFFERFULL,381,392,404,417,431,447,465,485,508,535,566,604,650,709,787,897,1067,2227,3136, 0,
4165 		-2,
4166 
4167 		/* motorcurve 11  */
4168 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
4169 		ACC_CURVE,CRV_NORMALSCAN,3136,3136,3136,3136,3136,3136,2036,1815,1664,998,998,915,850,797,752,715,682,654,628,606,586,568,551,536,522,509,497,485,475,465,456,447,439,431,424,417,410,404,398,392,387,381,376,371,367,362,358,354,350,346,342,338,335,331,328,325,322,319,316,313,310,308,305,302,300,298,295,293,291,288,286,284,282,280,278,276,274,272,271,269,267,265,264,262,261,259,257,256,254,253,252,250,249,247,246,245,244,242,241,240,239,237,236,235,234,233,232,231,230,228,227,226,225,224,223,222,221,221,220,219,218,217,216,215,214,213,213,212,211,210,209,209,208,207,206,206,205,204,203,203,202,201,200,200,199,198,198,197,196,196,195,195,194,193,193,192,192,191,190,190,189,189,188,187,187,186,186,185,185,184,184,183,183,182,182,181,181,180,180,179,179,178,178,177,177,176,176,175,175,175,174,174,173,173,172,172,172,171,171,170,170,170,169,169,168,168,168,167,167,166, 0,
4170 		ACC_CURVE,CRV_PARKHOME  ,3136,3136,3136,3136,3136,3136,2036,1815,1664,998,998,915,850,797,752,715,682,654,628,606,586,568,551,536,522,509,497,485,475,465,456,447,439,431,424,417,410,404,398,392,387,381,376,371,367,362,358,354,350,346,342,338,335,331,328,325,322,319,316,313,310,308,305,302,300,298,295,293,291,288,286,284,282,280,278,276,274,272,271,269,267,265,264,262,261,259,257,256,254,253,252,250,249,247,246,245,244,242,241,240,239,237,236,235,234,233,232,231,230,228,227,226,225,224,223,222,221,221,220,219,218,217,216,215,214,213,213,212,211,210,209,209,208,207,206,206,205,204,203,203,202,201,200,200,199,198,198,197,196,196,195,195,194,193,193,192,192,191,190,190,189,189,188,187,187,186,186,185,185,184,184,183,183,182,182,181,181,180,180,179,179,178,178,177,177,176,176,175,175,175,174,174,173,173,172,172,172,171,171,170,170,170,169,169,168,168,168,167,167,166, 0,
4171 		ACC_CURVE,CRV_SMEARING  ,3136,3136,3136,3136,3136,3136,2036,1815,1664,998,998,915,850,797,752,715,682,654,628,606,586,568,551,536,522,509,497,485,475,465,456,447,439,431,424,417,410,404,398,392,387,381,376,371,367,362,358,354,350,346,342,338,335,331,328,325,322,319,316,313,310,308,305,302,300,298,295,293,291,288,286,284,282,280,278,276,274,272,271,269,267,265,264,262,261,259,257,256,254,253,252,250,249,247,246,245,244,242,241,240,239,237,236,235,234,233,232,231,230,228,227,226,225,224,223,222,221,221,220,219,218,217,216,215,214,213,213,212,211,210,209,209,208,207,206,206,205,204,203,203,202,201,200,200,199,198,198,197,196,196,195,195,194,193,193,192,192,191,190,190,189,189,188,187,187,186,186,185,185,184,184,183,183,182,182,181,181,180,180,179,179,178,178,177,177,176,176,175,175,175,174,174,173,173,172,172,172,171,171,170,170,170,169,169,168,168,168,167,167,166, 0,
4172 		DEC_CURVE,CRV_NORMALSCAN,167,168,169,170,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,190,191,192,193,194,196,197,198,200,201,203,204,206,207,209,211,212,214,216,218,219,221,223,225,227,230,232,234,236,239,241,244,247,249,252,255,258,261,265,268,272,275,279,283,288,292,297,302,307,313,318,325,331,338,346,353,362,371,381,392,404,417,431,447,465,485,508,535,566,604,650,709,787,897,1067,2227,3136, 0,
4173 		DEC_CURVE,CRV_PARKHOME  ,455,456,465,475,485,497,509,522,536,551,568,586,606,628,654,682,715,752,797,850,915,998,998,1664,1815,2036,3136, 0,
4174 		DEC_CURVE,CRV_SMEARING  ,455,456,465,475,485,497,509,522,536,551,568,586,606,628,654,682,715,752,797,850,915,998,998,1664,1815,2036,3136, 0,
4175 		DEC_CURVE,CRV_BUFFERFULL,167,168,169,170,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,190,191,192,193,194,196,197,198,200,201,203,204,206,207,209,211,212,214,216,218,219,221,223,225,227,230,232,234,236,239,241,244,247,249,252,255,258,261,265,268,272,275,279,283,288,292,297,302,307,313,318,325,331,338,346,353,362,371,381,392,404,417,431,447,465,485,508,535,566,604,650,709,787,897,1067,2227,3136, 0,
4176 		-2,
4177 
4178 		/* motorcurve 12  */
4179 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
4180 		ACC_CURVE,CRV_NORMALSCAN,3136,3136,3136,3136,3136,3136,2036,1815,1664,998,998,915,850,797,752,715,682,654,628,606,586,568,551,536,522,509,497,485,475,465,456,447,439,431,424,417,410,404,398,392,387,381,376,371,367,362,358,354,350,346,342,338,335,331,328,325,322,319,316,313,310,308,305,302,300,298,295,293,291,288,286,284,282,280,278,276,274,272,271,269,267,265,264,262,261,259,257,256,254,253,252,250,249,247,246,245,244,242,241,240,239,237,236,235,234,233,232,231,230,228,227,226,225,224,223,222,221,221,220,219,218,217,216,215,214,213,213,212,211,210,209,209,208,207,206,206,205,204,203,203,202,201,200,200,199,198,198,197,196,196,195,195,194,193,193,192,192,191,190,190,189,189,188,187,187,186,186,185,185,184,184,183,183,182,182,181,181,180,180,179,179,178,178,177,177,176,176,175,175,175,174,174,173,173,172,172,172,171,171,170,170,170,169,169,168,168,168,167,167,166,166,166,165,165,165,164,164,163,163,163,162,162,162,161,161,161,160,160,160,159,159,159,158,158,158,157,157,157,156,156,156,156,155,155,155,154,154,154,153,153,153,153,152,152,152,151,151,151,151,150,150,150,150,149,149,149,148,148,148,148,147,147,147,147,146,146,146,146,145,145,145,145,144,144,144,144,144,143,143,143,143,142,142,142,142,141,141,141,141,141,140,140,140,140,140,139,139,139,139,138,138,138,138,138,137,137,137,137,137,136,136,136,136,136,135,135,135,135,135,135,134,134,134,134,134,133,133,133,133,133,133,132,132,132,132,132,131,131,131,131,131,131,130,130,130,130,130,130,129,129,129,129,129,129,128,128,128,128,128,128,127,127,127,127,127,127,127,126,126,126,126,126,126,125, 0,
4181 		ACC_CURVE,CRV_PARKHOME  ,3136,3136,3136,3136,3136,3136,2036,1815,1664,998,998,915,850,797,752,715,682,654,628,606,586,568,551,536,522,509,497,485,475,465,456,447,439,431,424,417,410,404,398,392,387,381,376,371,367,362,358,354,350,346,342,338,335,331,328,325,322,319,316,313,310,308,305,302,300,298,295,293,291,288,286,284,282,280,278,276,274,272,271,269,267,265,264,262,261,259,257,256,254,253,252,250,249,247,246,245,244,242,241,240,239,237,236,235,234,233,232,231,230,228,227,226,225,224,223,222,221,221,220,219,218,217,216,215,214,213,213,212,211,210,209,209,208,207,206,206,205,204,203,203,202,201,200,200,199,198,198,197,196,196,195,195,194,193,193,192,192,191,190,190,189,189,188,187,187,186,186,185,185,184,184,183,183,182,182,181,181,180,180,179,179,178,178,177,177,176,176,175,175,175,174,174,173,173,172,172,172,171,171,170,170,170,169,169,168,168,168,167,167,166, 0,
4182 		ACC_CURVE,CRV_SMEARING  ,3136,3136,3136,3136,3136,3136,2036,1815,1664,998,998,915,850,797,752,715,682,654,628,606,586,568,551,536,522,509,497,485,475,465,456,455, 0,
4183 		DEC_CURVE,CRV_NORMALSCAN,110,110,110,110,110,110,110,110,111,111,111,111,111,112,112,112,112,112,113,113,113,113,114,114,114,114,115,115,115,115,115,116,116,116,116,117,117,117,117,118,118,118,118,119,119,119,120,120,120,120,121,121,121,121,122,122,122,123,123,123,124,124,124,124,125,125,125,126,126,126,127,127,127,128,128,128,129,129,129,130,130,130,131,131,132,132,132,133,133,133,134,134,135,135,135,136,136,137,137,138,138,138,139,139,140,140,141,141,142,142,142,143,143,144,144,145,145,146,146,147,148,148,149,149,150,150,151,151,152,153,153,154,154,155,156,156,157,158,158,159,160,160,161,162,163,163,164,165,166,166,167,168,169,170,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,190,191,192,193,194,196,197,198,200,201,203,204,206,207,209,211,212,214,216,218,219,221,223,225,227,230,232,234,236,239,241,244,247,249,252,255,258,261,265,268,272,275,279,283,288,292,297,302,307,313,318,325,331,338,346,353,362,371,381,392,404,417,431,447,465,485,508,535,566,604,650,709,787,897,1067,2227,3136, 0,
4184 		DEC_CURVE,CRV_PARKHOME  ,455,456,465,475,485,497,509,522,536,551,568,586,606,628,654,682,715,752,797,850,915,998,998,1664,1815,2036,3136, 0,
4185 		DEC_CURVE,CRV_SMEARING  ,455,456,465,475,485,497,509,522,536,551,568,586,606,628,654,682,715,752,797,850,915,998,998,1664,1815,2036,3136, 0,
4186 		DEC_CURVE,CRV_BUFFERFULL,110,110,111,111,112,112,113,113,114,114,115,115,116,116,117,117,118,118,119,119,120,120,121,121,122,122,123,123,124,124,125,125,126,126,127,127,128,128,129,129,130,131,132,133,133,134,135,136,137,138,139,140,141,143,144,145,146,147,149,150,151,153,154,156,157,159,161,162,164,166,168,170,172,174,176,179,181,184,186,189,192,195,198,202,206,209,213,218,222,227,233,239,245,252,259,267,276,282,286,291,298,305,310,319,325,331,342,354,362,376,387,404,417,431,456,475,509,551,586,654,715,850,998,1664,3136, 0,
4187 		-1
4188 	};
4189 
4190 	rst = (SANE_Int *)malloc(sizeof(steps));
4191 	if (rst != NULL)
4192 		memcpy(rst, &steps, sizeof(steps));
4193 
4194 	return rst;
4195 }
4196 
cfg_motorcurve_get()4197 static SANE_Int *cfg_motorcurve_get()
4198 {
4199 	/* returns motor setting buffer for a device */
4200 
4201 	SANE_Int *rst = NULL;
4202 
4203 	switch(RTS_Debug->dev_model)
4204 	{
4205 		case BQ5550:
4206 			rst = bq5550_motor();
4207 			break;
4208 
4209 		case HP3800:
4210 		case HPG2710:
4211 			rst = hp3800_motor();
4212 			break;
4213 
4214 		case HP4370:
4215 		case HPG3010:
4216 		case HPG3110:
4217 			rst = hp4370_motor();
4218 			break;
4219 
4220 		default:
4221 			rst = hp3970_motor();
4222 			break;
4223 	}
4224 
4225 	return rst;
4226 }
4227 
4228 /* DEPRECATED functions */
4229 
ua4900_calibreflective(int option,int defvalue)4230 static int ua4900_calibreflective(int option, int defvalue)
4231 {
4232 	int rst = defvalue;
4233 
4234 	switch(option)
4235 	{
4236 		case WSTRIPXPOS: rst = 0; break;
4237 		case WSTRIPYPOS: rst = 0; break;
4238 		case BSTRIPXPOS: rst = 0; break;
4239 		case BSTRIPYPOS: rst = 0; break;
4240 		case BREFR: rst = 10; break;
4241 		case BREFG: rst = 10; break;
4242 		case BREFB: rst = 10; break;
4243 		case REFBITDEPTH: rst = 8; break;
4244 		case OFFSETHEIGHT: rst = 10; break;
4245 		case OFFSETNSIGMA: rst = 2; break;
4246 		case OFFSETTARGETMAX: rst = 50; break;
4247 		case OFFSETTARGETMIN: rst = 2; break;
4248 		case OFFSETAVGTARGETR: rst = 10; break;
4249 		case OFFSETAVGTARGETG: rst = 10; break;
4250 		case OFFSETAVGTARGETB: rst = 10; break;
4251 		case ADCOFFEVENODD: rst = 1; break;
4252 		case CALIBOFFSET1ON: rst = 2; break;
4253 		case ADCOFFQUICKWAY: rst = 1; break;
4254 		case ADCOFFPREDICTSTART: rst = 300; break;
4255 		case ADCOFFPREDICTEND: rst = 500; break;
4256 		case OFFSETTUNESTEP1: rst = 5; break;
4257 		case OFFSETBOUNDARYRATIO1: rst = 100; break;
4258 		case OFFSETAVGRATIO1: rst = 100; break;
4259 		case OFFSETEVEN1R: rst = 310; break;
4260 		case OFFSETODD1R: rst = 310; break;
4261 		case OFFSETEVEN1G: rst = 313; break;
4262 		case OFFSETODD1G: rst = 313; break;
4263 		case OFFSETEVEN1B: rst = 319; break;
4264 		case OFFSETODD1B: rst = 319; break;
4265 		case ADCOFFPREDICTR: rst = 321; break;
4266 		case ADCOFFPREDICTG: rst = 321; break;
4267 		case ADCOFFPREDICTB: rst = 321; break;
4268 		case ADCOFFEVEN1R_1ST: rst = 344; break;
4269 		case ADCOFFODD1R_1ST: rst = 344; break;
4270 		case ADCOFFEVEN1G_1ST: rst = 328; break;
4271 		case ADCOFFODD1G_1ST: rst = 328; break;
4272 		case ADCOFFEVEN1B_1ST: rst = 341; break;
4273 		case ADCOFFODD1B_1ST: rst = 341; break;
4274 		case PEAKR: rst = 122; break;
4275 		case PEAKG: rst = 122; break;
4276 		case PEAKB: rst = 122; break;
4277 		case MINR: rst = 50; break;
4278 		case MING: rst = 50; break;
4279 		case MINB: rst = 50; break;
4280 		case CALIBOFFSET2ON: rst = 0; break;
4281 		case OFFSETTUNESTEP2: rst = 1; break;
4282 		case OFFSETBOUNDARYRATIO2: rst = 100; break;
4283 		case OFFSETAVGRATIO2: rst = 100; break;
4284 		case OFFSETEVEN2R: rst = 0; break;
4285 		case OFFSETODD2R: rst = 0; break;
4286 		case OFFSETEVEN2G: rst = 0; break;
4287 		case OFFSETODD2G: rst = 0; break;
4288 		case OFFSETEVEN2B: rst = 0; break;
4289 		case OFFSETODD2B: rst = 0; break;
4290 		case GAINHEIGHT: rst = 10; break;
4291 		case GAINTARGETFACTOR: rst = 90; break;
4292 		case CALIBPAGON: rst = 0; break;
4293 		case PAGR: rst = 3; break;
4294 		case PAGG: rst = 3; break;
4295 		case PAGB: rst = 3; break;
4296 		case CALIBGAIN1ON: rst = 1; break;
4297 		case GAIN1R: rst = 8; break;
4298 		case GAIN1G: rst = 8; break;
4299 		case GAIN1B: rst = 8; break;
4300 		case CALIBGAIN2ON: rst = 0; break;
4301 		case GAIN2R: rst = 8; break;
4302 		case GAIN2G: rst = 8; break;
4303 		case GAIN2B: rst = 8; break;
4304 		case TOTSHADING: rst = 0; break;
4305 		case BSHADINGON: rst = -2; break;
4306 		case BSHADINGHEIGHT: rst = 10; break;
4307 		case BSHADINGPREDIFFR: rst = 2; break;
4308 		case BSHADINGPREDIFFG: rst = 1; break;
4309 		case BSHADINGPREDIFFB: rst = 2; break;
4310 		case BSHADINGDEFCUTOFF: rst = 0; break;
4311 		case WSHADINGON: rst = 3; break;
4312 		case WSHADINGHEIGHT: rst = 15; break;
4313 		case WSHADINGPREDIFFR: rst = -1; break;
4314 		case WSHADINGPREDIFFG: rst = -1; break;
4315 		case WSHADINGPREDIFFB: rst = -1; break;
4316 	}
4317 
4318 	return rst;
4319 }
4320 
hp3800_calibreflective(int option,int defvalue)4321 static int hp3800_calibreflective(int option, int defvalue)
4322 {
4323 	int rst = defvalue;
4324 	switch(option)
4325 	{
4326 		case WSTRIPXPOS: rst = 0; break;
4327 		case WSTRIPYPOS: rst = 0; break;
4328 		case BSTRIPXPOS: rst = 0; break;
4329 		case BSTRIPYPOS: rst = 0; break;
4330 		case BREFR: rst = 10; break;
4331 		case BREFG: rst = 10; break;
4332 		case BREFB: rst = 10; break;
4333 		case REFBITDEPTH: rst = 8; break;
4334 		case OFFSETHEIGHT: rst = 10; break;
4335 		case OFFSETNSIGMA: rst = 2; break;
4336 		case OFFSETTARGETMAX: rst = 50; break;
4337 		case OFFSETTARGETMIN: rst = 2; break;
4338 		case OFFSETAVGTARGETR: rst = 10; break;
4339 		case OFFSETAVGTARGETG: rst = 10; break;
4340 		case OFFSETAVGTARGETB: rst = 10; break;
4341 		case ADCOFFEVENODD: rst = 1; break;
4342 		case CALIBOFFSET1ON: rst = 2; break;
4343 		case ADCOFFQUICKWAY: rst = 1; break;
4344 		case ADCOFFPREDICTSTART: rst = 300; break;
4345 		case ADCOFFPREDICTEND: rst = 500; break;
4346 		case OFFSETTUNESTEP1: rst = 5; break;
4347 		case OFFSETBOUNDARYRATIO1: rst = 100; break;
4348 		case OFFSETAVGRATIO1: rst = 100; break;
4349 		case OFFSETEVEN1R: rst = 310; break;
4350 		case OFFSETODD1R: rst = 310; break;
4351 		case OFFSETEVEN1G: rst = 317; break;
4352 		case OFFSETODD1G: rst = 317; break;
4353 		case OFFSETEVEN1B: rst = 293; break;
4354 		case OFFSETODD1B: rst = 293; break;
4355 		case ADCOFFPREDICTR: rst = 500; break;
4356 		case ADCOFFPREDICTG: rst = 500; break;
4357 		case ADCOFFPREDICTB: rst = 500; break;
4358 		case ADCOFFEVEN1R_1ST: rst = 128; break;
4359 		case ADCOFFODD1R_1ST: rst = 128; break;
4360 		case ADCOFFEVEN1G_1ST: rst = 128; break;
4361 		case ADCOFFODD1G_1ST: rst = 128; break;
4362 		case ADCOFFEVEN1B_1ST: rst = 128; break;
4363 		case ADCOFFODD1B_1ST: rst = 128; break;
4364 		case PEAKR: rst = 104; break;
4365 		case PEAKG: rst = 111; break;
4366 		case PEAKB: rst = 105; break;
4367 		case MINR: rst = 50; break;
4368 		case MING: rst = 56; break;
4369 		case MINB: rst = 57; break;
4370 		case CALIBOFFSET2ON: rst = 0; break;
4371 		case OFFSETTUNESTEP2: rst = 1; break;
4372 		case OFFSETBOUNDARYRATIO2: rst = 100; break;
4373 		case OFFSETAVGRATIO2: rst = 100; break;
4374 		case OFFSETEVEN2R: rst = 0; break;
4375 		case OFFSETODD2R: rst = 0; break;
4376 		case OFFSETEVEN2G: rst = 0; break;
4377 		case OFFSETODD2G: rst = 0; break;
4378 		case OFFSETEVEN2B: rst = 0; break;
4379 		case OFFSETODD2B: rst = 0; break;
4380 		case GAINHEIGHT: rst = 10; break;
4381 		case GAINTARGETFACTOR: rst = 80; break;
4382 		case CALIBPAGON: rst = 0; break;
4383 		case PAGR: rst = 3; break;
4384 		case PAGG: rst = 3; break;
4385 		case PAGB: rst = 3; break;
4386 		case CALIBGAIN1ON: rst = 1; break;
4387 		case GAIN1R: rst = 23; break;
4388 		case GAIN1G: rst = 19; break;
4389 		case GAIN1B: rst = 0; break;
4390 		case CALIBGAIN2ON: rst = 0; break;
4391 		case GAIN2R: rst = 4; break;
4392 		case GAIN2G: rst = 4; break;
4393 		case GAIN2B: rst = 4; break;
4394 		case TOTSHADING: rst = 0; break;
4395 		case BSHADINGON: rst = -3; break;
4396 		case BSHADINGHEIGHT: rst = 20; break;
4397 		case BSHADINGPREDIFFR: rst = 2; break;
4398 		case BSHADINGPREDIFFG: rst = 2; break;
4399 		case BSHADINGPREDIFFB: rst = 2; break;
4400 		case BSHADINGDEFCUTOFF: rst = 0; break;
4401 		case WSHADINGON: rst = 3; break;
4402 		case WSHADINGHEIGHT: rst = 24; break;
4403 		case WSHADINGPREDIFFR: rst = -1; break;
4404 		case WSHADINGPREDIFFG: rst = -1; break;
4405 		case WSHADINGPREDIFFB: rst = -1; break;
4406 	}
4407 
4408 	return rst;
4409 }
4410 
hp3970_calibreflective(int option,int defvalue)4411 static int hp3970_calibreflective(int option, int defvalue)
4412 {
4413 	int rst = defvalue;
4414 	switch(option)
4415 	{
4416 		case WSTRIPXPOS: rst = 0; break;
4417 		case WSTRIPYPOS: rst = 0; break;
4418 		case BSTRIPXPOS: rst = 0; break;
4419 		case BSTRIPYPOS: rst = 0; break;
4420 		case BREFR: rst = 10; break;
4421 		case BREFG: rst = 10; break;
4422 		case BREFB: rst = 10; break;
4423 		case REFBITDEPTH: rst = 8; break;
4424 		case OFFSETHEIGHT: rst = 10; break;
4425 		case OFFSETNSIGMA: rst = 2; break;
4426 		case OFFSETTARGETMAX: rst = 50; break;
4427 		case OFFSETTARGETMIN: rst = 2; break;
4428 		case OFFSETAVGTARGETR: rst = 10; break;
4429 		case OFFSETAVGTARGETG: rst = 10; break;
4430 		case OFFSETAVGTARGETB: rst = 10; break;
4431 		case ADCOFFEVENODD: rst = 1; break;
4432 		case CALIBOFFSET1ON: rst = 2; break;
4433 		case ADCOFFQUICKWAY: rst = 1; break;
4434 		case ADCOFFPREDICTSTART: rst = 300; break;
4435 		case ADCOFFPREDICTEND: rst = 500; break;
4436 		case OFFSETTUNESTEP1: rst = 5; break;
4437 		case OFFSETBOUNDARYRATIO1: rst = 100; break;
4438 		case OFFSETAVGRATIO1: rst = 100; break;
4439 		case OFFSETEVEN1R: rst = 327; break;
4440 		case OFFSETODD1R: rst = 327; break;
4441 		case OFFSETEVEN1G: rst = 315; break;
4442 		case OFFSETODD1G: rst = 315; break;
4443 		case OFFSETEVEN1B: rst = 322; break;
4444 		case OFFSETODD1B: rst = 322; break;
4445 		case ADCOFFPREDICTR: rst = 322; break;
4446 		case ADCOFFPREDICTG: rst = 310; break;
4447 		case ADCOFFPREDICTB: rst = 322; break;
4448 		case ADCOFFEVEN1R_1ST: rst = 344; break;
4449 		case ADCOFFODD1R_1ST: rst = 344; break;
4450 		case ADCOFFEVEN1G_1ST: rst = 328; break;
4451 		case ADCOFFODD1G_1ST: rst = 328; break;
4452 		case ADCOFFEVEN1B_1ST: rst = 341; break;
4453 		case ADCOFFODD1B_1ST: rst = 341; break;
4454 		case PEAKR: rst = 82; break;
4455 		case PEAKG: rst = 117; break;
4456 		case PEAKB: rst = 116; break;
4457 		case MINR: rst = 37; break;
4458 		case MING: rst = 51; break;
4459 		case MINB: rst = 53; break;
4460 		case CALIBOFFSET2ON: rst = 0; break;
4461 		case OFFSETTUNESTEP2: rst = 1; break;
4462 		case OFFSETBOUNDARYRATIO2: rst = 100; break;
4463 		case OFFSETAVGRATIO2: rst = 100; break;
4464 		case OFFSETEVEN2R: rst = 0; break;
4465 		case OFFSETODD2R: rst = 0; break;
4466 		case OFFSETEVEN2G: rst = 0; break;
4467 		case OFFSETODD2G: rst = 0; break;
4468 		case OFFSETEVEN2B: rst = 0; break;
4469 		case OFFSETODD2B: rst = 0; break;
4470 		case GAINHEIGHT: rst = 10; break;
4471 		case GAINTARGETFACTOR: rst = 90; break;
4472 		case CALIBPAGON: rst = 0; break;
4473 		case PAGR: rst = 3; break;
4474 		case PAGG: rst = 3; break;
4475 		case PAGB: rst = 3; break;
4476 		case CALIBGAIN1ON: rst = 1; break;
4477 		case GAIN1R: rst = 28; break;
4478 		case GAIN1G: rst = 22; break;
4479 		case GAIN1B: rst = 21; break;
4480 		case CALIBGAIN2ON: rst = 0; break;
4481 		case GAIN2R: rst = 4; break;
4482 		case GAIN2G: rst = 4; break;
4483 		case GAIN2B: rst = 4; break;
4484 		case TOTSHADING: rst = 0; break;
4485 		case BSHADINGON: rst = -2; break;
4486 		case BSHADINGHEIGHT: rst = 10; break;
4487 		case BSHADINGPREDIFFR: rst = 2; break;
4488 		case BSHADINGPREDIFFG: rst = 2; break;
4489 		case BSHADINGPREDIFFB: rst = 2; break;
4490 		case BSHADINGDEFCUTOFF: rst = 0; break;
4491 		case WSHADINGON: rst = 3; break;
4492 		case WSHADINGHEIGHT: rst = 24; break;
4493 		case WSHADINGPREDIFFR: rst = -1; break;
4494 		case WSHADINGPREDIFFG: rst = -1; break;
4495 		case WSHADINGPREDIFFB: rst = -1; break;
4496 	}
4497 
4498 	return rst;
4499 }
4500 
hp4370_calibreflective(int option,int defvalue)4501 static int hp4370_calibreflective(int option, int defvalue)
4502 {
4503 	int rst = defvalue;
4504 	switch(option)
4505 	{
4506 		case WSTRIPXPOS: rst = 0; break;
4507 		case WSTRIPYPOS: rst = 0; break;
4508 		case BSTRIPXPOS: rst = 0; break;
4509 		case BSTRIPYPOS: rst = 0; break;
4510 		case BREFR: rst = 10; break;
4511 		case BREFG: rst = 10; break;
4512 		case BREFB: rst = 10; break;
4513 		case REFBITDEPTH: rst = 8; break;
4514 		case OFFSETHEIGHT: rst = 10; break;
4515 		case OFFSETNSIGMA: rst = 2; break;
4516 		case OFFSETTARGETMAX: rst = 50; break;
4517 		case OFFSETTARGETMIN: rst = 2; break;
4518 		case OFFSETAVGTARGETR: rst = 10; break;
4519 		case OFFSETAVGTARGETG: rst = 10; break;
4520 		case OFFSETAVGTARGETB: rst = 10; break;
4521 		case ADCOFFEVENODD: rst = 1; break;
4522 		case CALIBOFFSET1ON: rst = 2; break;
4523 		case ADCOFFQUICKWAY: rst = 1; break;
4524 		case ADCOFFPREDICTSTART: rst = 300; break;
4525 		case ADCOFFPREDICTEND: rst = 500; break;
4526 		case OFFSETTUNESTEP1: rst = 5; break;
4527 		case OFFSETBOUNDARYRATIO1: rst = 100; break;
4528 		case OFFSETAVGRATIO1: rst = 100; break;
4529 		case OFFSETEVEN1R: rst = 305; break;
4530 		case OFFSETODD1R: rst = 3305; break;
4531 		case OFFSETEVEN1G: rst = 313; break;
4532 		case OFFSETODD1G: rst = 313; break;
4533 		case OFFSETEVEN1B: rst = 317; break;
4534 		case OFFSETODD1B: rst = 317; break;
4535 		case ADCOFFPREDICTR: rst = 500; break;
4536 		case ADCOFFPREDICTG: rst = 500; break;
4537 		case ADCOFFPREDICTB: rst = 500; break;
4538 		case ADCOFFEVEN1R_1ST: rst = 344; break;
4539 		case ADCOFFODD1R_1ST: rst = 344; break;
4540 		case ADCOFFEVEN1G_1ST: rst = 328; break;
4541 		case ADCOFFODD1G_1ST: rst = 328; break;
4542 		case ADCOFFEVEN1B_1ST: rst = 341; break;
4543 		case ADCOFFODD1B_1ST: rst = 341; break;
4544 		case PEAKR: rst = 159; break;
4545 		case PEAKG: rst = 191; break;
4546 		case PEAKB: rst = 191; break;
4547 		case MINR: rst = 146; break;
4548 		case MING: rst = 180; break;
4549 		case MINB: rst = 179; break;
4550 		case CALIBOFFSET2ON: rst = 0; break;
4551 		case OFFSETTUNESTEP2: rst = 1; break;
4552 		case OFFSETBOUNDARYRATIO2: rst = 100; break;
4553 		case OFFSETAVGRATIO2: rst = 100; break;
4554 		case OFFSETEVEN2R: rst = 0; break;
4555 		case OFFSETODD2R: rst = 0; break;
4556 		case OFFSETEVEN2G: rst = 0; break;
4557 		case OFFSETODD2G: rst = 0; break;
4558 		case OFFSETEVEN2B: rst = 0; break;
4559 		case OFFSETODD2B: rst = 0; break;
4560 		case GAINHEIGHT: rst = 10; break;
4561 		case GAINTARGETFACTOR: rst = 80; break;
4562 		case CALIBPAGON: rst = 0; break;
4563 		case HIPAGR: rst = 3; break;
4564 		case HIPAGG: rst = 0; break;
4565 		case HIPAGB: rst = 0; break;
4566 		case PAGR: rst = 3; break;
4567 		case PAGG: rst = 3; break;
4568 		case PAGB: rst = 3; break;
4569 		case LOPAGR: rst = 3; break;
4570 		case LOPAGG: rst = 3; break;
4571 		case LOPAGB: rst = 3; break;
4572 		case CALIBGAIN1ON: rst = 1; break;
4573 		case GAIN1R: rst = 10; break;
4574 		case GAIN1G: rst = 2; break;
4575 		case GAIN1B: rst = 1; break;
4576 		case CALIBGAIN2ON: rst = 0; break;
4577 		case GAIN2R: rst = 4; break;
4578 		case GAIN2G: rst = 4; break;
4579 		case GAIN2B: rst = 4; break;
4580 		case TOTSHADING: rst = 0; break;
4581 		case BSHADINGON: rst = -2; break;
4582 		case BSHADINGHEIGHT: rst = 10; break;
4583 		case BSHADINGPREDIFFR: rst = 2; break;
4584 		case BSHADINGPREDIFFG: rst = 2; break;
4585 		case BSHADINGPREDIFFB: rst = 2; break;
4586 		case BSHADINGDEFCUTOFF: rst = 0; break;
4587 		case WSHADINGON: rst = 3; break;
4588 		case WSHADINGHEIGHT: rst = 24; break;
4589 		case WSHADINGPREDIFFR: rst = -1; break;
4590 		case WSHADINGPREDIFFG: rst = -1; break;
4591 		case WSHADINGPREDIFFB: rst = -1; break;
4592 	}
4593 
4594 	return rst;
4595 }
4596 
fc_calibreflective(int option,int defvalue)4597 static int fc_calibreflective(int option, int defvalue)
4598 {
4599 	int rst;
4600 
4601 	switch(RTS_Debug->dev_model)
4602 	{
4603 		case UA4900: rst = ua4900_calibreflective(option, defvalue); break;
4604 		case HPG2710:
4605 		case HP3800: rst = hp3800_calibreflective(option, defvalue); break;
4606 		case HPG3010:
4607 		case HPG3110:
4608 		case HP4370: rst = hp4370_calibreflective(option, defvalue); break;
4609 		default    : rst = hp3970_calibreflective(option, defvalue); break;
4610 	}
4611 
4612 	return rst;
4613 }
4614 
ua4900_calibtransparent(int option,int defvalue)4615 static int ua4900_calibtransparent(int option, int defvalue)
4616 {
4617 	int rst = defvalue;
4618 
4619 	switch(option)
4620 	{
4621 		case WSTRIPXPOS: rst = 0; break;
4622 		case WSTRIPYPOS: rst = 12100; break;
4623 		case BSTRIPXPOS: rst = 0; break;
4624 		case BSTRIPYPOS: rst = 0; break;
4625 		case BREFR: rst = 2; break;
4626 		case BREFG: rst = 2; break;
4627 		case BREFB: rst = 2; break;
4628 		case REFBITDEPTH: rst = 8; break;
4629 		case OFFSETHEIGHT: rst = 10; break;
4630 		case OFFSETNSIGMA: rst = 2; break;
4631 		case OFFSETTARGETMAX: rst = 50; break;
4632 		case OFFSETTARGETMIN: rst = 2; break;
4633 		case OFFSETAVGTARGETR: rst = 13; break;
4634 		case OFFSETAVGTARGETG: rst = 13; break;
4635 		case OFFSETAVGTARGETB: rst = 13; break;
4636 		case ADCOFFEVENODD: rst = 1; break;
4637 		case CALIBOFFSET1ON: rst = 2; break;
4638 		case ADCOFFQUICKWAY: rst = 1; break;
4639 		case ADCOFFPREDICTSTART: rst = 200; break;
4640 		case ADCOFFPREDICTEND: rst = 500; break;
4641 		case OFFSETTUNESTEP1: rst = 5; break;
4642 		case OFFSETBOUNDARYRATIO1: rst = 100; break;
4643 		case OFFSETAVGRATIO1: rst = 100; break;
4644 		case OFFSETEVEN1R: rst = 321; break;
4645 		case OFFSETODD1R: rst = 321; break;
4646 		case OFFSETEVEN1G: rst = 321; break;
4647 		case OFFSETODD1G: rst = 321; break;
4648 		case OFFSETEVEN1B: rst = 321; break;
4649 		case OFFSETODD1B: rst = 321; break;
4650 		case ADCOFFPREDICTR: rst = 333; break;
4651 		case ADCOFFPREDICTG: rst = 313; break;
4652 		case ADCOFFPREDICTB: rst = 317; break;
4653 		case ADCOFFEVEN1R_1ST: rst = 69; break;
4654 		case ADCOFFODD1R_1ST: rst = 69; break;
4655 		case ADCOFFEVEN1G_1ST: rst = 87; break;
4656 		case ADCOFFODD1G_1ST: rst = 87; break;
4657 		case ADCOFFEVEN1B_1ST: rst = 106; break;
4658 		case ADCOFFODD1B_1ST: rst = 106; break;
4659 		case PEAKR: rst = 177; break;
4660 		case PEAKG: rst = 177; break;
4661 		case PEAKB: rst = 177; break;
4662 		case MINR: rst = 136; break;
4663 		case MING: rst = 136; break;
4664 		case MINB: rst = 136; break;
4665 		case CALIBOFFSET2ON: rst = 0; break;
4666 		case OFFSETTUNESTEP2: rst = 1; break;
4667 		case OFFSETBOUNDARYRATIO2: rst = 100; break;
4668 		case OFFSETAVGRATIO2: rst = 100; break;
4669 		case OFFSETEVEN2R: rst = 0; break;
4670 		case OFFSETODD2R: rst = 0; break;
4671 		case OFFSETEVEN2G: rst = 0; break;
4672 		case OFFSETODD2G: rst = 0; break;
4673 		case OFFSETEVEN2B: rst = 0; break;
4674 		case OFFSETODD2B: rst = 0; break;
4675 		case GAINHEIGHT: rst = 30; break;
4676 		case GAINTARGETFACTOR: rst = 90; break;
4677 		case CALIBPAGON: rst = 0; break;
4678 		case PAGR: rst = 0; break;
4679 		case PAGG: rst = 0; break;
4680 		case PAGB: rst = 0; break;
4681 		case CALIBGAIN1ON: rst = 1; break;
4682 		case GAIN1R: rst = 24; break;
4683 		case GAIN1G: rst = 21; break;
4684 		case GAIN1B: rst = 19; break;
4685 		case CALIBGAIN2ON: rst = 0; break;
4686 		case GAIN2R: rst = 8; break;
4687 		case GAIN2G: rst = 8; break;
4688 		case GAIN2B: rst = 8; break;
4689 		case TOTSHADING: rst = 0; break;
4690 		case BSHADINGON: rst = 2; break;
4691 		case BSHADINGHEIGHT: rst = 10; break;
4692 		case BSHADINGPREDIFFR: rst = 2; break;
4693 		case BSHADINGPREDIFFG: rst = 2; break;
4694 		case BSHADINGPREDIFFB: rst = 2; break;
4695 		case BSHADINGDEFCUTOFF: rst = 0; break;
4696 		case WSHADINGON: rst = 3; break;
4697 		case WSHADINGHEIGHT: rst = 24; break;
4698 		case WSHADINGPREDIFFR: rst = -1; break;
4699 		case WSHADINGPREDIFFG: rst = -1; break;
4700 		case WSHADINGPREDIFFB: rst = -1; break;
4701 	}
4702 
4703 	return rst;
4704 }
4705 
hp3800_calibtransparent(int option,int defvalue)4706 static int hp3800_calibtransparent(int option, int defvalue)
4707 {
4708 	int rst = defvalue;
4709 	switch(option)
4710 	{
4711 		case WSTRIPXPOS: rst = 0; break;
4712 		case WSTRIPYPOS: rst = 4155; break;
4713 		case BSTRIPXPOS: rst = 0; break;
4714 		case BSTRIPYPOS: rst = 0; break;
4715 		case BREFR: rst = 2; break;
4716 		case BREFG: rst = 2; break;
4717 		case BREFB: rst = 2; break;
4718 		case REFBITDEPTH: rst = 8; break;
4719 		case OFFSETHEIGHT: rst = 10; break;
4720 		case OFFSETNSIGMA: rst = 2; break;
4721 		case OFFSETTARGETMAX: rst = 50; break;
4722 		case OFFSETTARGETMIN: rst = 2; break;
4723 		case OFFSETAVGTARGETR: rst = 10; break;
4724 		case OFFSETAVGTARGETG: rst = 10; break;
4725 		case OFFSETAVGTARGETB: rst = 10; break;
4726 		case ADCOFFEVENODD: rst = 1; break;
4727 		case CALIBOFFSET1ON: rst = 2; break;
4728 		case ADCOFFQUICKWAY: rst = 1; break;
4729 		case ADCOFFPREDICTSTART: rst = 200; break;
4730 		case ADCOFFPREDICTEND: rst = 500; break;
4731 		case OFFSETTUNESTEP1: rst = 5; break;
4732 		case OFFSETBOUNDARYRATIO1: rst = 100; break;
4733 		case OFFSETAVGRATIO1: rst = 100; break;
4734 		case OFFSETEVEN1R: rst = 310; break;
4735 		case OFFSETODD1R: rst = 310; break;
4736 		case OFFSETEVEN1G: rst = 299; break;
4737 		case OFFSETODD1G: rst = 299; break;
4738 		case OFFSETEVEN1B: rst = 309; break;
4739 		case OFFSETODD1B: rst = 309; break;
4740 		case ADCOFFPREDICTR: rst = 333; break;
4741 		case ADCOFFPREDICTG: rst = 313; break;
4742 		case ADCOFFPREDICTB: rst = 317; break;
4743 		case ADCOFFEVEN1R_1ST: rst = 69; break;
4744 		case ADCOFFODD1R_1ST: rst = 69; break;
4745 		case ADCOFFEVEN1G_1ST: rst = 87; break;
4746 		case ADCOFFODD1G_1ST: rst = 87; break;
4747 		case ADCOFFEVEN1B_1ST: rst = 106; break;
4748 		case ADCOFFODD1B_1ST: rst = 106; break;
4749 		case PEAKR: rst = 67; break;
4750 		case PEAKG: rst = 61; break;
4751 		case PEAKB: rst = 57; break;
4752 		case MINR: rst = 10; break;
4753 		case MING: rst = 10; break;
4754 		case MINB: rst = 10; break;
4755 		case CALIBOFFSET2ON: rst = 0; break;
4756 		case OFFSETTUNESTEP2: rst = 1; break;
4757 		case OFFSETBOUNDARYRATIO2: rst = 100; break;
4758 		case OFFSETAVGRATIO2: rst = 100; break;
4759 		case OFFSETEVEN2R: rst = 0; break;
4760 		case OFFSETODD2R: rst = 0; break;
4761 		case OFFSETEVEN2G: rst = 0; break;
4762 		case OFFSETODD2G: rst = 0; break;
4763 		case OFFSETEVEN2B: rst = 0; break;
4764 		case OFFSETODD2B: rst = 0; break;
4765 		case GAINHEIGHT: rst = 30; break;
4766 		case GAINTARGETFACTOR: rst = 90; break;
4767 		case CALIBPAGON: rst = 0; break;
4768 		case PAGR: rst = 3; break;
4769 		case PAGG: rst = 3; break;
4770 		case PAGB: rst = 2; break;
4771 		case CALIBGAIN1ON: rst = 1; break;
4772 		case GAIN1R: rst = 9; break;
4773 		case GAIN1G: rst = 12; break;
4774 		case GAIN1B: rst = 10; break;
4775 		case CALIBGAIN2ON: rst = 0; break;
4776 		case GAIN2R: rst = 4; break;
4777 		case GAIN2G: rst = 4; break;
4778 		case GAIN2B: rst = 4; break;
4779 		case TOTSHADING: rst = 0; break;
4780 		case BSHADINGON: rst = -3; break;
4781 		case BSHADINGHEIGHT: rst = 30; break;
4782 		case BSHADINGPREDIFFR: rst = 2; break;
4783 		case BSHADINGPREDIFFG: rst = 2; break;
4784 		case BSHADINGPREDIFFB: rst = 2; break;
4785 		case BSHADINGDEFCUTOFF: rst = 0; break;
4786 		case WSHADINGON: rst = 3; break;
4787 		case WSHADINGHEIGHT: rst = 24; break;
4788 		case WSHADINGPREDIFFR: rst = -1; break;
4789 		case WSHADINGPREDIFFG: rst = -1; break;
4790 		case WSHADINGPREDIFFB: rst = -1; break;
4791 	}
4792 
4793 	return rst;
4794 }
4795 
hp3970_calibtransparent(int option,int defvalue)4796 static int hp3970_calibtransparent(int option, int defvalue)
4797 {
4798 	int rst = defvalue;
4799 	switch(option)
4800 	{
4801 		case WSTRIPXPOS: rst = 0; break;
4802 		case WSTRIPYPOS: rst = 7500; break;
4803 		case BSTRIPXPOS: rst = 0; break;
4804 		case BSTRIPYPOS: rst = 0; break;
4805 		case BREFR: rst = 2; break;
4806 		case BREFG: rst = 2; break;
4807 		case BREFB: rst = 2; break;
4808 		case REFBITDEPTH: rst = 8; break;
4809 		case OFFSETHEIGHT: rst = 10; break;
4810 		case OFFSETNSIGMA: rst = 2; break;
4811 		case OFFSETTARGETMAX: rst = 50; break;
4812 		case OFFSETTARGETMIN: rst = 2; break;
4813 		case OFFSETAVGTARGETR: rst = 10; break;
4814 		case OFFSETAVGTARGETG: rst = 10; break;
4815 		case OFFSETAVGTARGETB: rst = 10; break;
4816 		case ADCOFFEVENODD: rst = 1; break;
4817 		case CALIBOFFSET1ON: rst = 2; break;
4818 		case ADCOFFQUICKWAY: rst = 1; break;
4819 		case ADCOFFPREDICTSTART: rst = 200; break;
4820 		case ADCOFFPREDICTEND: rst = 500; break;
4821 		case OFFSETTUNESTEP1: rst = 5; break;
4822 		case OFFSETBOUNDARYRATIO1: rst = 100; break;
4823 		case OFFSETAVGRATIO1: rst = 100; break;
4824 		case OFFSETEVEN1R: rst = 323; break;
4825 		case OFFSETODD1R: rst = 323; break;
4826 		case OFFSETEVEN1G: rst = 327; break;
4827 		case OFFSETODD1G: rst = 327; break;
4828 		case OFFSETEVEN1B: rst = 327; break;
4829 		case OFFSETODD1B: rst = 327; break;
4830 		case ADCOFFPREDICTR: rst = 333; break;
4831 		case ADCOFFPREDICTG: rst = 313; break;
4832 		case ADCOFFPREDICTB: rst = 317; break;
4833 		case ADCOFFEVEN1R_1ST: rst = 69; break;
4834 		case ADCOFFODD1R_1ST: rst = 69; break;
4835 		case ADCOFFEVEN1G_1ST: rst = 87; break;
4836 		case ADCOFFODD1G_1ST: rst = 87; break;
4837 		case ADCOFFEVEN1B_1ST: rst = 106; break;
4838 		case ADCOFFODD1B_1ST: rst = 106; break;
4839 		case PEAKR: rst = 42; break;
4840 		case PEAKG: rst = 55; break;
4841 		case PEAKB: rst = 53; break;
4842 		case MINR: rst = 31; break;
4843 		case MING: rst = 39; break;
4844 		case MINB: rst = 38; break;
4845 		case CALIBOFFSET2ON: rst = 0; break;
4846 		case OFFSETTUNESTEP2: rst = 1; break;
4847 		case OFFSETBOUNDARYRATIO2: rst = 100; break;
4848 		case OFFSETAVGRATIO2: rst = 100; break;
4849 		case OFFSETEVEN2R: rst = 0; break;
4850 		case OFFSETODD2R: rst = 0; break;
4851 		case OFFSETEVEN2G: rst = 0; break;
4852 		case OFFSETODD2G: rst = 0; break;
4853 		case OFFSETEVEN2B: rst = 0; break;
4854 		case OFFSETODD2B: rst = 0; break;
4855 		case GAINHEIGHT: rst = 30; break;
4856 		case GAINTARGETFACTOR: rst = 90; break;
4857 		case CALIBPAGON: rst = 0; break;
4858 		case PAGR: rst = 3; break;
4859 		case PAGG: rst = 3; break;
4860 		case PAGB: rst = 2; break;
4861 		case CALIBGAIN1ON: rst = 1; break;
4862 		case GAIN1R: rst = 21; break;
4863 		case GAIN1G: rst = 14; break;
4864 		case GAIN1B: rst = 12; break;
4865 		case CALIBGAIN2ON: rst = 0; break;
4866 		case GAIN2R: rst = 4; break;
4867 		case GAIN2G: rst = 4; break;
4868 		case GAIN2B: rst = 4; break;
4869 		case TOTSHADING: rst = 0; break;
4870 		case BSHADINGON: rst = 1; break;
4871 		case BSHADINGHEIGHT: rst = 30; break;
4872 		case BSHADINGPREDIFFR: rst = 2; break;
4873 		case BSHADINGPREDIFFG: rst = 2; break;
4874 		case BSHADINGPREDIFFB: rst = 2; break;
4875 		case BSHADINGDEFCUTOFF: rst = 0; break;
4876 		case WSHADINGON: rst = 3; break;
4877 		case WSHADINGHEIGHT: rst = 24; break;
4878 		case WSHADINGPREDIFFR: rst = -1; break;
4879 		case WSHADINGPREDIFFG: rst = -1; break;
4880 		case WSHADINGPREDIFFB: rst = -1; break;
4881 	}
4882 
4883 	return rst;
4884 }
4885 
hp4370_calibtransparent(int option,int defvalue)4886 static int hp4370_calibtransparent(int option, int defvalue)
4887 {
4888 	int rst = defvalue;
4889 	switch(option)
4890 	{
4891 		case WSTRIPXPOS: rst = 0; break;
4892 		case WSTRIPYPOS: rst = 6580; break;
4893 		case BSTRIPXPOS: rst = 0; break;
4894 		case BSTRIPYPOS: rst = 0; break;
4895 		case BREFR: rst = 2; break;
4896 		case BREFG: rst = 2; break;
4897 		case BREFB: rst = 2; break;
4898 		case REFBITDEPTH: rst = 8; break;
4899 		case OFFSETHEIGHT: rst = 10; break;
4900 		case OFFSETNSIGMA: rst = 2; break;
4901 		case OFFSETTARGETMAX: rst = 50; break;
4902 		case OFFSETTARGETMIN: rst = 2; break;
4903 		case OFFSETAVGTARGETR: rst = 10; break;
4904 		case OFFSETAVGTARGETG: rst = 10; break;
4905 		case OFFSETAVGTARGETB: rst = 10; break;
4906 		case ADCOFFEVENODD: rst = 1; break;
4907 		case CALIBOFFSET1ON: rst = 2; break;
4908 		case ADCOFFQUICKWAY: rst = 1; break;
4909 		case ADCOFFPREDICTSTART: rst = 200; break;
4910 		case ADCOFFPREDICTEND: rst = 500; break;
4911 		case OFFSETTUNESTEP1: rst = 5; break;
4912 		case OFFSETBOUNDARYRATIO1: rst = 100; break;
4913 		case OFFSETAVGRATIO1: rst = 100; break;
4914 		case OFFSETEVEN1R: rst = 315; break;
4915 		case OFFSETODD1R: rst = 321; break;
4916 		case OFFSETEVEN1G: rst = 321; break;
4917 		case OFFSETODD1G: rst = 324; break;
4918 		case OFFSETEVEN1B: rst = 324; break;
4919 		case OFFSETODD1B: rst = 327; break;
4920 		case ADCOFFPREDICTR: rst = 333; break;
4921 		case ADCOFFPREDICTG: rst = 313; break;
4922 		case ADCOFFPREDICTB: rst = 317; break;
4923 		case ADCOFFEVEN1R_1ST: rst = 69; break;
4924 		case ADCOFFODD1R_1ST: rst = 69; break;
4925 		case ADCOFFEVEN1G_1ST: rst = 87; break;
4926 		case ADCOFFODD1G_1ST: rst = 87; break;
4927 		case ADCOFFEVEN1B_1ST: rst = 106; break;
4928 		case ADCOFFODD1B_1ST: rst = 106; break;
4929 		case PEAKR: rst = 62; break;
4930 		case PEAKG: rst = 66; break;
4931 		case PEAKB: rst = 54; break;
4932 		case MINR: rst = 42; break;
4933 		case MING: rst = 45; break;
4934 		case MINB: rst = 45; break;
4935 		case CALIBOFFSET2ON: rst = 0; break;
4936 		case OFFSETTUNESTEP2: rst = 1; break;
4937 		case OFFSETBOUNDARYRATIO2: rst = 100; break;
4938 		case OFFSETAVGRATIO2: rst = 100; break;
4939 		case OFFSETEVEN2R: rst = 0; break;
4940 		case OFFSETODD2R: rst = 0; break;
4941 		case OFFSETEVEN2G: rst = 0; break;
4942 		case OFFSETODD2G: rst = 0; break;
4943 		case OFFSETEVEN2B: rst = 0; break;
4944 		case OFFSETODD2B: rst = 0; break;
4945 		case GAINHEIGHT: rst = 30; break;
4946 		case GAINTARGETFACTOR: rst = 80; break;
4947 		case CALIBPAGON: rst = 0; break;
4948 		case HIPAGR: rst = 3; break;
4949 		case HIPAGG: rst = 3; break;
4950 		case HIPAGB: rst = 2; break;
4951 		case LOPAGR: rst = 3; break;
4952 		case LOPAGG: rst = 3; break;
4953 		case LOPAGB: rst = 2; break;
4954 		case PAGR: rst = 3; break;
4955 		case PAGG: rst = 3; break;
4956 		case PAGB: rst = 2; break;
4957 		case CALIBGAIN1ON: rst = 1; break;
4958 		case GAIN1R: rst = 11; break;
4959 		case GAIN1G: rst = 9; break;
4960 		case GAIN1B: rst = 12; break;
4961 		case CALIBGAIN2ON: rst = 0; break;
4962 		case GAIN2R: rst = 4; break;
4963 		case GAIN2G: rst = 4; break;
4964 		case GAIN2B: rst = 4; break;
4965 		case TOTSHADING: rst = 0; break;
4966 		case BSHADINGON: rst = -2; break;
4967 		case BSHADINGHEIGHT: rst = 30; break;
4968 		case BSHADINGPREDIFFR: rst = 2; break;
4969 		case BSHADINGPREDIFFG: rst = 2; break;
4970 		case BSHADINGPREDIFFB: rst = 2; break;
4971 		case BSHADINGDEFCUTOFF: rst = 0; break;
4972 		case WSHADINGON: rst = 3; break;
4973 		case WSHADINGHEIGHT: rst = 24; break;
4974 		case WSHADINGPREDIFFR: rst = -1; break;
4975 		case WSHADINGPREDIFFG: rst = -1; break;
4976 		case WSHADINGPREDIFFB: rst = -1; break;
4977 	}
4978 
4979 	return rst;
4980 }
4981 
hpg3110_calibtransparent(int option,int defvalue)4982 static int hpg3110_calibtransparent(int option, int defvalue)
4983 {
4984 	int rst = defvalue;
4985 	switch(option)
4986 	{
4987 		case WSTRIPXPOS: rst = 0; break;
4988 		case WSTRIPYPOS: rst = 5100; break;
4989 		case BSTRIPXPOS: rst = 0; break;
4990 		case BSTRIPYPOS: rst = 0; break;
4991 		case BREFR: rst = 2; break;
4992 		case BREFG: rst = 2; break;
4993 		case BREFB: rst = 2; break;
4994 		case REFBITDEPTH: rst = 8; break;
4995 		case OFFSETHEIGHT: rst = 10; break;
4996 		case OFFSETNSIGMA: rst = 2; break;
4997 		case OFFSETTARGETMAX: rst = 50; break;
4998 		case OFFSETTARGETMIN: rst = 2; break;
4999 		case OFFSETAVGTARGETR: rst = 10; break;
5000 		case OFFSETAVGTARGETG: rst = 10; break;
5001 		case OFFSETAVGTARGETB: rst = 10; break;
5002 		case ADCOFFEVENODD: rst = 1; break;
5003 		case CALIBOFFSET1ON: rst = 2; break;
5004 		case ADCOFFQUICKWAY: rst = 1; break;
5005 		case ADCOFFPREDICTSTART: rst = 200; break;
5006 		case ADCOFFPREDICTEND: rst = 500; break;
5007 		case OFFSETTUNESTEP1: rst = 5; break;
5008 		case OFFSETBOUNDARYRATIO1: rst = 100; break;
5009 		case OFFSETAVGRATIO1: rst = 100; break;
5010 		case OFFSETEVEN1R: rst = 315; break;
5011 		case OFFSETODD1R: rst = 321; break;
5012 		case OFFSETEVEN1G: rst = 321; break;
5013 		case OFFSETODD1G: rst = 324; break;
5014 		case OFFSETEVEN1B: rst = 324; break;
5015 		case OFFSETODD1B: rst = 327; break;
5016 		case ADCOFFPREDICTR: rst = 333; break;
5017 		case ADCOFFPREDICTG: rst = 313; break;
5018 		case ADCOFFPREDICTB: rst = 317; break;
5019 		case ADCOFFEVEN1R_1ST: rst = 69; break;
5020 		case ADCOFFODD1R_1ST: rst = 69; break;
5021 		case ADCOFFEVEN1G_1ST: rst = 87; break;
5022 		case ADCOFFODD1G_1ST: rst = 87; break;
5023 		case ADCOFFEVEN1B_1ST: rst = 106; break;
5024 		case ADCOFFODD1B_1ST: rst = 106; break;
5025 		case PEAKR: rst = 62; break;
5026 		case PEAKG: rst = 66; break;
5027 		case PEAKB: rst = 54; break;
5028 		case MINR: rst = 42; break;
5029 		case MING: rst = 45; break;
5030 		case MINB: rst = 45; break;
5031 		case CALIBOFFSET2ON: rst = 0; break;
5032 		case OFFSETTUNESTEP2: rst = 1; break;
5033 		case OFFSETBOUNDARYRATIO2: rst = 100; break;
5034 		case OFFSETAVGRATIO2: rst = 100; break;
5035 		case OFFSETEVEN2R: rst = 0; break;
5036 		case OFFSETODD2R: rst = 0; break;
5037 		case OFFSETEVEN2G: rst = 0; break;
5038 		case OFFSETODD2G: rst = 0; break;
5039 		case OFFSETEVEN2B: rst = 0; break;
5040 		case OFFSETODD2B: rst = 0; break;
5041 		case GAINHEIGHT: rst = 30; break;
5042 		case GAINTARGETFACTOR: rst = 80; break;
5043 		case CALIBPAGON: rst = 0; break;
5044 		case HIPAGR: rst = 3; break;
5045 		case HIPAGG: rst = 3; break;
5046 		case HIPAGB: rst = 2; break;
5047 		case LOPAGR: rst = 3; break;
5048 		case LOPAGG: rst = 3; break;
5049 		case LOPAGB: rst = 2; break;
5050 		case PAGR: rst = 3; break;
5051 		case PAGG: rst = 3; break;
5052 		case PAGB: rst = 2; break;
5053 		case CALIBGAIN1ON: rst = 1; break;
5054 		case GAIN1R: rst = 11; break;
5055 		case GAIN1G: rst = 9; break;
5056 		case GAIN1B: rst = 12; break;
5057 		case CALIBGAIN2ON: rst = 0; break;
5058 		case GAIN2R: rst = 4; break;
5059 		case GAIN2G: rst = 4; break;
5060 		case GAIN2B: rst = 4; break;
5061 		case TOTSHADING: rst = 0; break;
5062 		case BSHADINGON: rst = -2; break;
5063 		case BSHADINGHEIGHT: rst = 30; break;
5064 		case BSHADINGPREDIFFR: rst = 2; break;
5065 		case BSHADINGPREDIFFG: rst = 2; break;
5066 		case BSHADINGPREDIFFB: rst = 2; break;
5067 		case BSHADINGDEFCUTOFF: rst = 0; break;
5068 		case WSHADINGON: rst = 3; break;
5069 		case WSHADINGHEIGHT: rst = 24; break;
5070 		case WSHADINGPREDIFFR: rst = -1; break;
5071 		case WSHADINGPREDIFFG: rst = -1; break;
5072 		case WSHADINGPREDIFFB: rst = -1; break;
5073 	}
5074 
5075 	return rst;
5076 }
5077 
fc_calibtransparent(int option,int defvalue)5078 static int fc_calibtransparent(int option, int defvalue)
5079 {
5080 	int rst;
5081 
5082 	switch(RTS_Debug->dev_model)
5083 	{
5084 		case UA4900: rst = ua4900_calibtransparent(option, defvalue); break;
5085 		case HPG2710:
5086 		case HP3800: rst = hp3800_calibtransparent(option, defvalue); break;
5087 		case HPG3010:
5088 		case HP4370: rst = hp4370_calibtransparent(option, defvalue); break;
5089 		case HPG3110: rst = hpg3110_calibtransparent(option, defvalue); break;
5090 		default    : rst = hp3970_calibtransparent(option, defvalue); break;
5091 	}
5092 
5093 	return rst;
5094 }
5095 
ua4900_calibnegative(int option,int defvalue)5096 static int ua4900_calibnegative(int option, int defvalue)
5097 {
5098 	int rst = defvalue;
5099 
5100 	switch(option)
5101 	{
5102 		case WSTRIPXPOS: rst = 0; break;
5103 		case WSTRIPYPOS: rst = 12100; break;
5104 		case BSTRIPXPOS: rst = 0; break;
5105 		case BSTRIPYPOS: rst = 0; break;
5106 		case BREFR: rst = 2; break;
5107 		case BREFG: rst = 2; break;
5108 		case BREFB: rst = 2; break;
5109 		case REFBITDEPTH: rst = 8; break;
5110 		case OFFSETHEIGHT: rst = 10; break;
5111 		case OFFSETNSIGMA: rst = 2; break;
5112 		case OFFSETTARGETMAX: rst = 50; break;
5113 		case OFFSETTARGETMIN: rst = 2; break;
5114 		case OFFSETAVGTARGETR: rst = 5; break;
5115 		case OFFSETAVGTARGETG: rst = 5; break;
5116 		case OFFSETAVGTARGETB: rst = 5; break;
5117 		case ADCOFFEVENODD: rst = 1; break;
5118 		case CALIBOFFSET1ON: rst = 2; break;
5119 		case ADCOFFQUICKWAY: rst = 1; break;
5120 		case ADCOFFPREDICTSTART: rst = 200; break;
5121 		case ADCOFFPREDICTEND: rst = 500; break;
5122 		case OFFSETTUNESTEP1: rst = 5; break;
5123 		case OFFSETBOUNDARYRATIO1: rst = 100; break;
5124 		case OFFSETAVGRATIO1: rst = 100; break;
5125 		case OFFSETEVEN1R: rst = 283; break;
5126 		case OFFSETODD1R: rst = 283; break;
5127 		case OFFSETEVEN1G: rst = 279; break;
5128 		case OFFSETODD1G: rst = 279; break;
5129 		case OFFSETEVEN1B: rst = 295; break;
5130 		case OFFSETODD1B: rst = 295; break;
5131 		case ADCOFFPREDICTR: rst = 333; break;
5132 		case ADCOFFPREDICTG: rst = 313; break;
5133 		case ADCOFFPREDICTB: rst = 317; break;
5134 		case ADCOFFEVEN1R_1ST: rst = 69; break;
5135 		case ADCOFFODD1R_1ST: rst = 69; break;
5136 		case ADCOFFEVEN1G_1ST: rst = 87; break;
5137 		case ADCOFFODD1G_1ST: rst = 87; break;
5138 		case ADCOFFEVEN1B_1ST: rst = 106; break;
5139 		case ADCOFFODD1B_1ST: rst = 106; break;
5140 		case PEAKR: rst = 113; break;
5141 		case PEAKG: rst = 145; break;
5142 		case PEAKB: rst = 126; break;
5143 		case MINR: rst = 80; break;
5144 		case MING: rst = 105; break;
5145 		case MINB: rst = 96; break;
5146 		case CALIBOFFSET2ON: rst = 0; break;
5147 		case OFFSETTUNESTEP2: rst = 1; break;
5148 		case OFFSETBOUNDARYRATIO2: rst = 100; break;
5149 		case OFFSETAVGRATIO2: rst = 100; break;
5150 		case OFFSETEVEN2R: rst = 0; break;
5151 		case OFFSETODD2R: rst = 0; break;
5152 		case OFFSETEVEN2G: rst = 0; break;
5153 		case OFFSETODD2G: rst = 0; break;
5154 		case OFFSETEVEN2B: rst = 0; break;
5155 		case OFFSETODD2B: rst = 0; break;
5156 		case GAINHEIGHT: rst = 10; break;
5157 		case GAINTARGETFACTOR: rst = 90; break;
5158 		case CALIBPAGON: rst = 0; break;
5159 		case PAGR: rst = 0; break;
5160 		case PAGG: rst = 0; break;
5161 		case PAGB: rst = 0; break;
5162 		case CALIBGAIN1ON: rst = 1; break;
5163 		case GAIN1R: rst = 8; break;
5164 		case GAIN1G: rst = 8; break;
5165 		case GAIN1B: rst = 8; break;
5166 		case CALIBGAIN2ON: rst = 0; break;
5167 		case GAIN2R: rst = 8; break;
5168 		case GAIN2G: rst = 8; break;
5169 		case GAIN2B: rst = 8; break;
5170 		case TOTSHADING: rst = 0; break;
5171 		case BSHADINGON: rst = 2; break;
5172 		case BSHADINGHEIGHT: rst = 10; break;
5173 		case BSHADINGPREDIFFR: rst = 2; break;
5174 		case BSHADINGPREDIFFG: rst = 2; break;
5175 		case BSHADINGPREDIFFB: rst = 2; break;
5176 		case BSHADINGDEFCUTOFF: rst = 0; break;
5177 		case WSHADINGON: rst = 3; break;
5178 		case WSHADINGHEIGHT: rst = 24; break;
5179 		case WSHADINGPREDIFFR: rst = -1; break;
5180 		case WSHADINGPREDIFFG: rst = -1; break;
5181 		case WSHADINGPREDIFFB: rst = -1; break;
5182 	}
5183 
5184 	return rst;
5185 }
5186 
hp3800_calibnegative(int option,int defvalue)5187 static int hp3800_calibnegative(int option, int defvalue)
5188 {
5189 	int rst = defvalue;
5190 
5191 	switch(option)
5192 	{
5193 		case WSTRIPXPOS: rst = 0; break;
5194 		case WSTRIPYPOS: rst = 4155; break;
5195 		case BSTRIPXPOS: rst = 0; break;
5196 		case BSTRIPYPOS: rst = 0; break;
5197 		case BREFR: rst = 10; break;
5198 		case BREFG: rst = 10; break;
5199 		case BREFB: rst = 10; break;
5200 		case REFBITDEPTH: rst = 8; break;
5201 		case OFFSETHEIGHT: rst = 10; break;
5202 		case OFFSETNSIGMA: rst = 2; break;
5203 		case OFFSETTARGETMAX: rst = 50; break;
5204 		case OFFSETTARGETMIN: rst = 2; break;
5205 		case OFFSETAVGTARGETR: rst = 10; break;
5206 		case OFFSETAVGTARGETG: rst = 10; break;
5207 		case OFFSETAVGTARGETB: rst = 10; break;
5208 		case ADCOFFEVENODD: rst = 1; break;
5209 		case CALIBOFFSET1ON: rst = 2; break;
5210 		case ADCOFFQUICKWAY: rst = 1; break;
5211 		case ADCOFFPREDICTSTART: rst = 200; break;
5212 		case ADCOFFPREDICTEND: rst = 500; break;
5213 		case OFFSETTUNESTEP1: rst = 5; break;
5214 		case OFFSETBOUNDARYRATIO1: rst = 100; break;
5215 		case OFFSETAVGRATIO1: rst = 100; break;
5216 		case OFFSETEVEN1R: rst = 315; break;
5217 		case OFFSETODD1R: rst = 315; break;
5218 		case OFFSETEVEN1G: rst = 307; break;
5219 		case OFFSETODD1G: rst = 304; break;
5220 		case OFFSETEVEN1B: rst = 309; break;
5221 		case OFFSETODD1B: rst = 309; break;
5222 		case ADCOFFPREDICTR: rst = 333; break;
5223 		case ADCOFFPREDICTG: rst = 313; break;
5224 		case ADCOFFPREDICTB: rst = 317; break;
5225 		case ADCOFFEVEN1R_1ST: rst = 69; break;
5226 		case ADCOFFODD1R_1ST: rst = 69; break;
5227 		case ADCOFFEVEN1G_1ST: rst = 87; break;
5228 		case ADCOFFODD1G_1ST: rst = 87; break;
5229 		case ADCOFFEVEN1B_1ST: rst = 106; break;
5230 		case ADCOFFODD1B_1ST: rst = 106; break;
5231 		case PEAKR: rst = 37; break;
5232 		case PEAKG: rst = 234; break;
5233 		case PEAKB: rst = 202; break;
5234 		case MINR: rst = 32; break;
5235 		case MING: rst = 195; break;
5236 		case MINB: rst = 166; break;
5237 		case CALIBOFFSET2ON: rst = 0; break;
5238 		case OFFSETTUNESTEP2: rst = 1; break;
5239 		case OFFSETBOUNDARYRATIO2: rst = 100; break;
5240 		case OFFSETAVGRATIO2: rst = 100; break;
5241 		case OFFSETEVEN2R: rst = 0; break;
5242 		case OFFSETODD2R: rst = 0; break;
5243 		case OFFSETEVEN2G: rst = 0; break;
5244 		case OFFSETODD2G: rst = 0; break;
5245 		case OFFSETEVEN2B: rst = 0; break;
5246 		case OFFSETODD2B: rst = 0; break;
5247 		case GAINHEIGHT: rst = 30; break;
5248 		case GAINTARGETFACTOR: rst = 90; break;
5249 		case CALIBPAGON: rst = 0; break;
5250 		case PAGR: rst = 3; break;
5251 		case PAGG: rst = 3; break;
5252 		case PAGB: rst = 3; break;
5253 		case CALIBGAIN1ON: rst = 1; break;
5254 		case GAIN1R: rst = 30; break;
5255 		case GAIN1G: rst = 3; break;
5256 		case GAIN1B: rst = 0; break;
5257 		case CALIBGAIN2ON: rst = 0; break;
5258 		case GAIN2R: rst = 4; break;
5259 		case GAIN2G: rst = 4; break;
5260 		case GAIN2B: rst = 4; break;
5261 		case TOTSHADING: rst = 0; break;
5262 		case BSHADINGON: rst = -2; break;
5263 		case BSHADINGHEIGHT: rst = 30; break;
5264 		case BSHADINGPREDIFFR: rst = 2; break;
5265 		case BSHADINGPREDIFFG: rst = 2; break;
5266 		case BSHADINGPREDIFFB: rst = 2; break;
5267 		case BSHADINGDEFCUTOFF: rst = 0; break;
5268 		case WSHADINGON: rst = 3; break;
5269 		case WSHADINGHEIGHT: rst = 24; break;
5270 		case WSHADINGPREDIFFR: rst = -1; break;
5271 		case WSHADINGPREDIFFG: rst = -1; break;
5272 		case WSHADINGPREDIFFB: rst = -1; break;
5273 	}
5274 
5275 	return rst;
5276 }
5277 
hp3970_calibnegative(int option,int defvalue)5278 static int hp3970_calibnegative(int option, int defvalue)
5279 {
5280 	int rst = defvalue;
5281 
5282 	switch(option)
5283 	{
5284 		case WSTRIPXPOS: rst = 0; break;
5285 		case WSTRIPYPOS: rst = 7500; break;
5286 		case BSTRIPXPOS: rst = 0; break;
5287 		case BSTRIPYPOS: rst = 0; break;
5288 		case BREFR: rst = 10; break;
5289 		case BREFG: rst = 10; break;
5290 		case BREFB: rst = 10; break;
5291 		case REFBITDEPTH: rst = 8; break;
5292 		case OFFSETHEIGHT: rst = 10; break;
5293 		case OFFSETNSIGMA: rst = 2; break;
5294 		case OFFSETTARGETMAX: rst = 50; break;
5295 		case OFFSETTARGETMIN: rst = 2; break;
5296 		case OFFSETAVGTARGETR: rst = 10; break;
5297 		case OFFSETAVGTARGETG: rst = 10; break;
5298 		case OFFSETAVGTARGETB: rst = 10; break;
5299 		case ADCOFFEVENODD: rst = 1; break;
5300 		case CALIBOFFSET1ON: rst = 2; break;
5301 		case ADCOFFQUICKWAY: rst = 1; break;
5302 		case ADCOFFPREDICTSTART: rst = 200; break;
5303 		case ADCOFFPREDICTEND: rst = 500; break;
5304 		case OFFSETTUNESTEP1: rst = 5; break;
5305 		case OFFSETBOUNDARYRATIO1: rst = 100; break;
5306 		case OFFSETAVGRATIO1: rst = 100; break;
5307 		case OFFSETEVEN1R: rst = 294; break;
5308 		case OFFSETODD1R: rst = 294; break;
5309 		case OFFSETEVEN1G: rst = 276; break;
5310 		case OFFSETODD1G: rst = 276; break;
5311 		case OFFSETEVEN1B: rst = 266; break;
5312 		case OFFSETODD1B: rst = 266; break;
5313 		case ADCOFFPREDICTR: rst = 333; break;
5314 		case ADCOFFPREDICTG: rst = 313; break;
5315 		case ADCOFFPREDICTB: rst = 317; break;
5316 		case ADCOFFEVEN1R_1ST: rst = 69; break;
5317 		case ADCOFFODD1R_1ST: rst = 69; break;
5318 		case ADCOFFEVEN1G_1ST: rst = 87; break;
5319 		case ADCOFFODD1G_1ST: rst = 87; break;
5320 		case ADCOFFEVEN1B_1ST: rst = 106; break;
5321 		case ADCOFFODD1B_1ST: rst = 106; break;
5322 		case PEAKR: rst = 33; break;
5323 		case PEAKG: rst = 75; break;
5324 		case PEAKB: rst = 105; break;
5325 		case MINR: rst = 19; break;
5326 		case MING: rst = 34; break;
5327 		case MINB: rst = 42; break;
5328 		case CALIBOFFSET2ON: rst = 0; break;
5329 		case OFFSETTUNESTEP2: rst = 1; break;
5330 		case OFFSETBOUNDARYRATIO2: rst = 100; break;
5331 		case OFFSETAVGRATIO2: rst = 100; break;
5332 		case OFFSETEVEN2R: rst = 0; break;
5333 		case OFFSETODD2R: rst = 0; break;
5334 		case OFFSETEVEN2G: rst = 0; break;
5335 		case OFFSETODD2G: rst = 0; break;
5336 		case OFFSETEVEN2B: rst = 0; break;
5337 		case OFFSETODD2B: rst = 0; break;
5338 		case GAINHEIGHT: rst = 30; break;
5339 		case GAINTARGETFACTOR: rst = 90; break;
5340 		case CALIBPAGON: rst = 0; break;
5341 		case PAGR: rst = 3; break;
5342 		case PAGG: rst = 3; break;
5343 		case PAGB: rst = 3; break;
5344 		case CALIBGAIN1ON: rst = 1; break;
5345 		case GAIN1R: rst = 23; break;
5346 		case GAIN1G: rst = 18; break;
5347 		case GAIN1B: rst = 23; break;
5348 		case CALIBGAIN2ON: rst = 0; break;
5349 		case GAIN2R: rst = 4; break;
5350 		case GAIN2G: rst = 4; break;
5351 		case GAIN2B: rst = 4; break;
5352 		case TOTSHADING: rst = 0; break;
5353 		case BSHADINGON: rst = 1; break;
5354 		case BSHADINGHEIGHT: rst = 30; break;
5355 		case BSHADINGPREDIFFR: rst = 2; break;
5356 		case BSHADINGPREDIFFG: rst = 2; break;
5357 		case BSHADINGPREDIFFB: rst = 2; break;
5358 		case BSHADINGDEFCUTOFF: rst = 0; break;
5359 		case WSHADINGON: rst = 3; break;
5360 		case WSHADINGHEIGHT: rst = 24; break;
5361 		case WSHADINGPREDIFFR: rst = -1; break;
5362 		case WSHADINGPREDIFFG: rst = -1; break;
5363 		case WSHADINGPREDIFFB: rst = -1; break;
5364 	}
5365 
5366 	return rst;
5367 }
5368 
hpg3110_calibnegative(int option,int defvalue)5369 static int hpg3110_calibnegative(int option, int defvalue)
5370 {
5371 	int rst = defvalue;
5372 
5373 	switch(option)
5374 	{
5375 		case WSTRIPXPOS: rst = 0; break;
5376 		case WSTRIPYPOS: rst = 5100; break;
5377 		case BSTRIPXPOS: rst = 0; break;
5378 		case BSTRIPYPOS: rst = 0; break;
5379 		case BREFR: rst = 10; break;
5380 		case BREFG: rst = 10; break;
5381 		case BREFB: rst = 10; break;
5382 		case REFBITDEPTH: rst = 8; break;
5383 		case OFFSETHEIGHT: rst = 10; break;
5384 		case OFFSETNSIGMA: rst = 2; break;
5385 		case OFFSETTARGETMAX: rst = 50; break;
5386 		case OFFSETTARGETMIN: rst = 2; break;
5387 		case OFFSETAVGTARGETR: rst = 10; break;
5388 		case OFFSETAVGTARGETG: rst = 10; break;
5389 		case OFFSETAVGTARGETB: rst = 10; break;
5390 		case ADCOFFEVENODD: rst = 1; break;
5391 		case CALIBOFFSET1ON: rst = 2; break;
5392 		case ADCOFFQUICKWAY: rst = 1; break;
5393 		case ADCOFFPREDICTSTART: rst = 200; break;
5394 		case ADCOFFPREDICTEND: rst = 500; break;
5395 		case OFFSETTUNESTEP1: rst = 5; break;
5396 		case OFFSETBOUNDARYRATIO1: rst = 100; break;
5397 		case OFFSETAVGRATIO1: rst = 100; break;
5398 		case OFFSETEVEN1R: rst = 308; break;
5399 		case OFFSETODD1R: rst = 308; break;
5400 		case OFFSETEVEN1G: rst = 317; break;
5401 		case OFFSETODD1G: rst = 317; break;
5402 		case OFFSETEVEN1B: rst = 319; break;
5403 		case OFFSETODD1B: rst = 319; break;
5404 		case ADCOFFPREDICTR: rst = 333; break;
5405 		case ADCOFFPREDICTG: rst = 313; break;
5406 		case ADCOFFPREDICTB: rst = 317; break;
5407 		case ADCOFFEVEN1R_1ST: rst = 69; break;
5408 		case ADCOFFODD1R_1ST: rst = 69; break;
5409 		case ADCOFFEVEN1G_1ST: rst = 87; break;
5410 		case ADCOFFODD1G_1ST: rst = 87; break;
5411 		case ADCOFFEVEN1B_1ST: rst = 106; break;
5412 		case ADCOFFODD1B_1ST: rst = 106; break;
5413 		case PEAKR: rst = 116; break;
5414 		case PEAKG: rst = 126; break;
5415 		case PEAKB: rst = 102; break;
5416 		case MINR: rst = 103; break;
5417 		case MING: rst = 112; break;
5418 		case MINB: rst = 80; break;
5419 		case CALIBOFFSET2ON: rst = 0; break;
5420 		case OFFSETTUNESTEP2: rst = 1; break;
5421 		case OFFSETBOUNDARYRATIO2: rst = 100; break;
5422 		case OFFSETAVGRATIO2: rst = 100; break;
5423 		case OFFSETEVEN2R: rst = 0; break;
5424 		case OFFSETODD2R: rst = 0; break;
5425 		case OFFSETEVEN2G: rst = 0; break;
5426 		case OFFSETODD2G: rst = 0; break;
5427 		case OFFSETEVEN2B: rst = 0; break;
5428 		case OFFSETODD2B: rst = 0; break;
5429 		case GAINHEIGHT: rst = 30; break;
5430 		case GAINTARGETFACTOR: rst = 80; break;
5431 		case CALIBPAGON: rst = 0; break;
5432 		case HIPAGR: rst = 3; break;
5433 		case HIPAGG: rst = 3; break;
5434 		case HIPAGB: rst = 3; break;
5435 		case LOPAGR: rst = 3; break;
5436 		case LOPAGG: rst = 3; break;
5437 		case LOPAGB: rst = 3; break;
5438 		case PAGR: rst = 3; break;
5439 		case PAGG: rst = 3; break;
5440 		case PAGB: rst = 3; break;
5441 		case CALIBGAIN1ON: rst = 1; break;
5442 		case GAIN1R: rst = 6; break;
5443 		case GAIN1G: rst = 1; break;
5444 		case GAIN1B: rst = 7; break;
5445 		case CALIBGAIN2ON: rst = 0; break;
5446 		case GAIN2R: rst = 4; break;
5447 		case GAIN2G: rst = 4; break;
5448 		case GAIN2B: rst = 4; break;
5449 		case TOTSHADING: rst = 0; break;
5450 		case BSHADINGON: rst = -2; break;
5451 		case BSHADINGHEIGHT: rst = 30; break;
5452 		case BSHADINGPREDIFFR: rst = 2; break;
5453 		case BSHADINGPREDIFFG: rst = 2; break;
5454 		case BSHADINGPREDIFFB: rst = 2; break;
5455 		case BSHADINGDEFCUTOFF: rst = 0; break;
5456 		case WSHADINGON: rst = 3; break;
5457 		case WSHADINGHEIGHT: rst = 24; break;
5458 		case WSHADINGPREDIFFR: rst = -1; break;
5459 		case WSHADINGPREDIFFG: rst = -1; break;
5460 		case WSHADINGPREDIFFB: rst = -1; break;
5461 	}
5462 
5463 	return rst;
5464 }
5465 
hp4370_calibnegative(int option,int defvalue)5466 static int hp4370_calibnegative(int option, int defvalue)
5467 {
5468 	int rst = defvalue;
5469 
5470 	switch(option)
5471 	{
5472 		case WSTRIPXPOS: rst = 0; break;
5473 		case WSTRIPYPOS: rst = 6580; break;
5474 		case BSTRIPXPOS: rst = 0; break;
5475 		case BSTRIPYPOS: rst = 0; break;
5476 		case BREFR: rst = 10; break;
5477 		case BREFG: rst = 10; break;
5478 		case BREFB: rst = 10; break;
5479 		case REFBITDEPTH: rst = 8; break;
5480 		case OFFSETHEIGHT: rst = 10; break;
5481 		case OFFSETNSIGMA: rst = 2; break;
5482 		case OFFSETTARGETMAX: rst = 50; break;
5483 		case OFFSETTARGETMIN: rst = 2; break;
5484 		case OFFSETAVGTARGETR: rst = 10; break;
5485 		case OFFSETAVGTARGETG: rst = 10; break;
5486 		case OFFSETAVGTARGETB: rst = 10; break;
5487 		case ADCOFFEVENODD: rst = 1; break;
5488 		case CALIBOFFSET1ON: rst = 2; break;
5489 		case ADCOFFQUICKWAY: rst = 1; break;
5490 		case ADCOFFPREDICTSTART: rst = 200; break;
5491 		case ADCOFFPREDICTEND: rst = 500; break;
5492 		case OFFSETTUNESTEP1: rst = 5; break;
5493 		case OFFSETBOUNDARYRATIO1: rst = 100; break;
5494 		case OFFSETAVGRATIO1: rst = 100; break;
5495 		case OFFSETEVEN1R: rst = 308; break;
5496 		case OFFSETODD1R: rst = 308; break;
5497 		case OFFSETEVEN1G: rst = 317; break;
5498 		case OFFSETODD1G: rst = 317; break;
5499 		case OFFSETEVEN1B: rst = 319; break;
5500 		case OFFSETODD1B: rst = 319; break;
5501 		case ADCOFFPREDICTR: rst = 333; break;
5502 		case ADCOFFPREDICTG: rst = 313; break;
5503 		case ADCOFFPREDICTB: rst = 317; break;
5504 		case ADCOFFEVEN1R_1ST: rst = 69; break;
5505 		case ADCOFFODD1R_1ST: rst = 69; break;
5506 		case ADCOFFEVEN1G_1ST: rst = 87; break;
5507 		case ADCOFFODD1G_1ST: rst = 87; break;
5508 		case ADCOFFEVEN1B_1ST: rst = 106; break;
5509 		case ADCOFFODD1B_1ST: rst = 106; break;
5510 		case PEAKR: rst = 116; break;
5511 		case PEAKG: rst = 126; break;
5512 		case PEAKB: rst = 102; break;
5513 		case MINR: rst = 103; break;
5514 		case MING: rst = 112; break;
5515 		case MINB: rst = 80; break;
5516 		case CALIBOFFSET2ON: rst = 0; break;
5517 		case OFFSETTUNESTEP2: rst = 1; break;
5518 		case OFFSETBOUNDARYRATIO2: rst = 100; break;
5519 		case OFFSETAVGRATIO2: rst = 100; break;
5520 		case OFFSETEVEN2R: rst = 0; break;
5521 		case OFFSETODD2R: rst = 0; break;
5522 		case OFFSETEVEN2G: rst = 0; break;
5523 		case OFFSETODD2G: rst = 0; break;
5524 		case OFFSETEVEN2B: rst = 0; break;
5525 		case OFFSETODD2B: rst = 0; break;
5526 		case GAINHEIGHT: rst = 30; break;
5527 		case GAINTARGETFACTOR: rst = 80; break;
5528 		case CALIBPAGON: rst = 0; break;
5529 		case HIPAGR: rst = 3; break;
5530 		case HIPAGG: rst = 3; break;
5531 		case HIPAGB: rst = 3; break;
5532 		case LOPAGR: rst = 3; break;
5533 		case LOPAGG: rst = 3; break;
5534 		case LOPAGB: rst = 3; break;
5535 		case PAGR: rst = 3; break;
5536 		case PAGG: rst = 3; break;
5537 		case PAGB: rst = 3; break;
5538 		case CALIBGAIN1ON: rst = 1; break;
5539 		case GAIN1R: rst = 6; break;
5540 		case GAIN1G: rst = 1; break;
5541 		case GAIN1B: rst = 7; break;
5542 		case CALIBGAIN2ON: rst = 0; break;
5543 		case GAIN2R: rst = 4; break;
5544 		case GAIN2G: rst = 4; break;
5545 		case GAIN2B: rst = 4; break;
5546 		case TOTSHADING: rst = 0; break;
5547 		case BSHADINGON: rst = -2; break;
5548 		case BSHADINGHEIGHT: rst = 30; break;
5549 		case BSHADINGPREDIFFR: rst = 2; break;
5550 		case BSHADINGPREDIFFG: rst = 2; break;
5551 		case BSHADINGPREDIFFB: rst = 2; break;
5552 		case BSHADINGDEFCUTOFF: rst = 0; break;
5553 		case WSHADINGON: rst = 3; break;
5554 		case WSHADINGHEIGHT: rst = 24; break;
5555 		case WSHADINGPREDIFFR: rst = -1; break;
5556 		case WSHADINGPREDIFFG: rst = -1; break;
5557 		case WSHADINGPREDIFFB: rst = -1; break;
5558 	}
5559 
5560 	return rst;
5561 }
5562 
fc_calibnegative(int option,int defvalue)5563 static int fc_calibnegative(int option, int defvalue)
5564 {
5565 	int rst;
5566 
5567 	switch(RTS_Debug->dev_model)
5568 	{
5569 		case UA4900: rst = ua4900_calibnegative(option, defvalue); break;
5570 		case HPG2710:
5571 		case HP3800: rst = hp3800_calibnegative(option, defvalue); break;
5572 		case HPG3010:
5573 		case HP4370: rst = hp4370_calibnegative(option, defvalue); break;
5574 		case HPG3110: rst = hpg3110_calibnegative(option, defvalue); break;
5575 		default    : rst = hp3970_calibnegative(option, defvalue); break;
5576 	}
5577 
5578 	return rst;
5579 }
5580 
fc_scaninfo_get(int option,int defvalue)5581 static int fc_scaninfo_get(int option, int defvalue)
5582 {
5583 	int value[] = {1, 0, 0, 0, 0, 100};
5584 	int ua4900_value[] = {1, 0xcdcdcdcd, 0xcdcdcdcd, 0xcdcdcdcd, 0xcdcdcdcd, 100};
5585 
5586 	int rst = defvalue;
5587 	int *myvalue = NULL;
5588 
5589 	switch(RTS_Debug->dev_model)
5590 	{
5591 		case UA4900: myvalue = ua4900_value; break;
5592 		default: myvalue = value; break;
5593 	}
5594 
5595 	switch(option)
5596 	{
5597 		case PARKHOMEAFTERCALIB: rst = myvalue[0]; break;
5598 		case SHADINGTIME_16BIT: rst = myvalue[1]; break;
5599 		case SHADOWTIME_16BIT: rst = myvalue[2]; break;
5600 		case SHADINGTIME_8BIT: rst = myvalue[3]; break;
5601 		case SHADOWTIME_8BIT: rst = myvalue[4]; break;
5602 		case PREVIEWDPI: rst = myvalue[5]; break;
5603 	}
5604 
5605 	return rst;
5606 }
5607 
5608 /* fitcalibrate */
fitcalibrate_get(int section,int option,int defvalue)5609 static int fitcalibrate_get(int section, int option, int defvalue)
5610 {
5611 	int rst = defvalue;
5612 
5613 	switch(section)
5614 	{
5615 		case CALIBREFLECTIVE:
5616 			rst = fc_calibreflective(option, defvalue); break;
5617 		case CALIBTRANSPARENT:
5618 			rst = fc_calibtransparent(option, defvalue); break;
5619 		case CALIBNEGATIVEFILM:
5620 			rst = fc_calibnegative(option, defvalue); break;
5621 		case SCANINFO:
5622 			rst = fc_scaninfo_get(option, defvalue); break;
5623 	}
5624 
5625 	return rst;
5626 }
5627 
srt_hp3800_scanparam_get(int option,int defvalue)5628 static int srt_hp3800_scanparam_get(int option, int defvalue)
5629 {
5630 	int rst = defvalue;
5631 
5632 	/* t_rtinifile */
5633 	int value3[] = {1, 0, 0, 0, 1, 12, 0, 1, 170, 140, 40, 30, 40, 30, 1500, 20, 0, 36, 0};
5634 
5635 	int *value = value3;
5636 
5637 	if (value != NULL)
5638 		switch(option)
5639 		{
5640 			case ARRANGELINE: rst = value[0]; break;
5641 			case COMPRESSION: rst = value[1]; break;
5642 			case TA_X_START:  rst = value[2]; break;
5643 			case TA_Y_START:  rst = value[3]; break;
5644 			case DPIGAINCONTROL600: rst = value[4]; break;
5645 			case CRVS:  rst = value[5]; break;
5646 			case MLOCK: rst = value[6]; break;
5647 			case ENABLEWARMUP:  rst = value[7]; break;
5648 			case NMAXTARGET:    rst = value[8]; break;
5649 			case NMINTARGET:    rst = value[9]; break;
5650 			case NMAXTARGETTA:  rst = value[10]; break;
5651 			case NMINTARGETTA:  rst = value[11]; break;
5652 			case NMAXTARGETNEG: rst = value[12]; break;
5653 			case NMINTARGETNEG: rst = value[13]; break;
5654 			case STABLEDIFF: rst = value[14]; break;
5655 			case DELTAPWM:   rst = value[15]; break;
5656 			case PWMLAMPLEVEL:   rst = value[16]; break;
5657 			case TMAPWMDUTY: rst = value[17]; break;
5658 			case LEFTLEADING: rst = value[18]; break;
5659 	}
5660 
5661 	return rst;
5662 }
5663 
srt_hp3970_scanparam_get(int file,int option,int defvalue)5664 static int srt_hp3970_scanparam_get(int file, int option, int defvalue)
5665 {
5666 	int rst = defvalue;
5667 	/* s_rtinifile */
5668 	int value1[] = {1, 0, 150, 0, 1, 6, 0, 0, 170, 140, 40, 30, 40, 30, 1500, 20, 0, 36, 360};
5669 	/* s_usb1inifile */
5670 	int value2[] = {1, 0, 150, 0, 1, 6, 0, 0, 170, 140, 40, 30, 40, 30, 1500, 20, 0, 36, 360};
5671 	/* t_rtinifile */
5672 	int value3[] = {1, 0, 150, 0, 1, 12, 0, 0, 170, 140, 40, 30, 40, 30, 1500, 20, 0, 36, 0};
5673 	/* t_usb1inifile */
5674 	int value4[] = {1, 0, 150, 0, 1, 12, 0, 0, 170, 140, 40, 30, 40, 30, 1500, 20, 0, 36, 0};
5675 
5676 	int *value = NULL;
5677 
5678 	switch(file)
5679 	{
5680 		case S_RTINIFILE: value = value1; break;
5681 		case S_USB1INIFILE: value = value2; break;
5682 		case T_RTINIFILE: value = value3; break;
5683 		case T_USB1INIFILE: value = value4; break;
5684 	}
5685 
5686 	if (value != NULL)
5687 		switch(option)
5688 		{
5689 			case ARRANGELINE: rst = value[0]; break;
5690 			case COMPRESSION: rst = value[1]; break;
5691 			case TA_X_START:  rst = value[2]; break;
5692 			case TA_Y_START:  rst = value[3]; break;
5693 			case DPIGAINCONTROL600: rst = value[4]; break;
5694 			case CRVS:  rst = value[5]; break;
5695 			case MLOCK: rst = value[6]; break;
5696 			case ENABLEWARMUP:  rst = value[7]; break;
5697 			case NMAXTARGET:    rst = value[8]; break;
5698 			case NMINTARGET:    rst = value[9]; break;
5699 			case NMAXTARGETTA:  rst = value[10]; break;
5700 			case NMINTARGETTA:  rst = value[11]; break;
5701 			case NMAXTARGETNEG: rst = value[12]; break;
5702 			case NMINTARGETNEG: rst = value[13]; break;
5703 			case STABLEDIFF: rst = value[14]; break;
5704 			case DELTAPWM:   rst = value[15]; break;
5705 			case PWMLAMPLEVEL:   rst = value[16]; break;
5706 			case TMAPWMDUTY: rst = value[17]; break;
5707 			case LEFTLEADING: rst = value[18]; break;
5708 	}
5709 
5710 	return rst;
5711 }
5712 
srt_hp4370_scanparam_get(int file,int option,int defvalue)5713 static int srt_hp4370_scanparam_get(int file, int option, int defvalue)
5714 {
5715 	/* s_rtinifile */
5716 	int value1[] = {1, 0, 150, 0, 1, 6, 0, 0, 170, 140, 40, 30, 40, 30, 1500, 20, 0, 36, 360};
5717 	/* s_usb1inifile */
5718 	int value2[] = {1, 0, 150, 0, 1, 6, 0, 0, 170, 140, 40, 30, 40, 30, 1500, 20, 0, 36, 360};
5719 	/* t_rtinifile */
5720 	int value3[] = {1, 0, 150, 0, 1, 12, 0, 0, 170, 140, 40, 30, 40, 30, 1500, 20, 0, 36, 0};
5721 	/* t_usb1inifile */
5722 	int value4[] = {1, 0, 150, 0, 1, 12, 0, 0, 170, 140, 40, 30, 40, 30, 1500, 20, 0, 36, 0};
5723 	int *value = NULL;
5724 
5725 	int rst = defvalue;
5726 
5727 	switch(file)
5728 	{
5729 		case S_RTINIFILE: value = value1; break;
5730 		case S_USB1INIFILE: value = value2; break;
5731 		case T_RTINIFILE: value = value3; break;
5732 		case T_USB1INIFILE: value = value4; break;
5733 	}
5734 
5735 	if (value != NULL)
5736 		switch(option)
5737 		{
5738 			case ARRANGELINE: rst = value[0]; break;
5739 			case COMPRESSION: rst = value[1]; break;
5740 			case TA_X_START:  rst = value[2]; break;
5741 			case TA_Y_START:  rst = value[3]; break;
5742 			case DPIGAINCONTROL600: rst = value[4]; break;
5743 			case CRVS:  rst = value[5]; break;
5744 			case MLOCK: rst = value[6]; break;
5745 			case ENABLEWARMUP: rst = value[7]; break;
5746 			case NMAXTARGET:   rst = value[8]; break;
5747 			case NMINTARGET:   rst = value[9]; break;
5748 			case NMAXTARGETTA: rst = value[10]; break;
5749 			case NMINTARGETTA: rst = value[11]; break;
5750 			case NMAXTARGETNEG: rst = value[12]; break;
5751 			case NMINTARGETNEG: rst = value[13]; break;
5752 			case STABLEDIFF: rst = value[14]; break;
5753 			case DELTAPWM: rst = value[15]; break;
5754 			case PWMLAMPLEVEL: rst = value[16]; break;
5755 			case TMAPWMDUTY: rst = value[17]; break;
5756 			case LEFTLEADING: rst = value[18]; break;
5757 	}
5758 
5759 	return rst;
5760 }
5761 
srt_scancali_get(int file,int option,int defvalue)5762 static int srt_scancali_get(int file, int option, int defvalue)
5763 {
5764 	int rst = defvalue;
5765 	/* s_rtinifile */
5766 	int value1[] = {3, 3, 3, 14, 4, 4, 41, 41, 42, 41, 41, 42, 91, 91,
5767 	                53, 53, 48, 48, 104, 104, 59, 59, 64,64};
5768 	/* s_usb1inifile */
5769 	int value2[] = {3, 3, 3, 14, 4, 4, 41, 41, 42, 41, 41, 42, 91, 91,
5770 	                53, 53, 48, 48, 104, 104, 59, 59, 64, 64};
5771 	/* t_rtinifile*/
5772 	int value3[] = {3, 3, 3, 14, 4, 4, 41, 41, 42, 41, 41, 42, 270, 270,
5773 	                511, 511, 511, 511, 270, 270, 511, 511, 511, 511};
5774 	/* t_usb1inifile*/
5775 	int value4[] = {3, 3, 3, 14, 4, 4, 41, 41, 42, 41, 41, 42, 270, 270,
5776 	                511, 511, 511, 511, 270, 270, 511, 511, 511, 511};
5777 	int *value = NULL;
5778 
5779 	switch(file)
5780 	{
5781 		case S_RTINIFILE: value = value1; break;
5782 		case S_USB1INIFILE: value = value2; break;
5783 		case T_RTINIFILE: value = value3; break;
5784 		case T_USB1INIFILE: value = value4; break;
5785 	}
5786 
5787 	if (value != NULL)
5788 		switch(option)
5789 		{
5790 			case PGA1: rst = value[0]; break;
5791 			case PGA2: rst = value[1]; break;
5792 			case PGA3: rst = value[2]; break;
5793 			case VGAGAIN11: rst = value[3]; break;
5794 			case VGAGAIN12: rst = value[4]; break;
5795 			case VGAGAIN13: rst = value[5]; break;
5796 			case DCSTEPEVEN1: rst = value[6]; break;
5797 			case DCSTEPODD1: rst = value[7]; break;
5798 			case DCSTEPEVEN2: rst = value[8]; break;
5799 			case DCSTEPODD2: rst = value[9]; break;
5800 			case DCSTEPEVEN3: rst = value[10]; break;
5801 			case DCSTEPODD3: rst = value[11]; break;
5802 			case FIRSTDCOFFSETEVEN11: rst = value[12]; break;
5803 			case FIRSTDCOFFSETODD11: rst = value[13]; break;
5804 			case FIRSTDCOFFSETEVEN12: rst = value[14]; break;
5805 			case FIRSTDCOFFSETODD12: rst = value[15]; break;
5806 			case FIRSTDCOFFSETEVEN13: rst = value[16]; break;
5807 			case FIRSTDCOFFSETODD13: rst = value[17]; break;
5808 			case DCOFFSETEVEN11: rst = value[18]; break;
5809 			case DCOFFSETODD11: rst = value[19]; break;
5810 			case DCOFFSETEVEN12: rst = value[20]; break;
5811 			case DCOFFSETODD12: rst = value[21]; break;
5812 			case DCOFFSETEVEN13: rst = value[22]; break;
5813 			case DCOFFSETODD13: rst = value[23]; break;
5814 		}
5815 
5816 	return rst;
5817 }
5818 
srt_truegrayparam_get(int file,int option,int defvalue)5819 static int srt_truegrayparam_get(int file, int option, int defvalue)
5820 {
5821 	int rst = defvalue;
5822 	/* s_rtinifile */
5823 	int value1[] = {100, 30, 59, 11};
5824 	/* s_usb1inifile */
5825 	int value2[] = {100, 30, 59, 11};
5826 	/* t_rtinifile */
5827 	int value3[] = {100, 30, 59, 11};
5828 	/* t_usb1inifile */
5829 	int value4[] = {100, 30, 59, 11};
5830 	int *value = NULL;
5831 
5832 	switch(file)
5833 	{
5834 		case S_RTINIFILE: value = value1; break;
5835 		case S_USB1INIFILE: value = value2; break;
5836 		case T_RTINIFILE: value = value3; break;
5837 		case T_USB1INIFILE: value = value4; break;
5838 	}
5839 
5840 	if (value != NULL)
5841 		switch(option)
5842 		{
5843 			case SHADINGBASE: rst = value[0]; break;
5844 			case SHADINGFACT1: rst = value[1]; break;
5845 			case SHADINGFACT2: rst = value[2]; break;
5846 			case SHADINGFACT3: rst = value[3]; break;
5847 		}
5848 
5849 	return rst;
5850 }
5851 
srt_caliparam_get(int file,int option,int defvalue)5852 static int srt_caliparam_get(int file, int option, int defvalue)
5853 {
5854 	int rst = defvalue;
5855 	/* s_rtinifile */
5856 	int value1[] = {0xffff};
5857 	/* s_usb1inifile */
5858 	int value2[] = {0xffff};
5859 	/* t_rtinifile */
5860 	int value3[] = {0xffff};
5861 	/* t_usb1inifile */
5862 	int value4[] = {0xffff};
5863 	int *value = NULL;
5864 
5865 	switch(file)
5866 	{
5867 		case S_RTINIFILE: value = value1; break;
5868 		case S_USB1INIFILE: value = value2; break;
5869 		case T_RTINIFILE: value = value3; break;
5870 		case T_USB1INIFILE: value = value4; break;
5871 	}
5872 
5873 	if (value != NULL)
5874 		switch(option)
5875 		{
5876 			case PIXELDARKLEVEL: rst = value[0]; break;
5877 		}
5878 
5879 	return rst;
5880 }
5881 
srt_hp3800_platform_get(int option,int defvalue)5882 static int srt_hp3800_platform_get(int option, int defvalue)
5883 {
5884 	/* s_rtinifile*/
5885 	int value1[] = {100, 99, 1214636};
5886 
5887 	int *value = value1;
5888 	int rst = defvalue;
5889 
5890 	if (value != NULL)
5891 	{
5892 		switch(option)
5893 		{
5894 			case BINARYTHRESHOLDH: rst = value[0]; break;
5895 			case BINARYTHRESHOLDL: rst = value[1]; break;
5896 			case CLOSETIME: rst = value[2]; break;
5897 		}
5898 	}
5899 
5900 	return rst;
5901 }
5902 
srt_hp3970_platform_get(int option,int defvalue)5903 static int srt_hp3970_platform_get(int option, int defvalue)
5904 {
5905 	/* s_rtinifile*/
5906 	int value1[] = {128, 127, 1214636};
5907 
5908 	int *value = value1;
5909 	int rst = defvalue;
5910 
5911 	if (value != NULL)
5912 	{
5913 		switch(option)
5914 		{
5915 			case BINARYTHRESHOLDH: rst = value[0]; break;
5916 			case BINARYTHRESHOLDL: rst = value[1]; break;
5917 			case CLOSETIME: rst = value[2]; break;
5918 		}
5919 	}
5920 
5921 	return rst;
5922 }
5923 
5924 
srt_ua4900_platform_get(int option,int defvalue)5925 static int srt_ua4900_platform_get(int option, int defvalue)
5926 {
5927 	int value1[] = {128, 127, 1214636};
5928 	int *value = value1;
5929 	int rst = defvalue;
5930 
5931 	if (value != NULL)
5932 	{
5933 		switch(option)
5934 		{
5935 			case BINARYTHRESHOLDH: rst = value[0]; break;
5936 			case BINARYTHRESHOLDL: rst = value[1]; break;
5937 			case CLOSETIME: rst = value[2]; break;
5938 		}
5939 	}
5940 
5941 	return rst;
5942 }
5943 
srt_hp4370_platform_get(int option,int defvalue)5944 static int srt_hp4370_platform_get(int option, int defvalue)
5945 {
5946 	/* t_rtinifile */
5947 	int value3[] = {128, 127, 1214636};
5948 
5949 	int *value = value3;
5950 	int rst = defvalue;
5951 
5952 	if (value != NULL)
5953 	{
5954 		switch(option)
5955 		{
5956 			case BINARYTHRESHOLDH: rst = value[0]; break;
5957 			case BINARYTHRESHOLDL: rst = value[1]; break;
5958 			case CLOSETIME: rst = value[2]; break;
5959 		}
5960 	}
5961 
5962 	return rst;
5963 }
5964 
srt_scaninfo_get(int file,int option,int defvalue)5965 static int srt_scaninfo_get(int file, int option, int defvalue)
5966 {
5967 	int rst = defvalue;
5968 	int value1[] = {0, 0, 0, 0};
5969 	int value2[] = {0, 0, 0, 0};
5970 	int value3[] = {0, 0, 0, 0};
5971 	int value4[] = {0, 0, 0, 0};
5972 	int *value = NULL;
5973 
5974 	switch(file)
5975 	{
5976 		case S_RTINIFILE: value = value1; break;
5977 		case S_USB1INIFILE: value = value2; break;
5978 		case T_RTINIFILE: value = value3; break;
5979 		case T_USB1INIFILE: value = value4; break;
5980 	}
5981 
5982 	if (value != NULL)
5983 	{
5984 		switch(option)
5985 		{
5986 			case SHADINGTIME_16BIT: rst = value[0]; break;
5987 			case SHADOWTIME_16BIT: rst = value[1]; break;
5988 			case SHADINGTIME_8BIT: rst = value[2]; break;
5989 			case SHADOWTIME_8BIT: rst = value[3]; break;
5990 		}
5991 	}
5992 
5993 	return rst;
5994 }
5995 
srt_sec_get(int file,int section,int option,int defvalue)5996 static int srt_sec_get(int file, int section, int option, int defvalue)
5997 {
5998 	int rst = defvalue;
5999 
6000 	switch(section)
6001 	{
6002 		case SCAN_PARAM:
6003 			switch(RTS_Debug->dev_model)
6004 			{
6005 				case HPG2710:
6006 				case HP3800: rst = srt_hp3800_scanparam_get(option, defvalue); break;
6007 				case HPG3010:
6008 				case HPG3110:
6009 				case HP4370: rst = srt_hp4370_scanparam_get(file, option, defvalue); break;
6010 				default    : rst = srt_hp3970_scanparam_get(file, option, defvalue); break;
6011 			}
6012 			break;
6013 		case SCAN_CALI:
6014 			rst = srt_scancali_get(file, option, defvalue); break;
6015 		case TRUE_GRAY_PARAM:
6016 			rst = srt_truegrayparam_get(file, option, defvalue); break;
6017 		case CALI_PARAM:
6018 			rst = srt_caliparam_get(file, option, defvalue); break;
6019 		case PLATFORM:
6020 			switch(RTS_Debug->dev_model)
6021 			{
6022 				case HPG2710:
6023 				case HP3800: rst = srt_hp3800_platform_get(option, defvalue); break;
6024 				case UA4900: rst = srt_ua4900_platform_get(option, defvalue); break;
6025 				case HPG3010:
6026 				case HPG3110:
6027 				case HP4370: rst = srt_hp4370_platform_get(option, defvalue); break;
6028 				default    : rst = srt_hp3970_platform_get(option, defvalue); break;
6029 			}
6030 			break;
6031 		case SCANINFO:
6032 			rst = srt_scaninfo_get(file, option, defvalue); break;
6033 	}
6034 
6035 	return rst;
6036 }
6037 
get_value(int section,int option,int defvalue,int file)6038 static int get_value(int section, int option, int defvalue, int file)
6039 {
6040 	int rst = defvalue;
6041 
6042 	switch(file)
6043 	{
6044 		case FITCALIBRATE:
6045 			rst = fitcalibrate_get(section, option, defvalue); break;
6046 		case S_RTINIFILE:
6047 		case S_USB1INIFILE:
6048 		case T_RTINIFILE:
6049 		case T_USB1INIFILE:
6050 			rst = srt_sec_get(file, section, option, defvalue); break;
6051 	}
6052 
6053 	return rst;
6054 }
6055