Updated Microtek2 backend to version 0.9 build 20010828 (from

Karsten Festag <karsten.festag@t-online.de>).
Henning Meier-Geinitz <henning@meier-geinitz.de>
DEVEL_2_0_BRANCH-1
Henning Geinitz 2001-10-05 19:15:55 +00:00
rodzic b5045d4c86
commit 7c642ae706
2 zmienionych plików z 340 dodań i 301 usunięć

Wyświetl plik

@ -90,12 +90,12 @@
#define MICROTEK2_MAJOR 0
#define MICROTEK2_MINOR 9
#define MICROTEK2_BUILD "20010517"
#define MICROTEK2_BUILD "20010828"
#define MICROTEK2_CONFIG_FILE "microtek2.conf"
/******************************************************************************/
/* defines that ar common to all devices */
/* defines that are common to all devices */
/******************************************************************************/
#define MD_RESOLUTION_DEFAULT 72 << SANE_FIXED_SCALE_SHIFT
@ -207,6 +207,7 @@
d[1] = (((s)[1] >> 4) & 0x03); \
d[2] = (((s)[1] >> 2) & 0x03); \
}
#define RSA_NIS(d,s) d = ((s)[1] & 0x02)
#define RSA_DATSEQ(d,s) d = ((s)[1] & 0x01)
#define RSA_CCDGAP(d,s) d = (s)[2]
#define RSA_MAX_XRESOLUTION(d,s) d = ((s)[3] << 8) + (s)[4]
@ -472,7 +473,7 @@
/* READ IMAGE STATUS */
#define RIS_SET_CMD(d) (d)[0] = 0x28; (d)[1] = 0x00; (d)[2] = 0x83; \
(d)[3] = 0x00; (d)[4] = 0x00; (d)[5] = 0x00; \
(d)[6] = 0x00; (d)[7] = 0x00; (d)[8] = 0x01; \
(d)[6] = 0x00; (d)[7] = 0x00; (d)[8] = 0x00; \
(d)[9] = 0x00
#define RIS_CMD_L 10
#define RIS_SET_PCORMAC(d,p) (d)[4] |= (((p) << 7) & 0x80)
@ -575,15 +576,21 @@ enum Microtek2_Option
OPT_EXPOSURE_G,
OPT_EXPOSURE_B,
/*48*/ OPT_SPECIAL,
/*49*/ OPT_SPECIAL,
OPT_RESOLUTION_BIND,
OPT_DISABLE_BACKTRACK,
OPT_CALIB_BACKEND,
OPT_LIGHTLID35,
OPT_TOGGLELAMP,
/*54*/ NUM_OPTIONS
};
/*55*/ OPT_COLORBALANCE,
OPT_BALANCE_R,
OPT_BALANCE_G,
OPT_BALANCE_B,
OPT_BALANCE_FW,
/*60*/ NUM_OPTIONS
};
/******************************************************************************/
/* value structure for scanner options */
@ -595,6 +602,117 @@ typedef union {
SANE_String s;
} Microtek2_Option_Value;
/******************************************************************************/
/* Description of options not included in saneopts.h */
/******************************************************************************/
#define M_NAME_NOBACKTRACK "no-backtracking"
#define M_TITLE_NOBACKTRACK "Disable backtracking"
#define M_DESC_NOBACKTRACK "If checked the scanner does not perform" \
" backtracking."
#define M_NAME_TOGGLELAMP "toggle-lamp"
#define M_TITLE_TOGGLELAMP "Toggle lamp of flatbed"
#define M_DESC_TOGGLELAMP "Toggles the lamp of the flatbed"
#define M_NAME_CALIBBACKEND "backend-calibration"
#define M_TITLE_CALIBBACKEND "Calibration by backend"
#define M_DESC_CALIBBACKEND "If checked the color calibration before" \
" a scan is done by the backend. Uncheck" \
" this option if you experience any problem."
#define M_NAME_LIGHTLID35 "lightlid35"
#define M_TITLE_LIGHTLID35 "Use the lightlid-35mm adapter"
#define M_DESC_LIGHTLID35 "This option turns off the lamp of the" \
" flatbed during a scan. Do not expect" \
" excellent results. Maybe this option will" \
" be removed in the future."
#define M_NAME_QUALITY_SCAN "quality_scan"
#define M_TITLE_QUALITY_SCAN "Quality scan"
#define M_DESC_QUALITY_SCAN "Highest quality but lower speed"
#define M_NAME_FAST_SCAN "fast_scan"
#define M_TITLE_FAST_SCAN "Fast scan"
#define M_DESC_FAST_SCAN "Highest speed but lower quality"
#define M_NAME_AUTOADJUST "lineart-auto-adjust"
#define M_TITLE_AUTOADJUST "Automatic adjustment of threshold value"
#define M_DESC_AUTOADJUST "If checked the backend automatically tries" \
" to determine an optimal value for the" \
" threshold."
#define M_NAME_GAMMA_MODE "gamma-correction"
#define M_TITLE_GAMMA_MODE "Gamma correction"
#define M_DESC_GAMMA_MODE "Selects the gamma correction mode."
#define M_NAME_GAMMA_BIND "bind-gamma"
#define M_TITLE_GAMMA_BIND "Bind gamma"
#define M_DESC_GAMMA_BIND "Use same gamma values for all colour channels."
#define M_NAME_GAMMA_SCALAR "scalar-gamma"
#define M_TITLE_GAMMA_SCALAR "Scalar gamma"
#define M_DESC_GAMMA_SCALAR "Selects a value for scalar gamma correction."
#define M_NAME_GAMMA_SCALAR_R "scalar-gamma-r"
#define M_TITLE_GAMMA_SCALAR_R "Scalar gamma red"
#define M_DESC_GAMMA_SCALAR_R "Selects a value for scalar gamma correction" \
" (red channel)"
#define M_NAME_GAMMA_SCALAR_G "scalar-gamma-g"
#define M_TITLE_GAMMA_SCALAR_G "Scalar gamma green"
#define M_DESC_GAMMA_SCALAR_G "Selects a value for scalar gamma correction" \
" (green channel)"
#define M_NAME_GAMMA_SCALAR_B "scalar-gamma-b"
#define M_TITLE_GAMMA_SCALAR_B "Scalar gamma blue"
#define M_DESC_GAMMA_SCALAR_B "Selects a value for scalar gamma correction" \
" (blue channel)"
#define M_NAME_CHANNEL "channel"
#define M_TITLE_CHANNEL "Channel"
#define M_DESC_CHANNEL "Selects the colour band, \"Master\" means," \
" that all colours are affected."
#define M_NAME_MIDTONE "midtone"
#define M_TITLE_MIDTONE "Midtone"
#define M_DESC_MIDTONE "Selects which radiance level should be" \
" considered \"50 % gray\"."
#define M_NAME_MIDTONE_R "midtone-r"
#define M_TITLE_MIDTONE_R "Midtone for red"
#define M_DESC_MIDTONE_R "Selects which radiance level should be" \
" considered \"50 % red\"."
#define M_NAME_MIDTONE_G "midtone-g"
#define M_TITLE_MIDTONE_G "Midtone for green"
#define M_DESC_MIDTONE_G "Selects which radiance level should be" \
" considered \"50 % green\"."
#define M_NAME_MIDTONE_B "midtone-b"
#define M_TITLE_MIDTONE_B "Midtone for blue"
#define M_DESC_MIDTONE_B "Selects which radiance level should be" \
" considered \"50 % blue\"."
#define M_NAME_BALANCE_R "balance-r"
#define M_TITLE_BALANCE_R "Red balance"
#define M_DESC_BALANCE_R "Balance factor for red. A value of 100% means " \
"no correction."
#define M_NAME_BALANCE_G "balance-g"
#define M_TITLE_BALANCE_G "Green balance"
#define M_DESC_BALANCE_G "Balance factor for green. A value of 100% "\
"means no correction."
#define M_NAME_BALANCE_B "balance-b"
#define M_TITLE_BALANCE_B "Blue balance"
#define M_DESC_BALANCE_B "Balance factor for blue. A value of 100% means " \
"no correction. "
#define M_NAME_BALANCE_FW "balance-fw"
#define M_TITLE_BALANCE_FW "Firmware balance"
#define M_DESC_BALANCE_FW "Sets the color balance values to the "\
"firmware provided values. "\
/******************************************************************************/
/* Structure that contains global options */
@ -609,6 +727,7 @@ typedef struct Config_Options
char *toggle_lamp; /* enable/disable lightlid35 option */
char *backend_calibration; /* calibration by backend */
char *auto_adjust; /* automatically choose threshold */
char *colorbalance_adjust; /* color balance can be modified */
} Config_Options;
@ -641,9 +760,7 @@ typedef struct Microtek2_Info {
SANE_Char model[INQ_MODEL_L + 1];
SANE_Char revision[INQ_REV_L + 1];
SANE_Byte model_code;
/* from read scanner attributes */
/* #define MI_HAS_COLOR SANE_TRUE */
SANE_Bool color;
#define MI_HAS_ONEPASS SANE_TRUE
SANE_Bool onepass;
@ -654,7 +771,7 @@ typedef struct Microtek2_Info {
SANE_Byte scanner_type;
#define MI_HAS_FEPROM SANE_TRUE
SANE_Bool feprom;
/* MI_DATA_FORMAT_X must correspond to Byte 0 in READ SCANNER ATTRIBUTE */
/* MI_DATAFMT_X must correspond to Byte 0 in READ SCANNER ATTRIBUTE */
#define MI_DATAFMT_CHUNKY 1
#define MI_DATAFMT_LPLCONCAT 2
#define MI_DATAFMT_LPLSEGREG 3
@ -665,6 +782,7 @@ typedef struct Microtek2_Info {
#define MI_COLSEQ_BLUE 2
#define MI_COLSEQ_ILLEGAL 3
u_int8_t color_sequence[RSA_COLORSEQUENCE_L];
SANE_Bool new_image_status;
#define MI_DATSEQ_RTOL 1
u_int8_t direction;
SANE_Byte ccd_gap;
@ -716,11 +834,6 @@ typedef struct Microtek2_Info {
u_int16_t aps_maxframes;
} Microtek2_Info;
/******************************************************************************/
/* device structure (one for each device in config file) */
/******************************************************************************/
@ -877,6 +990,7 @@ typedef struct Microtek2_Device {
SANE_Range exposure_range; /* for lengthening exposure time */
SANE_Range highlight_range; /* highlight of master channel */
SANE_Range threshold_range; /* 1 - 255 */
SANE_Range balance_range; /* for user provided color balance */
Config_Options opts; /* options from the config file */
} Microtek2_Device;
@ -903,9 +1017,6 @@ typedef struct Microtek2_Scanner {
/* is selected */
char *gamma_mode; /* none, linear or custom */
/* the following defines must correspond to byte 25 of SET WINDOW body */
#define MS_MODE_LINEART 0x00
#define MS_MODE_HALFTONE 0x01
@ -965,6 +1076,7 @@ typedef struct Microtek2_Scanner {
u_int8_t lightlid35;
u_int8_t auto_adjust;
u_int8_t calib_backend;
u_int8_t colorbalance_adjust;
int current_pass; /* current pass if 3-pass scan */
int lut_size; /* size of gamma lookup table */
int lut_entry_size; /* size of one entry in lookup table */
@ -977,7 +1089,7 @@ typedef struct Microtek2_Scanner {
#define MS_COLOR_ALL 3
u_int8_t current_color; /* for gamma calc. and 3-pass scanners */
u_int8_t current_read_color; /* dto, for RI and RIS */
u_int8_t dark; /* (KF) for dark shading */
u_int8_t dark; /* is 1 for reading dark shading */
u_int32_t ppl; /* pixels per line as returned by RII */
u_int32_t bpl; /* bytes per line as returned by RII */
u_int32_t remaining_bytes; /* remaining bytes as returned by RII */
@ -992,6 +1104,8 @@ typedef struct Microtek2_Scanner {
int bits_per_pixel_out; /* bits per pixel transf. to frontend */
u_int32_t src_buffer_size; /* size of the buffer */
int transfer_length; /* transfer length for RI command */
u_int8_t balance[3]; /* user provided balance factor for */
/* red, green and blue data */
struct {
u_int8_t *src_buffer[2]; /* two buffers because of CCD gap */
u_int8_t *src_buf;
@ -1018,99 +1132,6 @@ typedef struct Microtek2_Scanner {
} Microtek2_Scanner;
/******************************************************************************/
/* Description of options not included in saneopts.h */
/******************************************************************************/
#define M_NAME_NOBACKTRACK "no-backtracking"
#define M_TITLE_NOBACKTRACK "Disable backtracking"
#define M_DESC_NOBACKTRACK "If checked the scanner does not perform" \
" backtracking."
#define M_NAME_TOGGLELAMP "toggle-lamp"
#define M_TITLE_TOGGLELAMP "Toggle lamp of flatbed"
#define M_DESC_TOGGLELAMP "Toggles the lamp of the flatbed"
#define M_NAME_CALIBBACKEND "backend-calibration"
#define M_TITLE_CALIBBACKEND "Calibration by backend"
#define M_DESC_CALIBBACKEND "If checked the color calibration before" \
" a scan is done by the backend. Uncheck" \
" this option if you experience any problem."
#define M_NAME_LIGHTLID35 "lightlid35"
#define M_TITLE_LIGHTLID35 "Use the lightlid-35mm adapter"
#define M_DESC_LIGHTLID35 "This option turns off the lamp of the" \
" flatbed during a scan. Do not expect" \
" excellent results. Maybe this option will" \
" be removed in the future."
#define M_NAME_QUALITY_SCAN "quality_scan"
#define M_TITLE_QUALITY_SCAN "Quality scan"
#define M_DESC_QUALITY_SCAN "Highest quality but lower speed"
#define M_NAME_FAST_SCAN "fast_scan"
#define M_TITLE_FAST_SCAN "Fast scan"
#define M_DESC_FAST_SCAN "Highest speed but lower quality"
#define M_NAME_AUTOADJUST "lineart-auto-adjust"
#define M_TITLE_AUTOADJUST "Automatic adjustment of threshold value"
#define M_DESC_AUTOADJUST "If checked the backend automatically tries" \
" to determine an optimal value for the" \
" threshold."
#define M_NAME_GAMMA_MODE "gamma-correction"
#define M_TITLE_GAMMA_MODE "Gamma correction"
#define M_DESC_GAMMA_MODE "Selects the gamma correction mode."
#define M_NAME_GAMMA_BIND "bind-gamma"
#define M_TITLE_GAMMA_BIND "Bind gamma"
#define M_DESC_GAMMA_BIND "Use same gamma values for all colour channels."
#define M_NAME_GAMMA_SCALAR "scalar-gamma"
#define M_TITLE_GAMMA_SCALAR "Scalar gamma"
#define M_DESC_GAMMA_SCALAR "Selects a value for scalar gamma correction."
#define M_NAME_GAMMA_SCALAR_R "scalar-gamma-r"
#define M_TITLE_GAMMA_SCALAR_R "Scalar gamma red"
#define M_DESC_GAMMA_SCALAR_R "Selects a value for scalar gamma correction" \
" (red channel)"
#define M_NAME_GAMMA_SCALAR_G "scalar-gamma-g"
#define M_TITLE_GAMMA_SCALAR_G "Scalar gamma green"
#define M_DESC_GAMMA_SCALAR_G "Selects a value for scalar gamma correction" \
" (green channel)"
#define M_NAME_GAMMA_SCALAR_B "scalar-gamma-b"
#define M_TITLE_GAMMA_SCALAR_B "Scalar gamma blue"
#define M_DESC_GAMMA_SCALAR_B "Selects a value for scalar gamma correction" \
" (blue channel)"
#define M_NAME_CHANNEL "channel"
#define M_TITLE_CHANNEL "Channel"
#define M_DESC_CHANNEL "Selects the colour band, \"Master\" means," \
" that all colours are affected."
#define M_NAME_MIDTONE "midtone"
#define M_TITLE_MIDTONE "Midtone"
#define M_DESC_MIDTONE "Selects which radiance level should be" \
" considered \"50 % gray\"."
#define M_NAME_MIDTONE_R "midtone-r"
#define M_TITLE_MIDTONE_R "Midtone for red"
#define M_DESC_MIDTONE_R "Selects which radiance level should be" \
" considered \"50 % red\"."
#define M_NAME_MIDTONE_G "midtone-g"
#define M_TITLE_MIDTONE_G "Midtone for green"
#define M_DESC_MIDTONE_G "Selects which radiance level should be" \
" considered \"50 % green\"."
#define M_NAME_MIDTONE_B "midtone-b"
#define M_TITLE_MIDTONE_B "Midtone for blue"
#define M_DESC_MIDTONE_B "Selects which radiance level should be" \
" considered \"50 % blue\"."
/******************************************************************************/
/* Function prototypes */
/******************************************************************************/
@ -1215,7 +1236,8 @@ static SANE_Status
init_options(Microtek2_Scanner *, u_int8_t);
static SANE_Status
lineartfake_copy_pixels(Microtek2_Scanner *, u_int8_t *, u_int32_t, u_int8_t, int, FILE *);
lineartfake_copy_pixels(Microtek2_Scanner *, u_int8_t *, u_int32_t, u_int8_t,
int, FILE *);
static SANE_Status
lineartfake_proc_data(Microtek2_Scanner *);
@ -1242,10 +1264,10 @@ static SANE_Status
proc_onebit_data(Microtek2_Scanner *);
static SANE_Status
read_cx_shading_image(Microtek2_Scanner *); /* (KF) new */
read_cx_shading_image(Microtek2_Scanner *);
static SANE_Status
read_cx_shading(Microtek2_Scanner *); /* (KF) new */
read_cx_shading(Microtek2_Scanner *);
static SANE_Status
reader_process(Microtek2_Scanner *);
@ -1254,8 +1276,7 @@ static SANE_Status
restore_gamma_options(SANE_Option_Descriptor *, Microtek2_Option_Value *);
static SANE_Status
segreg_copy_pixels(Microtek2_Scanner *); /* (KF) */
/* parameter list modified */
segreg_copy_pixels(Microtek2_Scanner *);
static SANE_Status
segreg_proc_data(Microtek2_Scanner *ms);
@ -1264,7 +1285,8 @@ static void
set_exposure(Microtek2_Scanner *);
static SANE_Status
set_option_dependencies(SANE_Option_Descriptor *, Microtek2_Option_Value *);
set_option_dependencies(Microtek2_Scanner *,
SANE_Option_Descriptor *, Microtek2_Option_Value *);
static SANE_Status
shading_function(Microtek2_Scanner *, u_int8_t *);
@ -1322,7 +1344,7 @@ static SANE_Status
scsi_send_shading(Microtek2_Scanner *, u_int8_t *, u_int32_t, u_int8_t);
static SANE_Status
scsi_read_shading(Microtek2_Scanner *, u_int8_t *, u_int32_t); /* (KF) new */
scsi_read_shading(Microtek2_Scanner *, u_int8_t *, u_int32_t);
static SANE_Status
scsi_send_system_status(Microtek2_Device *, int);

Wyświetl plik

@ -1,7 +1,7 @@
. .IX sane-microtek2
." Process this file with
." groff -man -Tascii sane-microtek2
.TH sane-microtek2 5 "19 May 2001"
." man -l sane-microtek2.man
.TH sane-microtek2 5 "14 Aug 2001"
.SH NAME
sane-microtek2 - SANE backend for Microtek scanners with SCSI-2 command set
.SH DESCRIPTION
@ -65,7 +65,8 @@ Scanport? SQ300 Parport?
Scanpaq SQ2030 Parport
.PP
Additional information can be found at
.BR http://www.mostang.com/sane/ .
.B www.mostang.com/sane/
.
If you own a Microtek scanner with SCSI-2 interface other than the ones
listed
above, it may or may not work with SANE! Because equal scanners are sold under
@ -74,6 +75,11 @@ the above.
.PP
The parport scanners work with the ppscsi + onscsi kernel modules.
.PP
The USB scanners work with the microtek kernel module.
.PP
Both parport and USB scanners need the generic SCSI support, so check if you
have loaded the scsi_mod and sg modules!
.PP
If you try your scanner for the first time keep an eye on it. If it gets
commands that it doesn't understand the scanhead may go beyond the scan area.
The scanner then makes strange noises. In this case immedieately switch off
@ -143,7 +149,8 @@ or
for example.
.SH "CONFIGURATION"
The configuration file for this backend resides in
.IR @CONFIGDIR@/microtek2.conf .
.I @CONFIGDIR@/microtek2.conf
.
Its contents is a list of device names that correspond to Microtek
scanners with SCSI-2 interface. Empty lines and lines starting with
a hash mark (#) are ignored.
@ -167,6 +174,8 @@ option toggle-lamp <on/off>
option lineart-autoadjust <on/off>
.br
option backend-calibration <on/off>
.br
option colorbalance-adjust <on/off>
.RE
.PP
.I option dump <n>
@ -186,8 +195,8 @@ printed, too. If n=4 all scan data is additionally printed to stderr.
.PP
The default is n=1.
.PP
.IR option\ strip-height\ <n> ,
where <n> is a floating point number, limits the amount of data that is
.I option strip-height <n>
, where <n> is a floating point number, limits the amount of data that is
read from the scanner with one read command.
The unit is inch and <n> defaults to 1.0, if this option is not set in the
configuration file. If less than <n> inch of data fit into the SCSI buffer,
@ -207,8 +216,8 @@ This
speeds up scanning. Try it.
.PP
.I option lightlid-35 <on/off>
If you use the LightLid-35 transparency adapter this option switches off the
flatbed lamp during the scan.
If you use the LightLid-35 transparency adapter you get an advanced
option which switches off the flatbed lamp during the scan.
.PP
.I option toggle-lamp <on/off>
You get a button in the frontend where you can switch on and off the flatbed
@ -222,6 +231,12 @@ threshold.
Some scanners (e.g. Phantom 330CX and 636CX) need to have calibrated the data
by the backend. Try this option if you see vertical stripes in your pictures.
.PP
.I option colorbalance-adjust <on/off>
Some scanners (e.g. Phantom 330CX and 636CX) need to have corrected
the color balance. If this option is enabled you get advanced options
where you can balance the colors. And you will have a button
to use the values that the firmware of the scanner provides.
.PP
A sample configuration file is shown below:
.PP
.RS
@ -259,6 +274,8 @@ option toggle-lamp on
.br
option lineart-autoadjust on
.br
option colorbalance-adjust off
.br
scsi * * Scanner
.RE