From c1d18c4e0902e1b06b0c36b22e8076306b710f22 Mon Sep 17 00:00:00 2001 From: Petter Reinholdtsen Date: Mon, 9 Aug 1999 18:05:59 +0000 Subject: [PATCH] Initial revision --- LEVEL2 | 18 +++++ backend/mustek.desc | 46 +++++++++++ backend/mustek.h | 187 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 251 insertions(+) create mode 100644 LEVEL2 create mode 100644 backend/mustek.desc create mode 100644 backend/mustek.h diff --git a/LEVEL2 b/LEVEL2 new file mode 100644 index 000000000..a4715d430 --- /dev/null +++ b/LEVEL2 @@ -0,0 +1,18 @@ +Tue Jun 3 10:22:33 1997 + +Here are some ideas under discussion for the next major revision of +the SANE API: + + o Additional image data types, such as JPEG, MPEG, FlashPix, raw. + These would be useful for devices that directly generate such + formats (still cameras, for example). The raw image format could + be used when no other format is applicable. This would allow to + at least read and save the data in a file. This would probably + have to be coupled with adding a function that lets a frontend + tell the backend what level it supports, something like + sane_set_level (int max_supported_level). + [Based on suggestion by Andreas Beck ] + + o Support for other multimedia types, such as audio. This probably + would also require adding a write() interface to the SANE API. + [Suggested by Erik Troan .] diff --git a/backend/mustek.desc b/backend/mustek.desc new file mode 100644 index 000000000..3a7e75692 --- /dev/null +++ b/backend/mustek.desc @@ -0,0 +1,46 @@ +; SANE Backend specification file +; +; It's basically emacs-lisp --- so ";" indicates comment to end of line. +; All syntactic elements are keyword tokens, followed by a string or +; keyword argument, as specified. +; +; ":backend" *must* be specified. +; All other information is optional (but what good is the file without it?). +; + +:backend "mustek" ; name of backend +:version "0.73" ; version of backend +:status :beta ; :alpha, :beta, :stable, :new +:manpage "sane-mustek" ; name of manpage (if it exists) + +:devicetype :scanner + +:mfg "Mustek" ; name a manufacturer +:url "http://www.mustek.com/" +:model "MFC-600S" ; name models for above-specified mfg. +:comment "1 pass; (f/w >= 1.01; scsi id MFC-06000CZ)" +:model "MFC-600CD" ; name models for above-specified mfg. +:comment "1 pass; (f/w >= 2.03; scsi id MFC-06000CZ)" +:model "MFS-6000CX" +:comment "3 pass; (f/w >= 2.71; scsi id MSF-06000CX)" +:model "MSF-6000SP" +:comment "1 pass; (f/w >= 3.12; scsi id MSF-06000SP)" +:model "MFS-8000SP" +:comment "1 pass; (f/w >= 2.05; scsi id MSF-08000SP) lineart drops lines?" +:model "MFC-800S" +:comment "1 pass; (f/w == 1.06; scsi id MFC-08000CZ) color fails?" +:model "MFS-1200SP" +:comment "1 pass; (f/w == 1.00; scsi id MSF-12000SP)" +:model "MFS-1200SP" +:comment "1 pass; (f/w == 1.07; scsi id MFS-12000SP)" +:model "MFS-1200SP" +:comment "1 pass; (f/w == 1.02; scsi id MFS-12000SP) color fails?" +:model "MFS-12000CX" +:comment "3 pass; (f/w == 2.71; scsi id MFS-12000CX)" +:model "SE-6000SP" +:comment "1 pass; (f/w == ? ; scsi id C03 S10IDW)" +:model "SE-12000SP" +:comment "1 pass; (f/w == 1.01; scsi id C06 S12IDW)" + +; :comment and :url specifiers are optional after :mfg, :model, :desc, +; and at the top-level. diff --git a/backend/mustek.h b/backend/mustek.h new file mode 100644 index 000000000..55024170e --- /dev/null +++ b/backend/mustek.h @@ -0,0 +1,187 @@ +/* sane - Scanner Access Now Easy. + Copyright (C) 1996, 1997 David Mosberger-Tang, 1998 Andreas Bolsch for + extension to ScanExpress models version 0.5 + This file is part of the SANE package. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + As a special exception, the authors of SANE give permission for + additional uses of the libraries contained in this release of SANE. + + The exception is that, if you link a SANE library with other files + to produce an executable, this does not by itself cause the + resulting executable to be covered by the GNU General Public + License. Your use of that executable is in no way restricted on + account of linking the SANE library code into it. + + This exception does not, however, invalidate any other reasons why + the executable file might be covered by the GNU General Public + License. + + If you submit changes to SANE to the maintainers to be included in + a subsequent release, you agree by submitting the changes that + those changes may be distributed with this exception intact. + + If you write modifications of your own for SANE, it is your choice + whether to permit this exception to apply to your modifications. + If you do not wish that, delete this exception notice. */ +#ifndef mustek_h +#define mustek_h + +#include + +/* flag values: */ +#define MUSTEK_FLAG_SINGLE_PASS (1 << 0) /* single-pass scanner? */ +#define MUSTEK_FLAG_ADF (1 << 1) /* automatic document feeder */ +#define MUSTEK_FLAG_ADF_READY (1 << 2) /* paper present */ +#define MUSTEK_FLAG_TA (1 << 3) /* transparency adapter */ +#define MUSTEK_FLAG_USE_EIGHTS (1 << 4) /* use 1/8" lengths */ +#define MUSTEK_FLAG_LD_FIX (1 << 5) /* need line-distance fix? */ +#define MUSTEK_FLAG_LD_MFS (1 << 6) /* MFS line-distance corr? */ +#define MUSTEK_FLAG_LD_NONE (1 << 7) /* no line-distance corr? */ +#define MUSTEK_FLAG_LINEART_FIX (1 << 8) /* lineart fix/hack */ +#define MUSTEK_FLAG_PP (1 << 9) /* //-port scanner? */ +#define MUSTEK_FLAG_SE (1 << 10) /* ScanExpress model ? */ +#define MUSTEK_FLAG_DOUBLE_RES (1 << 11) /* MSF-06000CZ res. encoding */ + +/* source values: */ +#define MUSTEK_SOURCE_FLATBED 0 +#define MUSTEK_SOURCE_ADF 1 +#define MUSTEK_SOURCE_TA 2 + +/* mode values: */ +#define MUSTEK_MODE_MULTIBIT (1 << 0) /* one-bit vs multi-bit */ +#define MUSTEK_MODE_COLOR (1 << 1) /* grayscale vs color */ +#define MUSTEK_MODE_HALFTONE (1 << 2) /* use dithering? */ + +enum Mustek_Option + { + OPT_NUM_OPTS = 0, + + OPT_MODE_GROUP, + OPT_MODE, + OPT_RESOLUTION, + OPT_SPEED, + OPT_SOURCE, + OPT_BACKTRACK, + OPT_PREVIEW, + OPT_GRAY_PREVIEW, + + OPT_GEOMETRY_GROUP, + OPT_TL_X, /* top-left x */ + OPT_TL_Y, /* top-left y */ + OPT_BR_X, /* bottom-right x */ + OPT_BR_Y, /* bottom-right y */ + + OPT_ENHANCEMENT_GROUP, + OPT_GRAIN_SIZE, + OPT_BRIGHTNESS, + OPT_CONTRAST, + OPT_CUSTOM_GAMMA, /* use custom gamma tables? */ + /* The gamma vectors MUST appear in the order gray, red, green, + blue. */ + OPT_GAMMA_VECTOR, + OPT_GAMMA_VECTOR_R, + OPT_GAMMA_VECTOR_G, + OPT_GAMMA_VECTOR_B, + OPT_HALFTONE_DIMENSION, + OPT_HALFTONE_PATTERN, + + /* must come last: */ + NUM_OPTIONS + }; + +typedef union + { + SANE_Word w; + SANE_Word *wa; /* word array */ + SANE_String s; + } +Option_Value; + +typedef struct Mustek_Device + { + struct Mustek_Device *next; + SANE_Device sane; + SANE_Range dpi_range; + SANE_Range x_range; + SANE_Range y_range; + /* scan area when transparency adapter is used: */ + SANE_Range x_trans_range; + SANE_Range y_trans_range; + unsigned flags; + /* length of gamma table, probably always <= 4096 for the SE */ + int gamma_length; + /* values actually used by scanner, not necessarily the desired! */ + int bpl, lines; + /* what is needed for calibration */ + struct + { + int bytes; + int lines; + } + cal; + } +Mustek_Device; + +typedef struct Mustek_Scanner + { + /* all the state needed to define a scan request: */ + struct Mustek_Scanner *next; + + SANE_Option_Descriptor opt[NUM_OPTIONS]; + Option_Value val[NUM_OPTIONS]; + SANE_Int gamma_table[4][256]; + SANE_Int halftone_pattern[64]; + + int scanning; + int pass; /* pass number */ + int line; /* current line number */ + SANE_Parameters params; + + /* Parsed option values and variables that are valid only during + actual scanning: */ + int mode; + int one_pass_color_scan; + int resolution_code; + int fd; /* SCSI filedescriptor */ + pid_t reader_pid; /* process id of reader */ + int pipe; /* pipe to reader process */ + + /* scanner dependent/low-level state: */ + Mustek_Device *hw; + + /* line-distance correction related state: */ + struct + { + int color; /* first color appearing in read data */ + int max_value; + int peak_res; + int dist[3]; /* line distance */ + int index[3]; /* index for R/G/B color assignment */ + int quant[3]; /* for resolution correection */ + int saved[3]; /* number of saved color lines */ + /* these are used for SE, MFS and pp line-distance correction: */ + char *buf[3]; + /* these are used for parallel-port line-distance correction only: */ + int ld_line; /* line # currently processed in ld-correction */ + int lmod3; /* line # modulo 3 */ + } + ld; + } +Mustek_Scanner; + +#endif /* mustek_h */