• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* sane - Scanner Access Now Easy.
2 
3    Copyright (C) 2000-2005 Mustek.
4    Originally maintained by Mustek
5 
6    Copyright (C) 2001-2005 by Henning Meier-Geinitz.
7 
8    This file is part of the SANE package.
9 
10    This program is free software; you can redistribute it and/or
11    modify it under the terms of the GNU General Public License as
12    published by the Free Software Foundation; either version 2 of the
13    License, or (at your option) any later version.
14 
15    This program is distributed in the hope that it will be useful, but
16    WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18    General Public License for more details.
19 
20    You should have received a copy of the GNU General Public License
21    along with this program.  If not, see <https://www.gnu.org/licenses/>.
22 
23    As a special exception, the authors of SANE give permission for
24    additional uses of the libraries contained in this release of SANE.
25 
26    The exception is that, if you link a SANE library with other files
27    to produce an executable, this does not by itself cause the
28    resulting executable to be covered by the GNU General Public
29    License.  Your use of that executable is in no way restricted on
30    account of linking the SANE library code into it.
31 
32    This exception does not, however, invalidate any other reasons why
33    the executable file might be covered by the GNU General Public
34    License.
35 
36    If you submit changes to SANE to the maintainers to be included in
37    a subsequent release, you agree by submitting the changes that
38    those changes may be distributed with this exception intact.
39 
40    If you write modifications of your own for SANE, it is your choice
41    whether to permit this exception to apply to your modifications.
42    If you do not wish that, delete this exception notice.
43 
44    This file implements a SANE backend for the Mustek BearPaw 2448 TA Pro
45    and similar USB2 scanners. */
46 
47 #ifndef MUSTEK_USB2_H
48 #define MUSTEK_USB2_H
49 
50 #ifndef SANE_I18N
51 #define SANE_I18N(text) text
52 #endif
53 
54 #define ENABLE(OPTION)  s->opt[OPTION].cap &= ~SANE_CAP_INACTIVE
55 #define DISABLE(OPTION) s->opt[OPTION].cap |=  SANE_CAP_INACTIVE
56 #define IS_ACTIVE(OPTION) (((s->opt[OPTION].cap) & SANE_CAP_INACTIVE) == 0)
57 /* RIE: return if error */
58 #define RIE(function) do {status = function; if (status != SANE_STATUS_GOOD) \
59 return status;} while (SANE_FALSE)
60 
61 #define SCAN_BUFFER_SIZE (64 * 1024)
62 #define MAX_RESOLUTIONS 12
63 #define DEF_LINEARTTHRESHOLD 128
64 #define PER_ADD_START_LINES 0
65 #define PRE_ADD_START_X 0
66 
67 
68 enum Mustek_Usb_Option
69 {
70   OPT_NUM_OPTS = 0,
71   OPT_MODE_GROUP,
72   OPT_MODE,
73   OPT_SOURCE,
74   OPT_RESOLUTION,
75   OPT_PREVIEW,
76 
77   OPT_DEBUG_GROUP,
78   OPT_AUTO_WARMUP,
79 
80   OPT_ENHANCEMENT_GROUP,
81   OPT_THRESHOLD,
82   OPT_GAMMA_VALUE,
83 
84   OPT_GEOMETRY_GROUP,
85   OPT_TL_X,			/* top-left x */
86   OPT_TL_Y,			/* top-left y */
87   OPT_BR_X,			/* bottom-right x */
88   OPT_BR_Y,			/* bottom-right y */
89   /* must come last: */
90   NUM_OPTIONS
91 };
92 
93 
94 typedef struct Scanner_Model
95 {
96   /** @name Identification */
97   /*@{ */
98 
99   /** A single lowercase word to be used in the configuration file. */
100   SANE_String_Const name;
101 
102   /** Device vendor string. */
103   SANE_String_Const vendor;
104 
105   /** Device model name. */
106   SANE_String_Const model;
107 
108   /** Name of the firmware file. */
109   SANE_String_Const firmware_name;
110 
111   /** @name Scanner model parameters */
112   /*@{ */
113 
114   SANE_Int dpi_values[MAX_RESOLUTIONS];	/* possible resolutions */
115   SANE_Fixed x_offset;		/* Start of scan area in mm */
116   SANE_Fixed y_offset;		/* Start of scan area in mm */
117   SANE_Fixed x_size;		/* Size of scan area in mm */
118   SANE_Fixed y_size;		/* Size of scan area in mm */
119 
120   SANE_Fixed x_offset_ta;	/* Start of scan area in TA mode in mm */
121   SANE_Fixed y_offset_ta;	/* Start of scan area in TA mode in mm */
122   SANE_Fixed x_size_ta;		/* Size of scan area in TA mode in mm */
123   SANE_Fixed y_size_ta;		/* Size of scan area in TA mode in mm */
124 
125 
126   RGBORDER line_mode_color_order;	/* Order of the CCD/CIS colors */
127   SANE_Fixed default_gamma_value;	/* Default gamma value */
128 
129   SANE_Bool is_cis;		/* Is this a CIS or CCD scanner? */
130 
131   SANE_Word flags;		/* Which hacks are needed for this scanner? */
132   /*@} */
133 } Scanner_Model;
134 
135 typedef struct Mustek_Scanner
136 {
137   /* all the state needed to define a scan request: */
138   struct Mustek_Scanner *next;
139 
140   SANE_Option_Descriptor opt[NUM_OPTIONS];
141   Option_Value val[NUM_OPTIONS];
142   unsigned short *gamma_table;
143   SANE_Parameters params;   /**< SANE Parameters */
144   Scanner_Model model;
145   SETPARAMETERS setpara;
146   GETPARAMETERS getpara;
147   SANE_Bool bIsScanning;
148   SANE_Bool bIsReading;
149   SANE_Word read_rows;		/* transfer image's lines */
150   SANE_Byte *Scan_data_buf;	/*store Scanned data for transfer */
151   SANE_Byte *Scan_data_buf_start;	/*point to data need to transfer */
152   size_t scan_buffer_len;	/* length of data buf */
153 }
154 Mustek_Scanner;
155 
156 #endif
157