1 /** @file plustek-pp.h 2 * @brief Definitions for the backend. 3 * 4 * Based on Kazuhiro Sasayama previous 5 * Work on plustek.[ch] file from the SANE package.<br> 6 * 7 * original code taken from sane-0.71<br> 8 * Copyright (C) 1997 Hypercore Software Design, Ltd.<br> 9 * Copyright (C) 2001-2013 Gerhard Jaeger <gerhard@gjaeger.de> 10 * 11 * History: 12 * - 0.01 - initial version 13 * - 0.43 - bumped up version to reflect the former module code version 14 * - removed Version from ScannerCaps 15 * - added _E_FAULT 16 * - 0.44 - fix UL issues, as Long types default to int32_t now 17 * . 18 * <hr> 19 * This file is part of the SANE package. 20 * 21 * This program is free software; you can redistribute it and/or 22 * modify it under the terms of the GNU General Public License as 23 * published by the Free Software Foundation; either version 2 of the 24 * License, or (at your option) any later version. 25 * 26 * This program is distributed in the hope that it will be useful, but 27 * WITHOUT ANY WARRANTY; without even the implied warranty of 28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 * General Public License for more details. 30 * 31 * You should have received a copy of the GNU General Public License 32 * along with this program. If not, see <https://www.gnu.org/licenses/>. 33 * 34 * As a special exception, the authors of SANE give permission for 35 * additional uses of the libraries contained in this release of SANE. 36 * 37 * The exception is that, if you link a SANE library with other files 38 * to produce an executable, this does not by itself cause the 39 * resulting executable to be covered by the GNU General Public 40 * License. Your use of that executable is in no way restricted on 41 * account of linking the SANE library code into it. 42 * 43 * This exception does not, however, invalidate any other reasons why 44 * the executable file might be covered by the GNU General Public 45 * License. 46 * 47 * If you submit changes to SANE to the maintainers to be included in 48 * a subsequent release, you agree by submitting the changes that 49 * those changes may be distributed with this exception intact. 50 * 51 * If you write modifications of your own for SANE, it is your choice 52 * whether to permit this exception to apply to your modifications. 53 * If you do not wish that, delete this exception notice. 54 * <hr> 55 */ 56 #ifndef __PLUSTEKPP_H__ 57 #define __PLUSTEKPP_H__ 58 59 /*............................................................................. 60 * the structures for driver communication 61 */ 62 typedef struct { 63 unsigned short x; 64 unsigned short y; 65 } XY, *pXY; 66 67 typedef struct { 68 unsigned short x; 69 unsigned short y; 70 unsigned short cx; 71 unsigned short cy; 72 } CropRect, *pCropRect; 73 74 typedef struct image { 75 unsigned long dwFlag; 76 CropRect crArea; 77 XY xyDpi; 78 unsigned short wDataType; 79 } ImgDef, *pImgDef; 80 81 typedef struct { 82 unsigned long dwPixelsPerLine; 83 unsigned long dwBytesPerLine; 84 unsigned long dwLinesPerArea; 85 struct image ImgDef; 86 } CropInfo, *pCropInfo; 87 88 /** definition of gamma maps 89 */ 90 typedef struct { 91 int len; /**< gamma table len */ 92 int depth; /**< entry bit depth */ 93 int map_id; /**< what map */ 94 void *map; /**< pointer for map */ 95 } MapDef, *pMapDef; 96 97 /** for offset stuff 98 */ 99 typedef struct { 100 int x; 101 int y; 102 } OffsDef, *pOffsDef; 103 104 /** useful for description tables 105 */ 106 typedef struct { 107 int id; 108 char *desc; 109 } TabDef, *pTabDef; 110 111 /** for defining the scanmodes 112 */ 113 typedef const struct mode_param 114 { 115 int color; 116 int depth; 117 int scanmode; 118 } ModeParam, *pModeParam; 119 120 /** 121 */ 122 #define SFLAG_ADF 0x00000010 /* Automatic document feeder */ 123 #define SFLAG_MFP 0x00000020 /* MF-Keypad support */ 124 #define SFLAG_SheetFed 0x00000040 /* Sheetfed support */ 125 #define SFLAG_TPA 0x00000080 /* has transparency adapter */ 126 #define SFLAG_CUSTOM_GAMMA 0x00000200 /* driver supports custom gamma */ 127 128 /** 129 */ 130 #define SCANDEF_Inverse 0x00000001 131 #define SCANDEF_UnlimitLength 0x00000002 132 #define SCANDEF_StopWhenPaperOut 0x00000004 133 #define SCANDEF_BoundaryDWORD 0x00000008 134 #define SCANDEF_ColorBGROrder 0x00000010 135 #define SCANDEF_BmpStyle 0x00000020 136 #define SCANDEF_BoundaryWORD 0x00000040 137 #define SCANDEF_NoMap 0x00000080 /* specified this flag will */ 138 /* cause system ignores the */ 139 /* siBrightness & siContrast */ 140 #define SCANDEF_Transparency 0x00000100 /* Scanning from transparency*/ 141 #define SCANDEF_Negative 0x00000200 /* Scanning from negative */ 142 #define SCANDEF_QualityScan 0x00000400 /* Scanning in quality mode */ 143 #define SCANDEF_BuildBwMap 0x00000800 /* Set default map */ 144 #define SCANDEF_ContinuousScan 0x00001000 145 #define SCANDEF_DontBackModule 0x00002000 /* module will not back to */ 146 /* home after image scanned */ 147 #define SCANDEF_RightAlign 0x00008000 /* 12-bit */ 148 149 #define SCANDEF_TPA (SCANDEF_Transparency | SCANDEF_Negative) 150 151 #define SCANDEF_Adf 0x00020000 /* Scan from ADF tray */ 152 153 /* these values will be combined with ScannerInfo.dwFlag */ 154 #define _SCANNER_SCANNING 0x8000000 155 #define _SCANNER_PAPEROUT 0x4000000 156 157 /* for GetLensInformation */ 158 #if 0 159 #define SOURCE_Reflection 0 160 #define SOURCE_Transparency 1 161 #define SOURCE_Negative 2 162 #define SOURCE_ADF 3 163 #endif 164 165 /****************************************************************************** 166 * Section 6 - additional definitions 167 */ 168 169 /* scan modes */ 170 #define COLOR_BW 0 171 #define COLOR_HALFTONE 1 172 #define COLOR_256GRAY 2 173 #define COLOR_TRUE24 3 174 #define COLOR_TRUE32 4 175 #define COLOR_TRUE48 4 /* not sure if this should be the same as 32 */ 176 #define COLOR_TRUE36 5 177 178 /* We don't support halftone mode now --> Plustek statement for USB */ 179 #define COLOR_GRAY16 6 180 181 #define _MEASURE_BASE 300UL 182 183 /** transparency/negative mode set ranges 184 */ 185 #define _TPAPageWidth 500U /* org. was 450 = 38.1 mm */ 186 #define _TPAPageHeight 510U /* org. was 460 = 38.9 mm */ 187 #define _TPAModeSupportMin COLOR_TRUE24 188 #define _TPAModeSupportMax COLOR_TRUE48 189 #define _TPAModeSupportDef COLOR_TRUE24 190 #define _TPAMinDpi 150 191 192 #define _NegativePageWidth 460U /* 38.9 mm */ 193 #define _NegativePageHeight 350U /* 29.6 mm */ 194 195 #define _DEF_DPI 50 196 197 /* 198 * additional shared stuff between user-world and kernel mode 199 */ 200 #define _VAR_NOT_USED(x) ((x)=(x)) 201 202 /* 203 * for Gamma tables 204 */ 205 #define _MAP_RED 0 206 #define _MAP_GREEN 1 207 #define _MAP_BLUE 2 208 #define _MAP_MASTER 3 209 210 /* 211 * generic error codes... 212 */ 213 #define _OK 0 214 215 #define _FIRST_ERR -9000 216 217 #define _E_INIT (_FIRST_ERR-1) /* already initialized */ 218 #define _E_NOT_INIT (_FIRST_ERR-2) /* not initialized */ 219 #define _E_NULLPTR (_FIRST_ERR-3) /* internal NULL-PTR detected */ 220 #define _E_ALLOC (_FIRST_ERR-4) /* error allocating memory */ 221 #define _E_TIMEOUT (_FIRST_ERR-5) /* signals a timeout condition */ 222 #define _E_INVALID (_FIRST_ERR-6) /* invalid parameter detected */ 223 #define _E_INTERNAL (_FIRST_ERR-7) /* internal error */ 224 #define _E_BUSY (_FIRST_ERR-8) /* device is already in use */ 225 #define _E_ABORT (_FIRST_ERR-9) /* operation aborted */ 226 #define _E_LOCK (_FIRST_ERR-10) /* can't lock resource */ 227 #define _E_NOSUPP (_FIRST_ERR-11) /* feature or device not supported */ 228 #define _E_NORESOURCE (_FIRST_ERR-12) /* out of memo, resource busy... */ 229 #define _E_VERSION (_FIRST_ERR-19) /* version conflict */ 230 #define _E_NO_DEV (_FIRST_ERR-20) /* device does not exist */ 231 #define _E_NO_CONN (_FIRST_ERR-21) /* nothing connected */ 232 #define _E_PORTSEARCH (_FIRST_ERR-22) /* parport_enumerate failed */ 233 #define _E_NO_PORT (_FIRST_ERR-23) /* requested port does not exist */ 234 #define _E_REGISTER (_FIRST_ERR-24) /* cannot register this device */ 235 #define _E_SEQUENCE (_FIRST_ERR-30) /* caller sequence does not match */ 236 #define _E_NO_ASIC (_FIRST_ERR-31) /* can't detect ASIC */ 237 238 # define _E_FAULT (_E_INTERNAL) /* should never happen in userspace */ 239 240 #define _E_LAMP_NOT_IN_POS (_FIRST_ERR-40) 241 #define _E_LAMP_NOT_STABLE (_FIRST_ERR-41) 242 #define _E_NODATA (_FIRST_ERR-42) 243 #define _E_BUFFER_TOO_SMALL (_FIRST_ERR-43) 244 #define _E_DATAREAD (_FIRST_ERR-44) 245 246 247 /************************ some definitions ***********************************/ 248 249 /* NOTE: needs to be kept in sync with table below */ 250 #define MODELSTR static char *ModelStr[] = { \ 251 "unknown", \ 252 "Primax 4800", \ 253 "Primax 4800 Direct", \ 254 "Primax 4800 Direct 30Bit", \ 255 "Primax 9600 Direct 30Bit", \ 256 "4800P", \ 257 "4830P", \ 258 "600P/6000P", \ 259 "4831P", \ 260 "9630P", \ 261 "9630PL", \ 262 "9636P", \ 263 "A3I", \ 264 "12000P/96000P", \ 265 "9636P+/Turbo", \ 266 "9636T/12000T", \ 267 "P8", \ 268 "P12", \ 269 "PT12", \ 270 "Genius Colorpage Vivid III V2", \ 271 "USB-Device" \ 272 } 273 274 /* the models */ 275 #define MODEL_OP_UNKNOWN 0 /* unknown */ 276 #define MODEL_PMX_4800 1 /* Primax Colorado 4800 like OP 4800 */ 277 #define MODEL_PMX_4800D 2 /* Primax Compact 4800 Direct, OP 600 R->G, G->R */ 278 #define MODEL_PMX_4800D3 3 /* Primax Compact 4800 Direct 30 */ 279 #define MODEL_PMX_9600D3 4 /* Primax Compact 9600 Direct 30 */ 280 #define MODEL_OP_4800P 5 /* 32k, 96001 ASIC, 24 bit, 300x600, 8.5x11.69 */ 281 #define MODEL_OP_4830P 6 /* 32k, 96003 ASIC, 30 bit, 300x600, 8.5x11.69 */ 282 #define MODEL_OP_600P 7 /* 32k, 96003 ASIC, 30 bit, 300x600, 8.5x11.69 */ 283 #define MODEL_OP_4831P 8 /* 128k, 96003 ASIC, 30 bit, 300x600, 8.5x11.69 */ 284 #define MODEL_OP_9630P 9 /* 128k, 96003 ASIC, 30 bit, 600x1200, 8.5x11.69 */ 285 #define MODEL_OP_9630PL 10 /* 128k, 96003 ASIC, 30 bit, 600x1200, 8.5x14 */ 286 #define MODEL_OP_9636P 11 /* 512k, 98001 ASIC, 36 bit, 600x1200, 8.5x11.69 */ 287 #define MODEL_OP_A3I 12 /* 128k, 96003 ASIC, 30 bit, 400x800, 11.69x17 */ 288 #define MODEL_OP_12000P 13 /* 128k, 96003 ASIC, 30 bit, 600x1200, 8.5x11.69 */ 289 #define MODEL_OP_9636PP 14 /* 512k, 98001 ASIC, 36 bit, 600x1200, 8.5x11.69 */ 290 #define MODEL_OP_9636T 15 /* like OP_9636PP + transparency */ 291 #define MODEL_OP_P8 16 /* 512k, 98003 ASIC, 36 bit, 300x600, 8.5x11.69 */ 292 #define MODEL_OP_P12 17 /* 512k, 98003 ASIC, 36 bit, 600x1200, 8.5x11.69 */ 293 #define MODEL_OP_PT12 18 /* like OP_P12 + transparency */ 294 #define MODEL_GEN_CPV2 19 /* Genius Colorpage Vivid III V2, ASIC 98003 */ 295 #define MODEL_UNKNOWN 20 /* not known/supported */ 296 297 #define _NO_BASE 0xFFFF 298 299 /******************** from former plustek-share.h ***************************/ 300 301 /* 302 * for other OS than Linux, we might have to define the _IO macros 303 */ 304 #ifndef _IOC 305 #define _IOC(dir,type,nr,size) \ 306 (((dir) << 30) | \ 307 ((type) << 8) | \ 308 ((nr) << 0) | \ 309 ((size) << 16)) 310 #endif 311 312 #ifndef _IOC_DIR 313 #define _IOC_DIR(cmd) (((cmd) >> 30) & 0x3) 314 #endif 315 316 #ifndef _IOC_SIZE 317 #define _IOC_SIZE(cmd) (((cmd) >> 16) & 0x3FFF) 318 #endif 319 320 #ifndef _IOC_WRITE 321 #define _IOC_WRITE 1U 322 #endif 323 324 #ifndef _IO 325 #define _IO(type,nr) _IOC(0U,(type),(nr),0) 326 #endif 327 328 #ifndef _IOR 329 #define _IOR(type,nr,size) _IOC(2U,(type),(nr),((UInt)sizeof(size))) 330 #endif 331 332 #ifndef _IOW 333 #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),((UInt)sizeof(size))) 334 #endif 335 336 #ifndef _IOWR 337 #define _IOWR(type,nr,size) _IOC(3U,(type),(nr),((UInt)sizeof(size))) 338 #endif 339 340 /*............................................................................. 341 * the ioctl interface 342 */ 343 #define _PTDRV_OPEN_DEVICE _IOW('x', 1, unsigned short)/* open */ 344 #define _PTDRV_GET_CAPABILITIES _IOR('x', 2, ScannerCaps) /* get caps */ 345 #define _PTDRV_GET_LENSINFO _IOR('x', 3, LensInfo) /* get lenscaps */ 346 #define _PTDRV_PUT_IMAGEINFO _IOW('x', 4, ImgDef) /* put image info*/ 347 #define _PTDRV_GET_CROPINFO _IOR('x', 5, CropInfo) /* get crop */ 348 #define _PTDRV_SET_ENV _IOWR('x',6, ScanInfo) /* set env. */ 349 #define _PTDRV_START_SCAN _IOR('x', 7, StartScan) /* start scan */ 350 #define _PTDRV_STOP_SCAN _IOWR('x', 8, short) /* stop scan */ 351 #define _PTDRV_CLOSE_DEVICE _IO('x', 9) /* close */ 352 #define _PTDRV_ACTION_BUTTON _IOR('x', 10, unsigned char)/* rd act. button*/ 353 #define _PTDRV_ADJUST _IOR('x', 11, AdjDef) /* adjust driver */ 354 #define _PTDRV_SETMAP _IOR('x', 12, MapDef) /* download gamma*/ 355 356 /* 357 * this version MUST match the one inside the driver to make sure, that 358 * both sides use the same structures. This version changes each time 359 * the ioctl interface changes 360 */ 361 #define _PTDRV_COMPAT_IOCTL_VERSION 0x0102 362 #define _PTDRV_IOCTL_VERSION 0x0104 363 364 /** for adjusting the parport stuff 365 */ 366 typedef struct { 367 int lampOff; 368 int lampOffOnEnd; 369 int warmup; 370 int enableTpa; 371 372 OffsDef pos; /* for adjusting normal scan area */ 373 OffsDef tpa; /* for adjusting transparency scan area */ 374 OffsDef neg; /* for adjusting negative scan area */ 375 376 /* for adjusting the default gamma settings */ 377 double rgamma; 378 double ggamma; 379 double bgamma; 380 381 double graygamma; 382 383 } PPAdjDef, *pPPAdjDef; 384 385 /** for adjusting the scanner settings 386 */ 387 typedef struct { 388 389 int direct_io; 390 int mov; 391 392 int lampOff; 393 int lampOffOnEnd; 394 int warmup; 395 396 OffsDef pos; /* for adjusting normal scan area */ 397 OffsDef tpa; /* for adjusting transparency scan area */ 398 OffsDef neg; /* for adjusting negative scan area */ 399 400 /* for adjusting the default gamma settings */ 401 double rgamma; 402 double ggamma; 403 double bgamma; 404 405 double graygamma; 406 407 } AdjDef, *pAdjDef; 408 409 typedef struct { 410 unsigned long dwFlag; /* refer to SECTION (1.2) */ 411 unsigned long dwBytesPerLine; 412 unsigned long dwLinesPerScan; 413 } StartScan, *pStartScan; 414 415 typedef struct { 416 unsigned short wMin; /* minimum value */ 417 unsigned short wDef; /* default value */ 418 unsigned short wMax; /* software maximum value */ 419 unsigned short wPhyMax; /* hardware maximum value (for DPI only)*/ 420 } RANGE, *PRANGE; 421 422 typedef struct { 423 RANGE rDataType; /* available scan modes */ 424 unsigned long dwFlag; /* refer to SECTION (1.2) */ 425 unsigned short wIOBase; /* refer to SECTION (1.3) */ 426 unsigned short wMaxExtentX; /* scanarea width */ 427 unsigned short wMaxExtentY; /* scanarea height */ 428 unsigned short AsicID; /* copy of RegAsicID */ 429 unsigned short Model; /* model as best we can determine */ 430 } ScannerCaps, *pScannerCaps; 431 432 typedef struct { 433 RANGE rDpiX; 434 RANGE rDpiY; 435 RANGE rExtentX; 436 RANGE rExtentY; 437 unsigned short wBeginX; /* offset from left */ 438 unsigned short wBeginY; /* offset from top */ 439 } LensInfo, *pLensInfo; 440 441 typedef struct { 442 unsigned char* pDither; 443 void* pMap; 444 ImgDef ImgDef; 445 unsigned short wMapType; /* refer to SECTION (3.2) */ 446 unsigned short wDither; /* refer to SECTION (3.3) */ 447 short siBrightness; /* refer to SECTION (3.5) */ 448 short siContrast; /* refer to SECTION (3.6) */ 449 } ScanInfo, *pScanInfo; 450 451 452 /* IDs the ASIC returns */ 453 #define _ASIC_IS_96001 0x0f /* value for 96001 */ 454 #define _ASIC_IS_96003 0x10 /* value for 96003 */ 455 #define _ASIC_IS_98001 0x81 /* value for 98001 */ 456 #define _ASIC_IS_98003 0x83 /* value for 98003 */ 457 458 #define _Transparency48OriginOffsetX 375 459 #define _Transparency48OriginOffsetY 780 460 461 #define _Transparency96OriginOffsetX 0x03DB /* org. was 0x0430 */ 462 #define _Negative96OriginOffsetX 0x03F3 /* org. was 0x0428 */ 463 464 /** Scanmodes 465 */ 466 #define _ScanMode_Color 0 467 #define _ScanMode_AverageOut 1 /* CCD averaged 2 pixels value for output*/ 468 #define _ScanMode_Mono 2 /* not color mode */ 469 470 #define PLUSTEK_CONFIG_FILE "plustek_pp.conf" 471 472 #ifndef PATH_MAX 473 # define PATH_MAX 1024 474 #endif 475 476 /* 477 * the default image size 478 */ 479 #define _DEFAULT_TLX 0 /* 0..216 mm */ 480 #define _DEFAULT_TLY 0 /* 0..297 mm */ 481 #define _DEFAULT_BRX 126 /* 0..216 mm*/ 482 #define _DEFAULT_BRY 76.21 /* 0..297 mm */ 483 484 #define _DEFAULT_TP_TLX 3.5 /* 0..42.3 mm */ 485 #define _DEFAULT_TP_TLY 10.5 /* 0..43.1 mm */ 486 #define _DEFAULT_TP_BRX 38.5 /* 0..42.3 mm */ 487 #define _DEFAULT_TP_BRY 33.5 /* 0..43.1 mm */ 488 489 #define _DEFAULT_NEG_TLX 1.5 /* 0..38.9 mm */ 490 #define _DEFAULT_NEG_TLY 1.5 /* 0..29.6 mm */ 491 #define _DEFAULT_NEG_BRX 37.5 /* 0..38.9 mm */ 492 #define _DEFAULT_NEG_BRY 25.5 /* 0..29.6 mm */ 493 494 /** image sizes for normal, transparent and negative modes 495 */ 496 #define _TP_X ((double)_TPAPageWidth/300.0 * MM_PER_INCH) 497 #define _TP_Y ((double)_TPAPageHeight/300.0 * MM_PER_INCH) 498 #define _NEG_X ((double)_NegativePageWidth/300.0 * MM_PER_INCH) 499 #define _NEG_Y ((double)_NegativePageHeight/300.0 * MM_PER_INCH) 500 501 /************************ some structures ************************************/ 502 503 enum { 504 OPT_NUM_OPTS = 0, 505 OPT_MODE_GROUP, 506 OPT_MODE, 507 OPT_EXT_MODE, 508 OPT_RESOLUTION, 509 OPT_PREVIEW, 510 OPT_GEOMETRY_GROUP, 511 OPT_TL_X, 512 OPT_TL_Y, 513 OPT_BR_X, 514 OPT_BR_Y, 515 OPT_ENHANCEMENT_GROUP, 516 OPT_HALFTONE, 517 OPT_BRIGHTNESS, 518 OPT_CONTRAST, 519 OPT_CUSTOM_GAMMA, 520 OPT_GAMMA_VECTOR, 521 OPT_GAMMA_VECTOR_R, 522 OPT_GAMMA_VECTOR_G, 523 OPT_GAMMA_VECTOR_B, 524 NUM_OPTIONS 525 }; 526 527 /** for compatibility to version 0x0102 drivers 528 */ 529 typedef struct { 530 531 int lampOff; 532 int lampOffOnEnd; 533 int warmup; 534 535 OffsDef pos; /* for adjusting normal scan area */ 536 OffsDef tpa; /* for adjusting transparency scan area */ 537 OffsDef neg; /* for adjusting negative scan area */ 538 539 } CompatAdjDef, *pCompatAdjDef; 540 541 /** 542 */ 543 typedef struct Plustek_Device 544 { 545 SANE_Int initialized; /* device already initialized? */ 546 struct Plustek_Device *next; /* pointer to next dev in list */ 547 int fd; /* device handle */ 548 char *name; /* (to avoid compiler warnings!)*/ 549 SANE_Device sane; /* info struct */ 550 SANE_Int max_x; /* max XY-extension of the scan-*/ 551 SANE_Int max_y; /* area */ 552 SANE_Range dpi_range; /* resolution range */ 553 SANE_Range x_range; /* x-range of the scan-area */ 554 SANE_Range y_range; /* y-range of the scan-area */ 555 SANE_Int *res_list; /* to hold the available phys. */ 556 SANE_Int res_list_size; /* resolution values */ 557 ScannerCaps caps; /* caps reported by the driver */ 558 AdjDef adj; /* for driver adjustment */ 559 560 /* 561 * each device we support may need other access functions... 562 */ 563 int (*open) ( const char*, void* ); 564 int (*close) ( struct Plustek_Device* ); 565 void (*shutdown) ( struct Plustek_Device* ); 566 int (*getCaps) ( struct Plustek_Device* ); 567 int (*getLensInfo)( struct Plustek_Device*, pLensInfo ); 568 int (*getCropInfo)( struct Plustek_Device*, pCropInfo ); 569 int (*putImgInfo) ( struct Plustek_Device*, pImgDef ); 570 int (*setScanEnv) ( struct Plustek_Device*, pScanInfo ); 571 int (*setMap) ( struct Plustek_Device*, SANE_Word*, 572 SANE_Word, SANE_Word ); 573 int (*startScan) ( struct Plustek_Device*, pStartScan ); 574 int (*stopScan) ( struct Plustek_Device*, short* ); 575 int (*readImage) ( struct Plustek_Device*, SANE_Byte*, unsigned long ); 576 577 int (*prepare) ( struct Plustek_Device*, SANE_Byte* ); 578 int (*readLine) ( struct Plustek_Device* ); 579 580 } Plustek_Device, *pPlustek_Device; 581 582 #ifndef SANE_OPTION 583 /* for compatibility with older versions */ 584 typedef union 585 { 586 SANE_Word w; 587 SANE_Word *wa; /* word array */ 588 SANE_String s; 589 } Option_Value; 590 #endif 591 592 typedef struct Plustek_Scanner 593 { 594 struct Plustek_Scanner *next; 595 SANE_Pid reader_pid; /* process id of reader */ 596 SANE_Status exit_code; /* status of the reader process */ 597 int r_pipe; /* pipe to reader process */ 598 int w_pipe; /* pipe from reader process */ 599 unsigned long bytes_read; /* number of bytes currently read*/ 600 Plustek_Device *hw; /* pointer to current device */ 601 Option_Value val[NUM_OPTIONS]; 602 SANE_Byte *buf; /* the image buffer */ 603 SANE_Bool scanning; /* TRUE during scan-process */ 604 SANE_Parameters params; /* for keeping the parameter */ 605 606 /************************** gamma tables *********************************/ 607 608 SANE_Word gamma_table[4][4096]; 609 SANE_Range gamma_range; 610 int gamma_length; 611 612 SANE_Option_Descriptor opt[NUM_OPTIONS]; 613 614 } Plustek_Scanner, *pPlustek_Scanner; 615 616 /** for collecting configuration info... 617 */ 618 typedef struct { 619 620 char devName[PATH_MAX]; 621 622 /* contains the stuff to adjust... */ 623 AdjDef adj; 624 625 } CnfDef, *pCnfDef; 626 627 #endif /* guard __PLUSTEKPP_H__ */ 628 629 /* END PLUSTEK-PP.H .........................................................*/ 630