1 /* --------------------------------------------------------------------- */ 2 3 /* coolscan.h - headerfile for SANE-backend for coolscan scanners 4 5 This program is free software; you can redistribute it and/or 6 modify it under the terms of the GNU General Public License as 7 published by the Free Software Foundation; either version 2 of the 8 License, or (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, but 11 WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program. If not, see <https://www.gnu.org/licenses/>. 17 18 As a special exception, the authors of SANE give permission for 19 additional uses of the libraries contained in this release of SANE. 20 21 The exception is that, if you link a SANE library with other files 22 to produce an executable, this does not by itself cause the 23 resulting executable to be covered by the GNU General Public 24 License. Your use of that executable is in no way restricted on 25 account of linking the SANE library code into it. 26 27 This exception does not, however, invalidate any other reasons why 28 the executable file might be covered by the GNU General Public 29 License. 30 31 If you submit changes to SANE to the maintainers to be included in 32 a subsequent release, you agree by submitting the changes that 33 those changes may be distributed with this exception intact. 34 35 If you write modifications of your own for SANE, it is your choice 36 whether to permit this exception to apply to your modifications. 37 If you do not wish that, delete this exception notice. 38 39 */ 40 41 /* --------------------------------------------------------------------- */ 42 43 #ifndef coolscan_h 44 #define coolscan_h 45 46 #include "sys/types.h" 47 48 enum Coolscan_Option 49 { 50 OPT_NUM_OPTS = 0, 51 52 OPT_MODE_GROUP, 53 OPT_MODE, 54 OPT_SOURCE, 55 OPT_RESOLUTION, 56 OPT_PREVIEW_RESOLUTION, 57 OPT_TYPE, 58 OPT_BIT_DEPTH, 59 OPT_PRESCAN, 60 OPT_PRESCAN_NOW, 61 62 OPT_GEOMETRY_GROUP, 63 OPT_TL_X, /* top-left x */ 64 OPT_TL_Y, /* top-left y */ 65 OPT_BR_X, /* bottom-right x */ 66 OPT_BR_Y, /* bottom-right y */ 67 68 OPT_ENHANCEMENT_GROUP, 69 OPT_GAMMA_BIND, 70 OPT_ANALOG_GAMMA, 71 OPT_AVERAGING, 72 OPT_RGB_CONTROL, 73 74 OPT_BRIGHTNESS, 75 OPT_R_BRIGHTNESS, 76 OPT_G_BRIGHTNESS, 77 OPT_B_BRIGHTNESS, 78 79 OPT_CONTRAST, 80 OPT_R_CONTRAST, 81 OPT_G_CONTRAST, 82 OPT_B_CONTRAST, 83 84 OPT_EXPOSURE, 85 OPT_R_EXPOSURE, 86 OPT_G_EXPOSURE, 87 OPT_B_EXPOSURE, 88 89 OPT_R_SHIFT, 90 OPT_G_SHIFT, 91 OPT_B_SHIFT, 92 93 OPT_ADVANCED_GROUP, 94 OPT_PREVIEW, /* preview */ 95 OPT_AUTOFOCUS, /* autofocus */ 96 OPT_IRED_RED, 97 OPT_GAMMA_VECTOR, 98 OPT_GAMMA_VECTOR_R, 99 OPT_GAMMA_VECTOR_G, 100 OPT_GAMMA_VECTOR_B, 101 102 /* must come last: */ 103 NUM_OPTIONS 104 }; 105 106 107 typedef struct Image_Pos 108 { int start; /* start position of image on film strip */ 109 int end; /* end position of image on film strip */ 110 int offset /* always 0 */; 111 int height; /* image height always 2591 */ 112 } Image_Pos_t; 113 114 115 116 117 typedef struct Coolscan 118 { 119 struct Coolscan *next; 120 121 SANE_Option_Descriptor opt[NUM_OPTIONS]; 122 123 SANE_Pid reader_pid; 124 int reader_fds; 125 int pipe; 126 int scanning; 127 /*--------------------------*/ 128 SANE_Device sane; 129 SANE_Range dpi_range; 130 SANE_Range x_range; 131 SANE_Range y_range; 132 133 /*--------------------------*/ 134 /* buffer used for scsi-transfer and writing*/ 135 unsigned char *buffer; 136 unsigned char *obuffer; 137 unsigned int row_bufsize; 138 139 char *devicename; /* name of the scanner device */ 140 int sfd; /* output file descriptor, scanner device */ 141 142 char vendor[9]; /* will be Nikon */ 143 char product[17]; /* e.g. "LS-1000 " or so */ 144 char version[5]; /* e.g. V1.6 */ 145 146 int LS; /* index in scanner_str */ 147 int cont; /* continue although scanner is unknown */ 148 int verbose; /* 1,2=output information */ 149 int asf; /* Automatic Slide Feeder enabled? */ 150 151 int MUD; /* Measurement Unit Divisor (1200 or 2700) */ 152 153 int inquiry_len; /* length of inquiry return block [36] */ 154 int inquiry_wdb_len; /* length of window descriptor block [117] */ 155 156 int wdb_len; /* use this length of WDB */ 157 158 double width; /* use this width of scan-area */ 159 double length; /* use this length of scan-area */ 160 161 int x_nres; 162 int y_nres; 163 164 int x_p_nres; /* same as above, but apply to preview */ 165 int y_p_nres; 166 167 168 int tlx; /* Left edge in 'Internal Length Units'. */ 169 int tly; /* Top edge in ILU */ 170 int brx; /* Right edge in ILU. */ 171 int bry; /* Bottom edge in ILU. */ 172 173 int bits_per_color; /* bits per color (8/10/12) */ 174 int bits_per_pixel; /* bits per pixel (24/30/40) */ 175 int negative; /* Negative/positive object */ 176 int dropoutcolor; /* Which color to scan when gray */ 177 int transfermode; /**/ 178 int gammaselection; /* Linear/Monitor*/ 179 int shading; 180 int averaging; 181 int brightness_R; 182 int brightness_G; 183 int brightness_B; 184 int contrast_R; 185 int contrast_G; 186 int contrast_B; 187 int exposure_R; 188 int exposure_G; 189 int exposure_B; 190 int shift_R; 191 int shift_G; 192 int shift_B; 193 int set_auto; /* 0 or 1, don't know what it is */ 194 int preview; /* 1 if preview */ 195 int autofocus; /* when to do autofocus */ 196 #define AF_NEVER 0x00 197 #define AF_PREVIEW 0x01 198 #define AF_SCAN 0x02 199 #define AF_PREANDSCAN 0x03 200 201 int colormode; /* GREYSCALE or RGB */ 202 int colormode_p; /* GREYSCALE or RGB for preview */ 203 #define GREYSCALE 0x01 204 #define RGB 0x07 205 #define IRED 0x08 206 #define RGBI 0x0f 207 208 int low_byte_first; /* 1 if little-endian - 0 if big-endian */ 209 210 /* Internal information */ 211 int adbits; /* Number of A/D bits [8 or 12] */ 212 int outputbits; /* Number of output image data bits [8] */ 213 int maxres; /* Maximum resolution [2700] (dpi) */ 214 int xmax; /* X-axis coordinate maximum value 215 (basic measurement unit when measurement 216 unit divisor = 1200) [1151] */ 217 int ymax; /* Y-axis coordinate maximum value 218 (basic measurement unit when measurement 219 unit divisor = 1200) [1727] */ 220 int xmaxpix; /* X-axis coordinate maximum value (pixel 221 address value) [2591] */ 222 int ymaxpix; /* Y-axis coordinate maximum value (pixel 223 address value) [3887] */ 224 int ycurrent; /* Current stage position (Y-axis direction 225 pixel address) [0-7652] */ 226 int currentfocus; /* Current focus position (focus direction 227 address) [0-200] */ 228 int currentscanpitch; /* Current scan pitch [1-25] */ 229 int autofeeder; /* Provision of auto feeder [Yes: 1, No: 0] */ 230 int analoggamma; /* Analog gamma support [Yes: 1, No: 0] */ 231 int derr[8]; /* Device error code (0 is latest, 7 oldest) */ 232 int wbetr_r; /* White balance exposure time variable (R) */ 233 int webtr_g; /* White balance exposure time variable (G) */ 234 int webtr_b; /* White balance exposure time variable (B) */ 235 int pretv_r; /* Prescan result exposure time variable (R) */ 236 int pretv_g; /* Prescan result exposure time variable (G) */ 237 int pretv_b; /* Prescan result exposure time variable (B) */ 238 int cetv_r; /* Current exposure time variable (R) */ 239 int cetv_g; /* Current exposure time variable (G) */ 240 int cetv_b; /* Current exposure time variable (B) */ 241 int ietu_r; /* Internal exposure time unit (R) */ 242 int ietu_g; /* Internal exposure time unit (G) */ 243 int ietu_b; /* Internal exposure time unit (B) */ 244 int limitcondition; /* Condition of each limit SW, DIP SW, etc. */ 245 int offsetdata_r; /* Offset data (R) */ 246 int offsetdata_g; /* Offset data (G) */ 247 int offsetdata_b; /* Offset data (B) */ 248 char power_on_errors[8]; /* Records of error code at power on */ 249 /* End of internal information */ 250 251 int brightness; /* (128) cbhs_range 0-255, halftone mode */ 252 int contrast; /* (128) cbhs_range 0-255, halftone-mode */ 253 254 int prescan; /* */ 255 int rgb_control; /* */ 256 int gamma_bind; /* TRUE -> RGB */ 257 int lutlength; /* length of gamma table */ 258 int max_lut_val; /* maximum value in lut */ 259 SANE_Word gamma[4096]; /* gamma value for RGB */ 260 SANE_Word gamma_r[4096]; /* gamma value for red */ 261 SANE_Word gamma_g[4096]; /* gamma value for green */ 262 SANE_Word gamma_b[4096]; /* gamma value for blue */ 263 264 int luti[4096]; /* lut value for infrared */ 265 int lutr[4096]; /* lut value for red */ 266 int lutg[4096]; /* lut value for green */ 267 int lutb[4096]; /* lut value for blue */ 268 269 char *gamma_file_r; /* file for gamma download */ 270 char *gamma_file_g; /* file for gamma download */ 271 char *gamma_file_b; /* file for gamma download */ 272 273 int analog_gamma_r; /* analog gamma red and grey */ 274 int analog_gamma_g; /* analog gamma green */ 275 int analog_gamma_b; /* analog gamma blue */ 276 277 /* Infrared correction values */ 278 int ired_red; 279 int ired_green; 280 int ired_blue; 281 282 int feeder; /* type of feeder used */ 283 int numima; /* number of images on film strip */ 284 int posima; /* current image */ 285 Image_Pos_t ipos[6]; /* positions for 6 images */ 286 #define STRIP_FEEDER 1 287 #define MOUNT_FEEDER 2 288 } 289 Coolscan_t; 290 291 292 293 294 typedef struct 295 { 296 char *scanner; 297 char *inquiry; 298 int inquiry_len; 299 } 300 inquiry_blk; 301 302 303 /* ==================================================================== */ 304 305 /* names of scanners that are supported because */ 306 /* the inquiry_return_block is ok and driver is tested */ 307 308 static char *scanner_str[] = 309 { 310 "COOLSCAN II ", 311 "LS-1000 ", 312 "COOLSCANIII ", 313 "LS-2000 ", 314 }; 315 316 #define known_scanners 4 317 318 /* Comment this line if you haven't patched sane.h to include 319 SANE_FRAME_RGBA */ 320 /* #define HAS_IRED 1 */ 321 322 #endif /* coolscan-sane_h */ 323