kopia lustrzana https://gitlab.com/sane-project/backends
Mainly cleanup work.
rodzic
982ef90ed4
commit
9e6db289d8
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,11 @@
|
|||
2003-09-29 Gerhard Jaeger <gerhard@gjaeger.de>
|
||||
|
||||
* doc/sane-plustek.man: minor update
|
||||
* backend/plustek.c: changed version number, cleanup
|
||||
* backend/plustek-usb*.c: cleanup
|
||||
* backend/plustek-pp.*: cleanup
|
||||
* backend/plustek-share.h: removed, no longer needed
|
||||
|
||||
2003-09-28 Henning Meier-Geinitz <henning@meier-geinitz.de>
|
||||
|
||||
* doc/descriptions/unsupported.desc: Added Enhans, Genius and UMAX
|
||||
|
@ -71,8 +79,8 @@
|
|||
|
||||
2003-09-23 Frank Zago <fzago at austin dot rr dot com>
|
||||
|
||||
* Makefile.in NEWS configure configure.in backend/Makefile.in
|
||||
backend/dll.c include/sane/config.h.in sanei/sanei_scsi.c
|
||||
* Makefile.in NEWS configure configure.in backend/Makefile.in
|
||||
backend/dll.c include/sane/config.h.in sanei/sanei_scsi.c
|
||||
tools/sane-find-scanner.c: cygwin port.
|
||||
|
||||
2003-09-23 Gerhard Jaeger <gerhard@gjaeger.de>
|
||||
|
|
|
@ -59,6 +59,197 @@
|
|||
#ifndef __PLUSTEKPP_H__
|
||||
#define __PLUSTEKPP_H__
|
||||
|
||||
/*.............................................................................
|
||||
* the structures for driver communication
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned short x;
|
||||
unsigned short y;
|
||||
} XY, *pXY;
|
||||
|
||||
typedef struct {
|
||||
unsigned short x;
|
||||
unsigned short y;
|
||||
unsigned short cx;
|
||||
unsigned short cy;
|
||||
} CropRect, *pCropRect;
|
||||
|
||||
typedef struct image {
|
||||
unsigned long dwFlag;
|
||||
CropRect crArea;
|
||||
XY xyDpi;
|
||||
unsigned short wDataType;
|
||||
} ImgDef, *pImgDef;
|
||||
|
||||
typedef struct {
|
||||
unsigned long dwPixelsPerLine;
|
||||
unsigned long dwBytesPerLine;
|
||||
unsigned long dwLinesPerArea;
|
||||
struct image ImgDef;
|
||||
} CropInfo, *pCropInfo;
|
||||
|
||||
/** definition of gamma maps
|
||||
*/
|
||||
typedef struct {
|
||||
int len; /**< gamma table len */
|
||||
int depth; /**< entry bit depth */
|
||||
int map_id; /**< what map */
|
||||
void *map; /**< pointer for map */
|
||||
} MapDef, *pMapDef;
|
||||
|
||||
/** for offset stuff
|
||||
*/
|
||||
typedef struct {
|
||||
int x;
|
||||
int y;
|
||||
} OffsDef, *pOffsDef;
|
||||
|
||||
/** useful for description tables
|
||||
*/
|
||||
typedef struct {
|
||||
int id;
|
||||
char *desc;
|
||||
} TabDef, *pTabDef;
|
||||
|
||||
/** for defining the scanmodes
|
||||
*/
|
||||
typedef const struct mode_param
|
||||
{
|
||||
int color;
|
||||
int depth;
|
||||
int scanmode;
|
||||
} ModeParam, *pModeParam;
|
||||
|
||||
/**
|
||||
*/
|
||||
#define SFLAG_MULTIFUNC 0x00000001 /* is multifunction device */
|
||||
#define SFLAG_SCANNERDEV 0x00000002 /* is scannerdevice */
|
||||
#define SFLAG_FLATBED 0x00000004 /* is flatbed scanner */
|
||||
#define SFLAG_PRINTEROPT 0x00000008 /* has printer option */
|
||||
|
||||
#define SFLAG_ADF 0x00000010 /* Automatic document feeder */
|
||||
#define SFLAG_MFP 0x00000020 /* MF-Keypad support */
|
||||
#define SFLAG_SheetFed 0x00000040 /* Sheetfed support */
|
||||
#define SFLAG_TPA 0x00000080 /* has transparency adapter */
|
||||
#define SFLAG_BUTTONOPT 0x00000100 /* has buttons */
|
||||
|
||||
#define SFLAG_CUSTOM_GAMMA 0x00000200 /* driver supports custom gamma */
|
||||
|
||||
/**
|
||||
*/
|
||||
#define SCANDEF_Inverse 0x00000001
|
||||
#define SCANDEF_UnlimitLength 0x00000002
|
||||
#define SCANDEF_StopWhenPaperOut 0x00000004
|
||||
#define SCANDEF_BoundaryDWORD 0x00000008
|
||||
#define SCANDEF_ColorBGROrder 0x00000010
|
||||
#define SCANDEF_BmpStyle 0x00000020
|
||||
#define SCANDEF_BoundaryWORD 0x00000040
|
||||
#define SCANDEF_NoMap 0x00000080 /* specified this flag will */
|
||||
/* cause system ignores the */
|
||||
/* siBrightness & siContrast */
|
||||
#define SCANDEF_Transparency 0x00000100 /* Scanning from transparency*/
|
||||
#define SCANDEF_Negative 0x00000200 /* Scanning from negative */
|
||||
#define SCANDEF_QualityScan 0x00000400 /* Scanning in quality mode */
|
||||
#define SCANDEF_BuildBwMap 0x00000800 /* Set default map */
|
||||
#define SCANDEF_ContinuousScan 0x00001000
|
||||
#define SCANDEF_DontBackModule 0x00002000 /* module will not back to */
|
||||
/* home after image scanned */
|
||||
#define SCANDEF_RightAlign 0x00008000 /* 12-bit */
|
||||
|
||||
#define SCANDEF_TPA (SCANDEF_Transparency | SCANDEF_Negative)
|
||||
|
||||
#define SCANDEF_Adf 0x00020000 /* Scan from ADF tray */
|
||||
|
||||
/* these values will be combined with ScannerInfo.dwFlag */
|
||||
#define _SCANNER_SCANNING 0x8000000
|
||||
#define _SCANNER_PAPEROUT 0x4000000
|
||||
|
||||
/* for GetLensInformation */
|
||||
#define SOURCE_Reflection 0
|
||||
#define SOURCE_Transparency 1
|
||||
#define SOURCE_Negative 2
|
||||
#define SOURCE_ADF 3
|
||||
|
||||
/******************************************************************************
|
||||
* Section 6 - additional definitions
|
||||
*/
|
||||
|
||||
/* scan modes */
|
||||
#define COLOR_BW 0
|
||||
#define COLOR_HALFTONE 1
|
||||
#define COLOR_256GRAY 2
|
||||
#define COLOR_TRUE24 3
|
||||
#define COLOR_TRUE32 4
|
||||
#define COLOR_TRUE48 4 /* not sure if this should be the same as 32 */
|
||||
#define COLOR_TRUE36 5
|
||||
|
||||
/* We don't support halftone mode now --> Plustek statement for USB */
|
||||
#define COLOR_GRAY16 6
|
||||
|
||||
#define _MEASURE_BASE 300UL
|
||||
|
||||
/** transparency/negative mode set ranges
|
||||
*/
|
||||
#define _TPAPageWidth 500U /* org. was 450 = 38.1 mm */
|
||||
#define _TPAPageHeight 510U /* org. was 460 = 38.9 mm */
|
||||
#define _TPAModeSupportMin COLOR_TRUE24
|
||||
#define _TPAModeSupportMax COLOR_TRUE48
|
||||
#define _TPAModeSupportDef COLOR_TRUE24
|
||||
#define _TPAMinDpi 150
|
||||
|
||||
#define _NegativePageWidth 460UL /* 38.9 mm */
|
||||
#define _NegativePageHeight 350UL /* 29.6 mm */
|
||||
|
||||
#define _DEF_DPI 50
|
||||
|
||||
/*
|
||||
* additional shared stuff between user-world and kernel mode
|
||||
*/
|
||||
#define _VAR_NOT_USED(x) ((x)=(x))
|
||||
|
||||
/*
|
||||
* for Gamma tables
|
||||
*/
|
||||
#define _MAP_RED 0
|
||||
#define _MAP_GREEN 1
|
||||
#define _MAP_BLUE 2
|
||||
#define _MAP_MASTER 3
|
||||
|
||||
/*
|
||||
* generic error codes...
|
||||
*/
|
||||
#define _OK 0
|
||||
|
||||
#define _FIRST_ERR -9000
|
||||
|
||||
#define _E_INIT (_FIRST_ERR-1) /* already initialized */
|
||||
#define _E_NOT_INIT (_FIRST_ERR-2) /* not initialized */
|
||||
#define _E_NULLPTR (_FIRST_ERR-3) /* internal NULL-PTR detected */
|
||||
#define _E_ALLOC (_FIRST_ERR-4) /* error allocating memory */
|
||||
#define _E_TIMEOUT (_FIRST_ERR-5) /* signals a timeout condition */
|
||||
#define _E_INVALID (_FIRST_ERR-6) /* invalid parameter detected */
|
||||
#define _E_INTERNAL (_FIRST_ERR-7) /* internal error */
|
||||
#define _E_BUSY (_FIRST_ERR-8) /* device is already in use */
|
||||
#define _E_ABORT (_FIRST_ERR-9) /* operation aborted */
|
||||
#define _E_LOCK (_FIRST_ERR-10) /* can´t lock resource */
|
||||
#define _E_NOSUPP (_FIRST_ERR-11) /* feature or device not supported */
|
||||
#define _E_NORESOURCE (_FIRST_ERR-12) /* out of memo, resource busy... */
|
||||
#define _E_VERSION (_FIRST_ERR-19) /* version conflict */
|
||||
#define _E_NO_DEV (_FIRST_ERR-20) /* device does not exist */
|
||||
#define _E_NO_CONN (_FIRST_ERR-21) /* nothing connected */
|
||||
#define _E_PORTSEARCH (_FIRST_ERR-22) /* parport_enumerate failed */
|
||||
#define _E_NO_PORT (_FIRST_ERR-23) /* requested port does not exist */
|
||||
#define _E_REGISTER (_FIRST_ERR-24) /* cannot register this device */
|
||||
#define _E_SEQUENCE (_FIRST_ERR-30) /* caller sequence does not match */
|
||||
#define _E_NO_ASIC (_FIRST_ERR-31) /* can´t detect ASIC */
|
||||
|
||||
#define _E_LAMP_NOT_IN_POS (_FIRST_ERR-40)
|
||||
#define _E_LAMP_NOT_STABLE (_FIRST_ERR-41)
|
||||
#define _E_NODATA (_FIRST_ERR-42)
|
||||
#define _E_BUFFER_TOO_SMALL (_FIRST_ERR-43)
|
||||
#define _E_DATAREAD (_FIRST_ERR-44)
|
||||
|
||||
|
||||
/************************ some definitions ***********************************/
|
||||
|
||||
/* NOTE: needs to be kept in sync with table below */
|
||||
|
@ -162,7 +353,7 @@
|
|||
* the ioctl interface changes
|
||||
*/
|
||||
#define _PTDRV_COMPAT_IOCTL_VERSION 0x0102
|
||||
#define _PTDRV_IOCTL_VERSION 0x0103
|
||||
#define _PTDRV_IOCTL_VERSION 0x0104
|
||||
|
||||
/** for adjusting the parport stuff
|
||||
*/
|
||||
|
@ -209,6 +400,68 @@ typedef struct {
|
|||
|
||||
} AdjDef, *pAdjDef;
|
||||
|
||||
typedef struct {
|
||||
unsigned long dwFlag; /* refer to SECTION (1.2) */
|
||||
unsigned long dwBytesPerLine;
|
||||
unsigned long dwLinesPerScan;
|
||||
} StartScan, *pStartScan;
|
||||
|
||||
typedef struct {
|
||||
unsigned short wMin; /* minimum value */
|
||||
unsigned short wDef; /* default value */
|
||||
unsigned short wMax; /* software maximum value */
|
||||
unsigned short wPhyMax; /* hardware maximum value (for DPI only)*/
|
||||
} RANGE, *PRANGE;
|
||||
|
||||
typedef struct {
|
||||
RANGE rDataType; /* available scan modes */
|
||||
unsigned long dwFlag; /* refer to SECTION (1.2) */
|
||||
unsigned short wIOBase; /* refer to SECTION (1.3) */
|
||||
unsigned short wMaxExtentX; /* scanarea width */
|
||||
unsigned short wMaxExtentY; /* scanarea height */
|
||||
unsigned short AsicID; /* copy of RegAsicID */
|
||||
unsigned short Model; /* model as best we can determine */
|
||||
unsigned short Version; /* drivers version */
|
||||
} ScannerCaps, *pScannerCaps;
|
||||
|
||||
typedef struct {
|
||||
RANGE rDpiX;
|
||||
RANGE rDpiY;
|
||||
RANGE rExtentX;
|
||||
RANGE rExtentY;
|
||||
unsigned short wBeginX; /* offset from left */
|
||||
unsigned short wBeginY; /* offset from top */
|
||||
} LensInfo, *pLensInfo;
|
||||
|
||||
typedef struct {
|
||||
unsigned char* pDither;
|
||||
void* pMap;
|
||||
ImgDef ImgDef;
|
||||
unsigned short wMapType; /* refer to SECTION (3.2) */
|
||||
unsigned short wDither; /* refer to SECTION (3.3) */
|
||||
short siBrightness; /* refer to SECTION (3.5) */
|
||||
short siContrast; /* refer to SECTION (3.6) */
|
||||
} ScanInfo, *pScanInfo;
|
||||
|
||||
|
||||
/* IDs the ASIC returns */
|
||||
#define _ASIC_IS_96001 0x0f /* value for 96001 */
|
||||
#define _ASIC_IS_96003 0x10 /* value for 96003 */
|
||||
#define _ASIC_IS_98001 0x81 /* value for 98001 */
|
||||
#define _ASIC_IS_98003 0x83 /* value for 98003 */
|
||||
|
||||
#define _Transparency48OriginOffsetX 375
|
||||
#define _Transparency48OriginOffsetY 780
|
||||
|
||||
#define _Transparency96OriginOffsetX 0x03DB /* org. was 0x0430 */
|
||||
#define _Negative96OriginOffsetX 0x03F3 /* org. was 0x0428 */
|
||||
|
||||
/** Scanmodes
|
||||
*/
|
||||
#define _ScanMode_Color 0
|
||||
#define _ScanMode_AverageOut 1 /* CCD averaged 2 pixels value for output*/
|
||||
#define _ScanMode_Mono 2 /* not color mode */
|
||||
|
||||
|
||||
#ifndef __KERNEL__
|
||||
|
||||
|
|
|
@ -677,8 +677,6 @@ _LOC int MiscReinitStruct( pScanData ps )
|
|||
ps->sCaps.Version = ((_PTDRV_V1 << 8) | _PTDRV_V0);
|
||||
|
||||
ps->bCurrentSpeed = 1;
|
||||
ps->sCaps.wLens = 1; /* set wNumberOfLens */
|
||||
|
||||
ps->pbMapRed = ps->a_bMapTable;
|
||||
ps->pbMapGreen = &ps->a_bMapTable[256];
|
||||
ps->pbMapBlue = &ps->a_bMapTable[512];
|
||||
|
|
|
@ -176,19 +176,8 @@ static void modelInitPageSettings( pScanData ps )
|
|||
*/
|
||||
static void modelInitCaps( pScanData ps )
|
||||
{
|
||||
if( _ASIC_IS_96001 == ps->sCaps.AsicID )
|
||||
ps->sCaps.dwBits = _BITS_8;
|
||||
else
|
||||
ps->sCaps.dwBits = _BITS_10;
|
||||
|
||||
ps->sCaps.rDataType.wMin = 0;
|
||||
ps->sCaps.rDataType.wDef = COLOR_TRUE24;
|
||||
ps->sCaps.rDataType.wMax = COLOR_TRUE24;
|
||||
ps->sCaps.rDataType.wPhyMax = COLOR_TRUE24;
|
||||
ps->sCaps.wIOBase = _NO_BASE;
|
||||
ps->sCaps.wLens = 1;
|
||||
ps->sCaps.dwFlag = (SFLAG_SCANNERDEV +
|
||||
SFLAG_FLATBED + SFLAG_CUSTOM_GAMMA);
|
||||
ps->sCaps.wIOBase = _NO_BASE;
|
||||
ps->sCaps.dwFlag = (SFLAG_SCANNERDEV+SFLAG_FLATBED+SFLAG_CUSTOM_GAMMA);
|
||||
}
|
||||
|
||||
/*.............................................................................
|
||||
|
@ -594,10 +583,6 @@ _LOC void ModelSet9636( pScanData ps )
|
|||
ps->Device.DataOriginX = 72;
|
||||
ps->sCaps.AsicID = _ASIC_IS_98001;
|
||||
|
||||
ps->sCaps.dwBits = _BITS_12;
|
||||
ps->sCaps.rDataType.wMax = COLOR_TRUE48;
|
||||
ps->sCaps.rDataType.wPhyMax = COLOR_TRUE48;
|
||||
|
||||
ps->TotalBufferRequire = _LINE_BUFSIZE * 2 + _LINE_BUFSIZE1 +
|
||||
ps->BufferForColorRunTable + _PROCESS_BUFSIZE;
|
||||
|
||||
|
@ -622,10 +607,6 @@ _LOC void ModelSetP12( pScanData ps )
|
|||
ps->sCaps.Model = MODEL_OP_PT12;
|
||||
ps->sCaps.AsicID = _ASIC_IS_98003;
|
||||
|
||||
ps->sCaps.dwBits = _BITS_12;
|
||||
ps->sCaps.rDataType.wMax = COLOR_TRUE48;
|
||||
ps->sCaps.rDataType.wPhyMax = COLOR_TRUE48;
|
||||
|
||||
ps->TotalBufferRequire = _SizeTotalBufTpa;
|
||||
|
||||
/* do it again, as ModelSet9630() changes the result of this function !*/
|
||||
|
|
|
@ -185,7 +185,6 @@ typedef long long TimerDef, *pTimerDef;
|
|||
* include the shared stuff right here, this concerns the ioctl interface
|
||||
* and the communication stuff
|
||||
*/
|
||||
#include "plustek-share.h"
|
||||
#include "plustek-pp.h"
|
||||
|
||||
/*.............................................................................
|
||||
|
|
|
@ -156,7 +156,6 @@ typedef struct {
|
|||
|
||||
} RBGPtrDef;
|
||||
|
||||
|
||||
typedef struct {
|
||||
ULong Red;
|
||||
ULong Green;
|
||||
|
|
|
@ -1,411 +0,0 @@
|
|||
/*.............................................................................
|
||||
* Project : SANE library for Plustek flatbed scanners.
|
||||
*.............................................................................
|
||||
*/
|
||||
|
||||
/** @file plustek-share.h
|
||||
* @brief Common definitions for the usb backend and parport backend
|
||||
*
|
||||
* Copyright (C) 2001-2003 Gerhard Jaeger <gerhard@gjaeger.de>
|
||||
*
|
||||
* History:
|
||||
* - 0.36 - initial version
|
||||
* - 0.37 - updated scanner info list
|
||||
* - removed override switches
|
||||
* - 0.38 - changed the dwFlag entry in ScannerCaps and its meaning
|
||||
* - changed _NO_BASE
|
||||
* - fixed model list
|
||||
* - removed gray-scale capabilities for TPA scans
|
||||
* - 0.39 - added user-space stuff
|
||||
* - added Genius Colorpage Vivid III V2 stuff
|
||||
* - 0.40 - added stuff to share with USB and Parport
|
||||
* - 0.41 - changed the IOCTL version number
|
||||
* - added adjustment stuff
|
||||
* - 0.42 - added FLAG_CUSTOM_GAMMA and _MAP_ definitions
|
||||
* - changed IOCTL interface to allow downloadable MAPS
|
||||
* - added error codes
|
||||
* - 0.43 - added tpa entry for AdjDef
|
||||
* - 0.44 - extended AdjDef
|
||||
* - 0.45 - added skipFine and skipFineWhite to AdjDef
|
||||
* - 0.46 - added altCalibrate and cacheCalData to AdjDef
|
||||
* - moved some stuff to the specific backend headers
|
||||
* .
|
||||
* <hr>
|
||||
* 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.
|
||||
* <hr>
|
||||
*/
|
||||
#ifndef __PLUSTEK_SHARE_H__
|
||||
#define __PLUSTEK_SHARE_H__
|
||||
|
||||
/*.............................................................................
|
||||
* the structures for driver communication
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned long dwFlag; /* refer to SECTION (1.2) */
|
||||
unsigned long dwBytesPerLine;
|
||||
unsigned long dwLinesPerScan;
|
||||
} StartScan, *pStartScan;
|
||||
|
||||
typedef struct {
|
||||
unsigned short x;
|
||||
unsigned short y;
|
||||
} XY, *pXY;
|
||||
|
||||
typedef struct {
|
||||
unsigned short x;
|
||||
unsigned short y;
|
||||
unsigned short cx;
|
||||
unsigned short cy;
|
||||
} CropRect, *pCropRect;
|
||||
|
||||
typedef struct {
|
||||
unsigned long dwFlag;
|
||||
CropRect crArea;
|
||||
XY xyDpi;
|
||||
unsigned short wDataType;
|
||||
unsigned short wBits; /* see section 3.4 */
|
||||
unsigned short wLens;
|
||||
} ImgDef, *pImgDef;
|
||||
|
||||
typedef struct {
|
||||
unsigned long dwPixelsPerLine;
|
||||
unsigned long dwBytesPerLine;
|
||||
unsigned long dwLinesPerArea;
|
||||
ImgDef ImgDef;
|
||||
} CropInfo, *pCropInfo;
|
||||
|
||||
typedef struct {
|
||||
unsigned char* pDither;
|
||||
void* pMap;
|
||||
ImgDef ImgDef;
|
||||
unsigned short wMapType; /* refer to SECTION (3.2) */
|
||||
unsigned short wDither; /* refer to SECTION (3.3) */
|
||||
short siBrightness; /* refer to SECTION (3.5) */
|
||||
short siContrast; /* refer to SECTION (3.6) */
|
||||
} ScanInfo, *pScanInfo;
|
||||
|
||||
typedef struct {
|
||||
unsigned short wMin; /* minimum value */
|
||||
unsigned short wDef; /* default value */
|
||||
unsigned short wMax; /* software maximum value */
|
||||
unsigned short wPhyMax; /* hardware maximum value (for DPI only)*/
|
||||
} RANGE, *PRANGE;
|
||||
|
||||
typedef struct {
|
||||
RANGE rDataType; /* available scan modes */
|
||||
unsigned long dwBits; /* refer to SECTION (1.1) */
|
||||
unsigned long dwFlag; /* refer to SECTION (1.2) */
|
||||
unsigned short wIOBase; /* refer to SECTION (1.3) */
|
||||
unsigned short wLens; /* number of sensors */
|
||||
unsigned short wMaxExtentX; /* scanarea width */
|
||||
unsigned short wMaxExtentY; /* scanarea height */
|
||||
unsigned short AsicID; /* copy of RegAsicID */
|
||||
unsigned short Model; /* model as best we can determine */
|
||||
unsigned short Version; /* drivers version */
|
||||
} ScannerCaps, *pScannerCaps;
|
||||
|
||||
typedef struct {
|
||||
RANGE rDpiX;
|
||||
RANGE rDpiY;
|
||||
RANGE rExtentX;
|
||||
RANGE rExtentY;
|
||||
unsigned short wBeginX; /* offset from left */
|
||||
unsigned short wBeginY; /* offset from top */
|
||||
} LensInfo, *pLensInfo;
|
||||
|
||||
/**
|
||||
* definition of gamma maps
|
||||
*/
|
||||
typedef struct {
|
||||
|
||||
int len; /**< gamma table len */
|
||||
int depth; /**< entry bit depth */
|
||||
int map_id; /**< what map */
|
||||
|
||||
void *map; /**< pointer for map */
|
||||
|
||||
} MapDef, *pMapDef;
|
||||
|
||||
|
||||
typedef struct {
|
||||
int x;
|
||||
int y;
|
||||
} OffsDef, *pOffsDef;
|
||||
|
||||
/** useful for description tables
|
||||
*/
|
||||
typedef struct {
|
||||
int id;
|
||||
char *desc;
|
||||
} TabDef, *pTabDef;
|
||||
|
||||
/** for defining the scanmodes
|
||||
*/
|
||||
typedef const struct mode_param
|
||||
{
|
||||
int color;
|
||||
int depth;
|
||||
int scanmode;
|
||||
} ModeParam, *pModeParam;
|
||||
|
||||
/******************************************************************************
|
||||
* Section 1
|
||||
* (1.1): SCANNERINFO.dwBits
|
||||
*/
|
||||
#define _BITS_8 0x00000001
|
||||
#define _BITS_10 0x00000002
|
||||
#define _BITS_12 0x00000003
|
||||
|
||||
/* (1.2): SCANNERINFO.dwFlag */
|
||||
#define SFLAG_MULTIFUNC 0x00000001 /* is multifunction device */
|
||||
#define SFLAG_SCANNERDEV 0x00000002 /* is scannerdevice */
|
||||
#define SFLAG_FLATBED 0x00000004 /* is flatbed scanner */
|
||||
#define SFLAG_PRINTEROPT 0x00000008 /* has printer option */
|
||||
|
||||
#define SFLAG_ADF 0x00000010 /* Automatic document feeder */
|
||||
#define SFLAG_MFP 0x00000020 /* MF-Keypad support */
|
||||
#define SFLAG_SheetFed 0x00000040 /* Sheetfed support */
|
||||
#define SFLAG_TPA 0x00000080 /* has transparency adapter */
|
||||
#define SFLAG_BUTTONOPT 0x00000100 /* has buttons */
|
||||
|
||||
#define SFLAG_CUSTOM_GAMMA 0x00000200 /* driver supports custom gamma */
|
||||
|
||||
/* (1.3): SCANNERINFO.wIOBase */
|
||||
#define _NO_BASE 0xFFFF
|
||||
|
||||
#if 0
|
||||
/******************************************************************************
|
||||
* Section 2
|
||||
* (2.1): MAPINFO.wRGB
|
||||
*/
|
||||
#define RGB_Master 1
|
||||
#define RGB_RGB 3
|
||||
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* Section 3
|
||||
* (3.1): SCANINFO.dwFlag
|
||||
*/
|
||||
#define SCANDEF_Inverse 0x00000001
|
||||
#define SCANDEF_UnlimitLength 0x00000002
|
||||
#define SCANDEF_StopWhenPaperOut 0x00000004
|
||||
#define SCANDEF_BoundaryDWORD 0x00000008
|
||||
#define SCANDEF_ColorBGROrder 0x00000010
|
||||
#define SCANDEF_BmpStyle 0x00000020
|
||||
#define SCANDEF_BoundaryWORD 0x00000040
|
||||
#define SCANDEF_NoMap 0x00000080 /* specified this flag will */
|
||||
/* cause system ignores the */
|
||||
/* siBrightness & siContrast */
|
||||
#define SCANDEF_Transparency 0x00000100 /* Scanning from transparency*/
|
||||
#define SCANDEF_Negative 0x00000200 /* Scanning from negative */
|
||||
#define SCANDEF_QualityScan 0x00000400 /* Scanning in quality mode */
|
||||
#define SCANDEF_BuildBwMap 0x00000800 /* Set default map */
|
||||
#define SCANDEF_ContinuousScan 0x00001000
|
||||
#define SCANDEF_DontBackModule 0x00002000 /* module will not back to */
|
||||
/* home after image scanned */
|
||||
#define SCANDEF_RightAlign 0x00008000 /* 12-bit */
|
||||
|
||||
#define SCANDEF_WindowStyle 0x00000038
|
||||
#define SCANDEF_TPA (SCANDEF_Transparency | SCANDEF_Negative)
|
||||
|
||||
#define SCANDEF_Adf 0x00020000 /* Scan from ADF tray */
|
||||
|
||||
|
||||
/* these values will be combined with ScannerInfo.dwFlag */
|
||||
#define _SCANNER_SCANNING 0x8000000
|
||||
#define _SCANNER_PAPEROUT 0x4000000
|
||||
|
||||
#if 0
|
||||
/* (3.2): SCANINFO.wMapType */
|
||||
#define CHANNEL_Master 0 /* used only MAPINFO.wRGB == RGB_Master */
|
||||
/* or scan gray */
|
||||
/* it is illegal when in RGB_RGB mode. */
|
||||
#define CHANNEL_RGB 1
|
||||
#define CHANNEL_Default 2
|
||||
|
||||
|
||||
/* these are used only to pointer out which color are used as gray map
|
||||
* It also pointers out which channel will be used to scan gray data
|
||||
* (CHANNEL_Default = Device default)
|
||||
*/
|
||||
#define CHANNEL_Red 3
|
||||
#define CHANNEL_Green 4
|
||||
#define CHANNEL_Blue 5
|
||||
|
||||
/* (3.3): SCANINFO.wDither */
|
||||
#define DITHER_CoarseFatting 0
|
||||
#define DITHER_FineFatting 1
|
||||
#define DITHER_Bayer 2
|
||||
#define DITHER_VerticalLine 3
|
||||
#define DITHER_UserDefine 4
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* (3.4): SCANINFO.wBits */
|
||||
#define OUTPUT_8Bits 0
|
||||
#define OUTPUT_10Bits 1
|
||||
#define OUTPUT_12Bits 2
|
||||
|
||||
/* (3.5): SCANINFO.siBrightness */
|
||||
#define BRIGHTNESS_Minimum -127
|
||||
#define BRIGHTNESS_Maximum 127
|
||||
#define BRIGHTNESS_Default 0
|
||||
|
||||
/* (3.6): SCANINFO.siContrast */
|
||||
#define CONTRAST_Minimum -127
|
||||
#define CONTRAST_Maximum 127
|
||||
#define CONTRAST_Default 0
|
||||
|
||||
/* (3.7): SCANINFO.dwInput */
|
||||
#define LENS_Current 0xffff
|
||||
|
||||
/******************************************************************************
|
||||
* SECTION 4 - Generic Equates
|
||||
*/
|
||||
#define _MEASURE_BASE 300UL
|
||||
|
||||
/* for GetLensInformation */
|
||||
#define SOURCE_Reflection 0
|
||||
#define SOURCE_Transparency 1
|
||||
#define SOURCE_Negative 2
|
||||
#define SOURCE_ADF 3
|
||||
|
||||
/******************************************************************************
|
||||
* Section 5 - Scanmodes
|
||||
*/
|
||||
#define _ScanMode_Color 0
|
||||
#define _ScanMode_AverageOut 1 /* CCD averaged 2 pixels value for output*/
|
||||
#define _ScanMode_Mono 2 /* not color mode */
|
||||
|
||||
/******************************************************************************
|
||||
* Section 6 - additional definitions
|
||||
*/
|
||||
|
||||
/* scan modes */
|
||||
#define COLOR_BW 0
|
||||
#define COLOR_HALFTONE 1
|
||||
#define COLOR_256GRAY 2
|
||||
#define COLOR_TRUE24 3
|
||||
#define COLOR_TRUE32 4
|
||||
#define COLOR_TRUE48 4 /* not sure if this should be the same as 32 */
|
||||
#define COLOR_TRUE36 5
|
||||
|
||||
/* We don't support halftone mode now --> Plustek statement for USB */
|
||||
#define COLOR_GRAY16 6
|
||||
|
||||
|
||||
/* IDs the ASIC returns */
|
||||
#define _ASIC_IS_96001 0x0f /* value for 96001 */
|
||||
#define _ASIC_IS_96003 0x10 /* value for 96003 */
|
||||
#define _ASIC_IS_98001 0x81 /* value for 98001 */
|
||||
#define _ASIC_IS_98003 0x83 /* value for 98003 */
|
||||
|
||||
/*
|
||||
* transparency/negative mode set ranges
|
||||
*/
|
||||
#define _TPAPageWidth 500U /* org. was 450 = 38.1 mm */
|
||||
#define _TPAPageHeight 510U /* org. was 460 = 38.9 mm */
|
||||
#define _TPAModeSupportMin COLOR_TRUE24
|
||||
#define _TPAModeSupportMax COLOR_TRUE48
|
||||
#define _TPAModeSupportDef COLOR_TRUE24
|
||||
#define _TPAMinDpi 150
|
||||
|
||||
#define _Transparency48OriginOffsetX 375
|
||||
#define _Transparency48OriginOffsetY 780
|
||||
|
||||
#define _Transparency96OriginOffsetX 0x03DB /* org. was 0x0430 */
|
||||
#define _Negative96OriginOffsetX 0x03F3 /* org. was 0x0428 */
|
||||
|
||||
#define _NegativePageWidth 460UL /* 38.9 mm */
|
||||
#define _NegativePageHeight 350UL /* 29.6 mm */
|
||||
|
||||
#define _DEF_DPI 50
|
||||
|
||||
/*
|
||||
* additional shared stuff between user-world and kernel mode
|
||||
*/
|
||||
#define _VAR_NOT_USED(x) ((x)=(x))
|
||||
|
||||
/*
|
||||
* for Gamma tables
|
||||
*/
|
||||
#define _MAP_RED 0
|
||||
#define _MAP_GREEN 1
|
||||
#define _MAP_BLUE 2
|
||||
#define _MAP_MASTER 3
|
||||
|
||||
/*
|
||||
* generic error codes...
|
||||
*/
|
||||
#define _OK 0
|
||||
|
||||
#define _FIRST_ERR -9000
|
||||
|
||||
#define _E_INIT (_FIRST_ERR-1) /* already initialized */
|
||||
#define _E_NOT_INIT (_FIRST_ERR-2) /* not initialized */
|
||||
#define _E_NULLPTR (_FIRST_ERR-3) /* internal NULL-PTR detected */
|
||||
#define _E_ALLOC (_FIRST_ERR-4) /* error allocating memory */
|
||||
#define _E_TIMEOUT (_FIRST_ERR-5) /* signals a timeout condition */
|
||||
#define _E_INVALID (_FIRST_ERR-6) /* invalid parameter detected */
|
||||
#define _E_INTERNAL (_FIRST_ERR-7) /* internal error */
|
||||
#define _E_BUSY (_FIRST_ERR-8) /* device is already in use */
|
||||
#define _E_ABORT (_FIRST_ERR-9) /* operation aborted */
|
||||
#define _E_LOCK (_FIRST_ERR-10) /* can´t lock resource */
|
||||
#define _E_NOSUPP (_FIRST_ERR-11) /* feature or device not supported */
|
||||
#define _E_NORESOURCE (_FIRST_ERR-12) /* out of memo, resource busy... */
|
||||
#define _E_VERSION (_FIRST_ERR-19) /* version conflict */
|
||||
#define _E_NO_DEV (_FIRST_ERR-20) /* device does not exist */
|
||||
#define _E_NO_CONN (_FIRST_ERR-21) /* nothing connected */
|
||||
#define _E_PORTSEARCH (_FIRST_ERR-22) /* parport_enumerate failed */
|
||||
#define _E_NO_PORT (_FIRST_ERR-23) /* requested port does not exist */
|
||||
#define _E_REGISTER (_FIRST_ERR-24) /* cannot register this device */
|
||||
#define _E_SEQUENCE (_FIRST_ERR-30) /* caller sequence does not match */
|
||||
#define _E_NO_ASIC (_FIRST_ERR-31) /* can´t detect ASIC */
|
||||
|
||||
#define _E_LAMP_NOT_IN_POS (_FIRST_ERR-40)
|
||||
#define _E_LAMP_NOT_STABLE (_FIRST_ERR-41)
|
||||
#define _E_NODATA (_FIRST_ERR-42)
|
||||
#define _E_BUFFER_TOO_SMALL (_FIRST_ERR-43)
|
||||
#define _E_DATAREAD (_FIRST_ERR-44)
|
||||
|
||||
#endif /* guard __PLUSTEK_SHARE_H__ */
|
||||
|
||||
/* END PLUSTEK-SHARE.H.......................................................*/
|
|
@ -78,7 +78,14 @@
|
|||
#ifndef PATH_MAX
|
||||
# define PATH_MAX 1024
|
||||
#endif
|
||||
|
||||
|
||||
/** useful for description tables
|
||||
*/
|
||||
typedef struct {
|
||||
int id;
|
||||
char *desc;
|
||||
} TabDef, *pTabDef;
|
||||
|
||||
/** to allow different vendors...
|
||||
*/
|
||||
static TabDef usbVendors[] = {
|
||||
|
@ -672,12 +679,6 @@ static int usbDev_getCaps( Plustek_Device *dev )
|
|||
|
||||
DBG( _DBG_INFO, "usbDev_getCaps()\n" );
|
||||
|
||||
dev->caps.rDataType.wMin = scaps->Normal.MinDpi.x;
|
||||
dev->caps.rDataType.wDef = scaps->Normal.MinDpi.x;
|
||||
dev->caps.rDataType.wMax = scaps->OpticDpi.y;
|
||||
dev->caps.rDataType.wPhyMax = scaps->OpticDpi.x;
|
||||
|
||||
dev->caps.dwBits = _BITS_12;
|
||||
dev->caps.dwFlag = (SFLAG_SCANNERDEV + SFLAG_FLATBED + SFLAG_CUSTOM_GAMMA);
|
||||
|
||||
if(((DEVCAPSFLAG_Positive == scaps->wFlags) &&
|
||||
|
@ -686,47 +687,8 @@ static int usbDev_getCaps( Plustek_Device *dev )
|
|||
dev->caps.dwFlag |= SFLAG_TPA;
|
||||
}
|
||||
|
||||
dev->caps.wLens = 1;
|
||||
dev->caps.wMaxExtentX = scaps->Normal.Size.x;
|
||||
dev->caps.wMaxExtentY = scaps->Normal.Size.y;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** usbDev_getLensInfo
|
||||
* set the info for the scan-area.
|
||||
*/
|
||||
static int usbDev_getLensInfo( Plustek_Device *dev, pLensInfo lens )
|
||||
{
|
||||
DBG( _DBG_INFO, "usbDev_getLensInfo()\n" );
|
||||
|
||||
lens->wBeginX = 0;
|
||||
lens->wBeginY = 0;
|
||||
|
||||
lens->rExtentX.wMin = 150;
|
||||
lens->rExtentX.wDef =
|
||||
lens->rExtentX.wMax =
|
||||
lens->rExtentX.wPhyMax = dev->usbDev.Caps.Normal.Size.x;
|
||||
|
||||
lens->rExtentY.wMin = 150;
|
||||
lens->rExtentY.wDef =
|
||||
lens->rExtentY.wMax =
|
||||
lens->rExtentY.wPhyMax = dev->usbDev.Caps.Normal.Size.y;
|
||||
|
||||
/* set the DPI stuff */
|
||||
lens->rDpiX.wMin = 16;
|
||||
lens->rDpiX.wDef = 50;
|
||||
lens->rDpiX.wMax = (dev->usbDev.Caps.OpticDpi.x *16);
|
||||
lens->rDpiX.wPhyMax = dev->usbDev.Caps.OpticDpi.x;
|
||||
lens->rDpiY.wMin = 16;
|
||||
lens->rDpiY.wDef = 50;
|
||||
lens->rDpiY.wMax = (dev->usbDev.Caps.OpticDpi.x *16);
|
||||
lens->rDpiY.wPhyMax = (dev->usbDev.Caps.OpticDpi.x * 2);
|
||||
|
||||
lens->rDpiY.wMin = dev->usbDev.Caps.Normal.MinDpi.y;
|
||||
|
||||
DBG( _DBG_INFO, "wMAX=%u, WPHYMAX=%u\n", lens->rDpiY.wMax, lens->rDpiY.wPhyMax );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -747,7 +709,7 @@ static int usbDev_getCropInfo( Plustek_Device *dev, pCropInfo ci )
|
|||
ci->dwLinesPerArea = size.dwLines;
|
||||
ci->dwBytesPerLine = size.dwBytes;
|
||||
|
||||
if( ci->ImgDef.dwFlag & SCANDEF_BoundaryDWORD )
|
||||
if( ci->ImgDef.dwFlag & SCANFLAG_DWORDBoundary )
|
||||
ci->dwBytesPerLine = (ci->dwBytesPerLine + 3UL) & 0xfffffffcUL;
|
||||
|
||||
DBG( _DBG_INFO, "PPL = %lu\n", ci->dwPixelsPerLine );
|
||||
|
@ -945,7 +907,7 @@ static int usbDev_stopScan( Plustek_Device *dev, int *mode )
|
|||
|
||||
/**
|
||||
*/
|
||||
static int usbDev_startScan( Plustek_Device *dev, pStartScan start )
|
||||
static int usbDev_startScan( Plustek_Device *dev )
|
||||
{
|
||||
pScanDef scanning = &dev->scanning;
|
||||
static int iSkipLinesForADF = 0;
|
||||
|
@ -980,9 +942,6 @@ static int usbDev_startScan( Plustek_Device *dev, pStartScan start )
|
|||
scanning->dwFlag |= SCANFLAG_StartScan;
|
||||
usb_LampOn( dev, SANE_TRUE, SANE_TRUE );
|
||||
|
||||
start->dwBytesPerLine = scanning->dwBytesLine;
|
||||
start->dwFlag = scanning->dwFlag;
|
||||
|
||||
m_fStart = m_fFirst = SANE_TRUE;
|
||||
m_fAutoPark =
|
||||
(scanning->dwFlag & SCANFLAG_StillModule)?SANE_FALSE:SANE_TRUE;
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
* - 0.46 - added UMAX1200 for 5400 model
|
||||
* - removed _WAF_FIX_GAIN and _WAF_FIX_OFS
|
||||
* - added skipCoarseCalib to ScanDef
|
||||
* - added additional defines for cis and epson-ccd sensor
|
||||
* .
|
||||
* <hr>
|
||||
* This file is part of the SANE package.
|
||||
|
@ -78,10 +79,11 @@
|
|||
#define kNEC8861 3
|
||||
#define kNEC3778 4
|
||||
#define kNECSLIM 5
|
||||
#define kCIS650 6
|
||||
#define kCIS670 7
|
||||
#define kCIS1220 8
|
||||
#define kCIS1240 9
|
||||
#define kCIS650 6
|
||||
#define kCIS670 7
|
||||
#define kCIS1220 8
|
||||
#define kCIS1240 9
|
||||
#define kEPSON 10
|
||||
|
||||
/*********************************** plustek_types.h!!! ************************/
|
||||
|
||||
|
@ -149,6 +151,13 @@ typedef union {
|
|||
|
||||
} AnyPtr, *pAnyPtr;
|
||||
|
||||
typedef struct {
|
||||
unsigned short x;
|
||||
unsigned short y;
|
||||
} XY, *pXY;
|
||||
|
||||
#define _VAR_NOT_USED(x) ((x)=(x))
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define IDEAL_GainNormal 0xf000UL /* 240 */
|
||||
|
@ -285,16 +294,14 @@ enum MODULEMOVE
|
|||
/** SCANDEF.dwFlags */
|
||||
enum SCANFLAG
|
||||
{
|
||||
SCANFLAG_bgr = SCANDEF_ColorBGROrder,
|
||||
SCANFLAG_BottomUp = SCANDEF_BmpStyle,
|
||||
SCANFLAG_Invert = SCANDEF_Inverse,
|
||||
SCANFLAG_DWORDBoundary = SCANDEF_BoundaryDWORD,
|
||||
SCANFLAG_RightAlign = SCANDEF_RightAlign,
|
||||
SCANFLAG_StillModule = SCANDEF_DontBackModule,
|
||||
/* SCANFLAG_EnvirOk = 0x80000000, */
|
||||
SCANFLAG_bgr = 0x00000010,
|
||||
SCANFLAG_BottomUp = 0x00000020,
|
||||
SCANFLAG_Invert = 0x00000040,
|
||||
SCANFLAG_DWORDBoundary = 0x00000080,
|
||||
SCANFLAG_RightAlign = 0x00000100,
|
||||
SCANFLAG_StillModule = 0x00000200,
|
||||
SCANFLAG_StartScan = 0x40000000,
|
||||
SCANFLAG_Scanning = 0x20000080,
|
||||
SCANFLAG_ThreadActivated= 0x10000200,
|
||||
SCANFLAG_Pseudo48 = 0x08000000,
|
||||
SCANFLAG_SampleY = 0x04000000
|
||||
};
|
||||
|
|
|
@ -547,7 +547,7 @@ static DCapsDef Cap0x04B8_0x010F_0 =
|
|||
/* Normal */
|
||||
{{ 25, 85}, 10, -1, {2550, 3508}, { 100, 100 }, COLOR_BW },
|
||||
/* Positive */
|
||||
{{ 1100, 972}, 720, -1, { 473, 414}, { 150, 150 }, COLOR_GRAY16 },
|
||||
{{ 1100, 972}, 740, -1, { 473, 414}, { 150, 150 }, COLOR_GRAY16 },
|
||||
/* Negative */
|
||||
{{ 1116, 1049}, 720, -1, { 567, 414}, { 150, 150 }, COLOR_GRAY16 },
|
||||
{{ 0, 0}, 0, -1, {0, 0}, { 0, 0 }, 0 },
|
||||
|
@ -556,7 +556,7 @@ static DCapsDef Cap0x04B8_0x010F_0 =
|
|||
SENSORORDER_rgb,
|
||||
8, /* sensor distance */
|
||||
4, /* number of buttons */
|
||||
kNEC8861, /* use default settings during calibration */
|
||||
kEPSON, /* use default settings during calibration */
|
||||
0, /* not used here... */
|
||||
_WAF_MISC_IO_LAMPS, /* use miscio 6 for lamp switching */
|
||||
_MIO6 + _TPA(_MIO1) /* and miscio 1 for optional TPA */
|
||||
|
|
|
@ -195,7 +195,7 @@ static SANE_Bool usb_MapDownload( pPlustek_Device dev, u_char bDataType )
|
|||
fInverse ^= 1;
|
||||
}
|
||||
|
||||
if((scanning->dwFlag & SCANDEF_Inverse) &&
|
||||
if((scanning->dwFlag & SCANFLAG_Invert) &&
|
||||
!(scanning->dwFlag & SCANFLAG_Pseudo48)) {
|
||||
fInverse ^= 1;
|
||||
}
|
||||
|
|
|
@ -303,6 +303,15 @@ static void usb_GetSoftwareOffsetGain( pPlustek_Device dev )
|
|||
|
||||
switch( sCaps->bCCD ) {
|
||||
|
||||
case kEPSON:
|
||||
DBG( _DBG_INFO2, "kEPSON adjustments\n" );
|
||||
#if 0
|
||||
pParam->swGain[0] = 800;
|
||||
pParam->swGain[1] = 800;
|
||||
pParam->swGain[2] = 800;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case kNECSLIM:
|
||||
DBG( _DBG_INFO2, "kNECSLIM adjustments\n" );
|
||||
if( pParam->PhyDpi.x <= 150 ) {
|
||||
|
@ -686,7 +695,7 @@ static SANE_Bool usb_AdjustGain( pPlustek_Device dev, int fNegative )
|
|||
#if 0
|
||||
m_ScanParam.Size.dwPixels = dev->usbDev.pSource->Size.x *
|
||||
scaps->OpticDpi.x / 300UL;
|
||||
#endif
|
||||
#endif
|
||||
m_ScanParam.Size.dwBytes = m_ScanParam.Size.dwPixels *
|
||||
2 * m_ScanParam.bChannels;
|
||||
|
||||
|
@ -749,7 +758,7 @@ TOGAIN:
|
|||
|
||||
rgb.Red = rgb.Green = rgb.Blue = dwGrayMax = 0;
|
||||
|
||||
for( dw = 0; dw < dwLoop;) {
|
||||
for( dw = 0; dw < dwLoop; ) {
|
||||
|
||||
rgbSum.Red = rgbSum.Green = rgbSum.Blue = 0;
|
||||
for( dw10 = 20; dw10--; dw++ ) {
|
||||
|
@ -1152,6 +1161,7 @@ static SANE_Bool usb_AdjustOffset( pPlustek_Device dev )
|
|||
else
|
||||
dwPixels = (u_long)(hw->bOpticBlackEnd - hw->bOpticBlackStart );
|
||||
|
||||
m_ScanParam.Size.dwPixels = 2550;
|
||||
m_ScanParam.Size.dwBytes = m_ScanParam.Size.dwPixels * 2 *
|
||||
m_ScanParam.bChannels;
|
||||
if( hw->bReg_0x26 & _ONE_CH_COLOR &&
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
* based in Montys' great work
|
||||
* - added altCalibration option
|
||||
* - removed parallelport support --> new backend: plustek_pp
|
||||
* - cleanup
|
||||
*.
|
||||
* <hr>
|
||||
* This file is part of the SANE package.
|
||||
|
@ -135,7 +136,7 @@
|
|||
#include "sane/sanei.h"
|
||||
#include "sane/saneopts.h"
|
||||
|
||||
#define BACKEND_VERSION "0.46-1"
|
||||
#define BACKEND_VERSION "0.46-2"
|
||||
#define BACKEND_NAME plustek
|
||||
#include "sane/sanei_backend.h"
|
||||
#include "sane/sanei_config.h"
|
||||
|
@ -145,10 +146,7 @@
|
|||
# define _PLUSTEK_USB
|
||||
#endif
|
||||
|
||||
#include "plustek-share.h"
|
||||
#ifdef _PLUSTEK_USB
|
||||
# include "plustek-usb.h"
|
||||
#endif
|
||||
#include "plustek-usb.h"
|
||||
#include "plustek.h"
|
||||
|
||||
/*********************** the debug levels ************************************/
|
||||
|
@ -202,16 +200,6 @@ static ModeParam mode_params[] =
|
|||
{1, 16, COLOR_TRUE48}
|
||||
};
|
||||
|
||||
/* HEINER
|
||||
static const SANE_String_Const mode_list[] =
|
||||
{
|
||||
SANE_I18N("Binary"),
|
||||
SANE_I18N("Halftone"),
|
||||
SANE_I18N("Gray"),
|
||||
SANE_I18N("Color"),
|
||||
NULL
|
||||
};
|
||||
*/
|
||||
static const SANE_String_Const mode_usb_list[] =
|
||||
{
|
||||
SANE_I18N("Binary"),
|
||||
|
@ -230,14 +218,6 @@ static const SANE_String_Const ext_mode_list[] =
|
|||
NULL
|
||||
};
|
||||
|
||||
static const SANE_String_Const halftone_list[] =
|
||||
{
|
||||
SANE_I18N("Dithermap 1"),
|
||||
SANE_I18N("Dithermap 2"),
|
||||
SANE_I18N("Randomize"),
|
||||
NULL
|
||||
};
|
||||
|
||||
static const SANE_Range percentage_range =
|
||||
{
|
||||
-100 << SANE_FIXED_SCALE_SHIFT, /* minimum */
|
||||
|
@ -245,11 +225,6 @@ static const SANE_Range percentage_range =
|
|||
1 << SANE_FIXED_SCALE_SHIFT /* quantization */
|
||||
};
|
||||
|
||||
/*
|
||||
* lens info
|
||||
*/
|
||||
static LensInfo lens = {{0,0,0,0,},{0,0,0,0,},{0,0,0,0,},{0,0,0,0,},0,0};
|
||||
|
||||
/* authorization stuff */
|
||||
static SANE_Auth_Callback auth = NULL;
|
||||
|
||||
|
@ -447,8 +422,9 @@ static RETSIGTYPE sigalarm_handler( int signo )
|
|||
static int reader_process( Plustek_Scanner *scanner, int pipe_fd )
|
||||
{
|
||||
int line;
|
||||
unsigned long status;
|
||||
unsigned long data_length;
|
||||
unsigned char *buf;
|
||||
unsigned long status;
|
||||
unsigned long data_length;
|
||||
struct SIGACTION act;
|
||||
|
||||
DBG( _DBG_PROC, "reader_process started\n" );
|
||||
|
@ -477,30 +453,20 @@ static int reader_process( Plustek_Scanner *scanner, int pipe_fd )
|
|||
}
|
||||
|
||||
/* here we read all data from the driver... */
|
||||
if( scanner->hw->readImage ) {
|
||||
buf = scanner->buf;
|
||||
status = scanner->hw->prepare( scanner->hw, buf );
|
||||
|
||||
if( 0 == status ) {
|
||||
|
||||
status = (unsigned long)scanner->hw->readImage( scanner->hw,
|
||||
scanner->buf, data_length);
|
||||
} else {
|
||||
for( line = 0; line < scanner->params.lines; line++ ) {
|
||||
|
||||
unsigned char *buf = scanner->buf;
|
||||
|
||||
|
||||
status = scanner->hw->prepare( scanner->hw, buf );
|
||||
|
||||
if( 0 == status ) {
|
||||
|
||||
for( line = 0; line < scanner->params.lines; line++ ) {
|
||||
|
||||
status = scanner->hw->readLine( scanner->hw );
|
||||
if((int)status < 0 ) {
|
||||
break;
|
||||
}
|
||||
|
||||
write( pipe_fd, buf, scanner->params.bytes_per_line );
|
||||
|
||||
buf += scanner->params.bytes_per_line;
|
||||
status = scanner->hw->readLine( scanner->hw );
|
||||
if((int)status < 0 ) {
|
||||
break;
|
||||
}
|
||||
|
||||
write( pipe_fd, buf, scanner->params.bytes_per_line );
|
||||
buf += scanner->params.bytes_per_line;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -515,12 +481,6 @@ static int reader_process( Plustek_Scanner *scanner, int pipe_fd )
|
|||
return SANE_STATUS_DEVICE_BUSY;
|
||||
|
||||
return SANE_STATUS_IO_ERROR;
|
||||
}
|
||||
|
||||
/* send to parent */
|
||||
if( scanner->hw->readImage ) {
|
||||
DBG( _DBG_PROC, "sending %lu bytes to parent\n", status );
|
||||
write( pipe_fd, scanner->buf, status );
|
||||
}
|
||||
|
||||
pipe_fd = -1;
|
||||
|
@ -591,11 +551,11 @@ static SANE_Status do_cancel( Plustek_Scanner *scanner, SANE_Bool closepipe )
|
|||
*/
|
||||
static SANE_Status limitResolution( Plustek_Device *dev )
|
||||
{
|
||||
dev->dpi_range.min = /*lens.rDpiY.wMin; */ _DEF_DPI;
|
||||
dev->dpi_range.min = _DEF_DPI;
|
||||
if( dev->dpi_range.min < _DEF_DPI )
|
||||
dev->dpi_range.min = _DEF_DPI;
|
||||
|
||||
dev->dpi_range.max = lens.rDpiY.wPhyMax;
|
||||
dev->dpi_range.max = dev->usbDev.Caps.OpticDpi.x * 2;
|
||||
dev->dpi_range.quant = 0;
|
||||
dev->x_range.min = 0;
|
||||
dev->x_range.max = SANE_FIX(dev->max_x);
|
||||
|
@ -724,17 +684,6 @@ static SANE_Status init_options( Plustek_Scanner *s )
|
|||
s->opt[OPT_EXT_MODE].constraint.string_list = ext_mode_list;
|
||||
s->val[OPT_EXT_MODE].w = 0; /* Normal */
|
||||
|
||||
/* halftone */
|
||||
s->opt[OPT_HALFTONE].name = SANE_NAME_HALFTONE_PATTERN;
|
||||
s->opt[OPT_HALFTONE].title = SANE_TITLE_HALFTONE;
|
||||
s->opt[OPT_HALFTONE].desc = SANE_DESC_HALFTONE_PATTERN;
|
||||
s->opt[OPT_HALFTONE].type = SANE_TYPE_STRING;
|
||||
s->opt[OPT_HALFTONE].size = 32;
|
||||
s->opt[OPT_HALFTONE].constraint_type = SANE_CONSTRAINT_STRING_LIST;
|
||||
s->opt[OPT_HALFTONE].constraint.string_list = halftone_list;
|
||||
s->val[OPT_HALFTONE].w = 0; /* Standard dithermap */
|
||||
s->opt[OPT_HALFTONE].cap |= SANE_CAP_INACTIVE;
|
||||
|
||||
/* brightness */
|
||||
s->opt[OPT_BRIGHTNESS].name = SANE_NAME_BRIGHTNESS;
|
||||
s->opt[OPT_BRIGHTNESS].title = SANE_TITLE_BRIGHTNESS;
|
||||
|
@ -1106,14 +1055,11 @@ static SANE_Status attach( const char *dev_name, pCnfDef cnf,
|
|||
dev->open = usbDev_open;
|
||||
dev->close = usbDev_close;
|
||||
dev->getCaps = usbDev_getCaps;
|
||||
dev->getLensInfo = usbDev_getLensInfo;
|
||||
dev->getCropInfo = usbDev_getCropInfo;
|
||||
dev->putImgInfo = NULL;
|
||||
dev->setScanEnv = usbDev_setScanEnv;
|
||||
dev->startScan = usbDev_startScan;
|
||||
dev->stopScan = usbDev_stopScan;
|
||||
dev->setMap = usbDev_setMap;
|
||||
dev->readImage = NULL;
|
||||
dev->readLine = usbDev_readLine;
|
||||
dev->prepare = usbDev_Prepare;
|
||||
dev->shutdown = usbDev_shutdown;
|
||||
|
@ -1154,20 +1100,6 @@ static SANE_Status attach( const char *dev_name, pCnfDef cnf,
|
|||
return SANE_STATUS_IO_ERROR;
|
||||
}
|
||||
|
||||
result = dev->getLensInfo( dev, &lens );
|
||||
if( result < 0 ) {
|
||||
DBG( _DBG_ERROR, "dev->getLensInfo() failed(%d)\n", result );
|
||||
dev->close(dev);
|
||||
return SANE_STATUS_IO_ERROR;
|
||||
}
|
||||
|
||||
/* did we fail on connection? */
|
||||
if( _NO_BASE == dev->caps.wIOBase ) {
|
||||
DBG( _DBG_ERROR, "failed to find Plustek scanner\n" );
|
||||
dev->close(dev);
|
||||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
|
||||
/* save the info we got from the driver */
|
||||
DBG( _DBG_INFO, "Scanner information:\n" );
|
||||
#ifdef _PLUSTEK_USB
|
||||
|
@ -1184,8 +1116,12 @@ static SANE_Status attach( const char *dev_name, pCnfDef cnf,
|
|||
dev->max_x = dev->caps.wMaxExtentX*MM_PER_INCH/_MEASURE_BASE;
|
||||
dev->max_y = dev->caps.wMaxExtentY*MM_PER_INCH/_MEASURE_BASE;
|
||||
|
||||
dev->res_list = (SANE_Int *)calloc(((lens.rDpiX.wMax -_DEF_DPI)/25 + 1),
|
||||
sizeof (SANE_Int)); /* one more to avoid a buffer overflow */
|
||||
/* calculate the size of the resolution list +
|
||||
* one more to avoid a buffer overflow, then allocate it...
|
||||
*/
|
||||
dev->res_list = (SANE_Int *)
|
||||
calloc((((dev->usbDev.Caps.OpticDpi.x*16)-_DEF_DPI)/25+1),
|
||||
sizeof (SANE_Int));
|
||||
|
||||
if (NULL == dev->res_list) {
|
||||
DBG( _DBG_ERROR, "alloc fail, resolution problem\n" );
|
||||
|
@ -1195,7 +1131,7 @@ static SANE_Status attach( const char *dev_name, pCnfDef cnf,
|
|||
|
||||
/* build up the resolution table */
|
||||
dev->res_list_size = 0;
|
||||
for( cntr = _DEF_DPI; cntr <= lens.rDpiX.wMax; cntr += 25 ) {
|
||||
for( cntr = _DEF_DPI; cntr <= (dev->usbDev.Caps.OpticDpi.x*16); cntr += 25 ) {
|
||||
dev->res_list_size++;
|
||||
dev->res_list[dev->res_list_size - 1] = (SANE_Int)cntr;
|
||||
}
|
||||
|
@ -1314,7 +1250,7 @@ SANE_Status sane_init( SANE_Int *version_code, SANE_Auth_Callback authorize )
|
|||
decodeVal( str, "enableTPA", _INT, &config.adj.enableTpa, &ival);
|
||||
decodeVal( str, "cacheCalData",
|
||||
_INT, &config.adj.cacheCalData,&ival);
|
||||
decodeVal( str, "altCalibrate",
|
||||
decodeVal( str, "altCalibration",
|
||||
_INT, &config.adj.altCalibrate,&ival);
|
||||
decodeVal( str, "skipCalibration",
|
||||
_INT, &config.adj.skipCalibration,&ival);
|
||||
|
@ -1564,7 +1500,7 @@ SANE_Status sane_control_option( SANE_Handle handle, SANE_Int option,
|
|||
SANE_Status status;
|
||||
const SANE_String_Const *optval;
|
||||
pModeParam mp;
|
||||
int scanmode;
|
||||
int scanmode, idx;
|
||||
|
||||
if ( s->scanning )
|
||||
return SANE_STATUS_DEVICE_BUSY;
|
||||
|
@ -1598,7 +1534,6 @@ SANE_Status sane_control_option( SANE_Handle handle, SANE_Int option,
|
|||
|
||||
case OPT_MODE:
|
||||
case OPT_EXT_MODE:
|
||||
case OPT_HALFTONE:
|
||||
strcpy ((char *) value,
|
||||
s->opt[option].constraint.string_list[s->val[option].w]);
|
||||
break;
|
||||
|
@ -1716,20 +1651,12 @@ SANE_Status sane_control_option( SANE_Handle handle, SANE_Int option,
|
|||
((*(SANE_Word *)value) >> SANE_FIXED_SCALE_SHIFT);
|
||||
break;
|
||||
|
||||
case OPT_MODE: {
|
||||
|
||||
int idx = (optval - mode_usb_list);
|
||||
|
||||
mp = getModeList( s );
|
||||
if( mp[idx].scanmode != COLOR_HALFTONE ){
|
||||
s->opt[OPT_HALFTONE].cap |= SANE_CAP_INACTIVE;
|
||||
s->opt[OPT_CONTRAST].cap &= ~SANE_CAP_INACTIVE;
|
||||
s->opt[OPT_CUSTOM_GAMMA].cap &= ~SANE_CAP_INACTIVE;
|
||||
} else {
|
||||
s->opt[OPT_HALFTONE].cap &= ~SANE_CAP_INACTIVE;
|
||||
s->opt[OPT_CONTRAST].cap |= SANE_CAP_INACTIVE;
|
||||
s->opt[OPT_CUSTOM_GAMMA].cap |= SANE_CAP_INACTIVE;
|
||||
}
|
||||
case OPT_MODE:
|
||||
idx = (optval - mode_usb_list);
|
||||
mp = getModeList( s );
|
||||
|
||||
s->opt[OPT_CONTRAST].cap &= ~SANE_CAP_INACTIVE;
|
||||
s->opt[OPT_CUSTOM_GAMMA].cap &= ~SANE_CAP_INACTIVE;
|
||||
|
||||
if( mp[idx].scanmode == COLOR_BW ) {
|
||||
s->opt[OPT_CONTRAST].cap |= SANE_CAP_INACTIVE;
|
||||
|
@ -1756,10 +1683,7 @@ SANE_Status sane_control_option( SANE_Handle handle, SANE_Int option,
|
|||
|
||||
if( NULL != info )
|
||||
*info |= SANE_INFO_RELOAD_OPTIONS | SANE_INFO_RELOAD_PARAMS;
|
||||
}
|
||||
|
||||
/* fall through to OPT_HALFTONE */
|
||||
case OPT_HALFTONE:
|
||||
s->val[option].w = optval - s->opt[option].constraint.string_list;
|
||||
break;
|
||||
|
||||
|
@ -1779,10 +1703,9 @@ SANE_Status sane_control_option( SANE_Handle handle, SANE_Int option,
|
|||
s->val[OPT_TL_Y].w = SANE_FIX(_DEFAULT_TLY);
|
||||
s->val[OPT_BR_X].w = SANE_FIX(_DEFAULT_BRX);
|
||||
s->val[OPT_BR_Y].w = SANE_FIX(_DEFAULT_BRY);
|
||||
s->val[OPT_MODE].w = 3; /* COLOR_TRUE24 */
|
||||
|
||||
s->opt[OPT_MODE].constraint.string_list = mode_usb_list;
|
||||
s->val[OPT_MODE].w = 3; /* COLOR_TRUE24 */
|
||||
s->val[OPT_MODE].w = COLOR_TRUE24;
|
||||
|
||||
} else {
|
||||
|
||||
|
@ -1804,19 +1727,11 @@ SANE_Status sane_control_option( SANE_Handle handle, SANE_Int option,
|
|||
s->val[OPT_BR_X].w = SANE_FIX(_DEFAULT_NEG_BRX);
|
||||
s->val[OPT_BR_Y].w = SANE_FIX(_DEFAULT_NEG_BRY);
|
||||
}
|
||||
/* HEINER
|
||||
if( s->hw->caps.dwFlag & SFLAG_TPA ) {
|
||||
*/
|
||||
s->opt[OPT_MODE].constraint.string_list =
|
||||
s->opt[OPT_MODE].constraint.string_list =
|
||||
&mode_usb_list[_TPAModeSupportMin];
|
||||
/* HEINER } else {
|
||||
s->opt[OPT_MODE].constraint.string_list =
|
||||
&mode_list[_TPAModeSupportMin];
|
||||
}
|
||||
*/ s->val[OPT_MODE].w = 0; /* COLOR_24 is the default */
|
||||
s->val[OPT_MODE].w = 0; /* COLOR_24 is the default */
|
||||
}
|
||||
|
||||
s->opt[OPT_HALFTONE].cap |= SANE_CAP_INACTIVE;
|
||||
s->opt[OPT_CONTRAST].cap &= ~SANE_CAP_INACTIVE;
|
||||
|
||||
if( NULL != info )
|
||||
|
@ -1917,20 +1832,21 @@ SANE_Status sane_get_parameters( SANE_Handle handle, SANE_Parameters *params )
|
|||
*/
|
||||
SANE_Status sane_start( SANE_Handle handle )
|
||||
{
|
||||
Plustek_Scanner *s = (Plustek_Scanner *) handle;
|
||||
pModeParam mp;
|
||||
Plustek_Scanner *s = (Plustek_Scanner *)handle;
|
||||
pPlustek_Device dev;
|
||||
pModeParam mp;
|
||||
|
||||
int result;
|
||||
int ndpi;
|
||||
int left, top;
|
||||
int width, height;
|
||||
int scanmode;
|
||||
int result;
|
||||
int ndpi;
|
||||
int left, top;
|
||||
int width, height;
|
||||
int scanmode;
|
||||
int fds[2];
|
||||
StartScan start;
|
||||
CropInfo crop;
|
||||
double dpi_x, dpi_y;
|
||||
CropInfo crop;
|
||||
ScanInfo sinfo;
|
||||
SANE_Status status;
|
||||
SANE_Word tmp;
|
||||
SANE_Word tmp;
|
||||
|
||||
DBG( _DBG_SANE_INIT, "sane_start\n" );
|
||||
|
||||
|
@ -1944,11 +1860,13 @@ SANE_Status sane_start( SANE_Handle handle )
|
|||
return status;
|
||||
}
|
||||
|
||||
dev = s->hw;
|
||||
|
||||
/*
|
||||
* open the driver and get some information about the scanner
|
||||
*/
|
||||
s->hw->fd = drvopen( s->hw );
|
||||
if( s->hw->fd < 0 ) {
|
||||
dev->fd = drvopen( dev );
|
||||
if( dev->fd < 0 ) {
|
||||
DBG( _DBG_ERROR,"sane_start: open failed: %d\n", errno );
|
||||
|
||||
if( errno == EBUSY )
|
||||
|
@ -1957,27 +1875,13 @@ SANE_Status sane_start( SANE_Handle handle )
|
|||
return SANE_STATUS_IO_ERROR;
|
||||
}
|
||||
|
||||
result = s->hw->getCaps( s->hw );
|
||||
result = dev->getCaps( dev );
|
||||
if( result < 0 ) {
|
||||
DBG( _DBG_ERROR, "dev->getCaps() failed(%d)\n", result);
|
||||
s->hw->close( s->hw );
|
||||
dev->close( dev );
|
||||
return SANE_STATUS_IO_ERROR;
|
||||
}
|
||||
|
||||
result = s->hw->getLensInfo( s->hw, &lens );
|
||||
if( result < 0 ) {
|
||||
DBG( _DBG_ERROR, "dev->getLensInfo() failed(%d)\n", result );
|
||||
s->hw->close( s->hw );
|
||||
return SANE_STATUS_IO_ERROR;
|
||||
}
|
||||
|
||||
/* did we fail on connection? */
|
||||
if ( s->hw->caps.wIOBase == _NO_BASE ) {
|
||||
DBG( _DBG_ERROR, "failed to find Plustek scanner\n" );
|
||||
s->hw->close( s->hw );
|
||||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
|
||||
/* All ready to go. Set image def and see what the scanner
|
||||
* says for crop info.
|
||||
*/
|
||||
|
@ -1999,17 +1903,17 @@ SANE_Status sane_start( SANE_Handle handle )
|
|||
}
|
||||
|
||||
/* position and extent are always relative to 300 dpi */
|
||||
left = (int)(SANE_UNFIX (s->val[OPT_TL_X].w)*(double)lens.rDpiX.wPhyMax/
|
||||
(MM_PER_INCH*((double)lens.rDpiX.wPhyMax/300.0)));
|
||||
top = (int)(SANE_UNFIX (s->val[OPT_TL_Y].w)*(double)lens.rDpiY.wPhyMax/
|
||||
(MM_PER_INCH*((double)lens.rDpiY.wPhyMax/300.0)));
|
||||
dpi_x = (double)dev->usbDev.Caps.OpticDpi.x;
|
||||
dpi_y = (double)dev->usbDev.Caps.OpticDpi.x * 2;
|
||||
|
||||
left = (int)(SANE_UNFIX (s->val[OPT_TL_X].w)*dpi_x/
|
||||
(MM_PER_INCH*(dpi_x/300.0)));
|
||||
top = (int)(SANE_UNFIX (s->val[OPT_TL_Y].w)*dpi_y/
|
||||
(MM_PER_INCH*(dpi_y/300.0)));
|
||||
width = (int)(SANE_UNFIX (s->val[OPT_BR_X].w - s->val[OPT_TL_X].w) *
|
||||
(double)lens.rDpiX.wPhyMax /
|
||||
(MM_PER_INCH *((double)lens.rDpiX.wPhyMax/300.0)));
|
||||
dpi_x / (MM_PER_INCH *(dpi_x/300.0)));
|
||||
height = (int)(SANE_UNFIX (s->val[OPT_BR_Y].w - s->val[OPT_TL_Y].w) *
|
||||
(double)lens.rDpiY.wPhyMax /
|
||||
(MM_PER_INCH *((double)lens.rDpiY.wPhyMax/300.0)));
|
||||
|
||||
dpi_y / (MM_PER_INCH *(dpi_y/300.0)));
|
||||
/*
|
||||
* adjust mode list according to the model we use and the
|
||||
* source we have
|
||||
|
@ -2020,53 +1924,26 @@ SANE_Status sane_start( SANE_Handle handle )
|
|||
DBG( _DBG_INFO, "scanmode = %u\n", scanmode );
|
||||
|
||||
/* clear it out just in case */
|
||||
memset (&sinfo, 0, sizeof(sinfo));
|
||||
sinfo.ImgDef.xyDpi.x = ndpi;
|
||||
sinfo.ImgDef.xyDpi.y = ndpi;
|
||||
sinfo.ImgDef.crArea.x = left; /* offset from left edge to area you want to scan */
|
||||
sinfo.ImgDef.crArea.y = top; /* offset from top edge to area you want to scan */
|
||||
sinfo.ImgDef.crArea.cx = width; /* always relative to 300 dpi */
|
||||
sinfo.ImgDef.crArea.cy = height;
|
||||
sinfo.ImgDef.wDataType = scanmode;
|
||||
|
||||
/*
|
||||
* CHECK: what about the 10 bit mode?
|
||||
*/
|
||||
if( COLOR_TRUE48 == scanmode )
|
||||
sinfo.ImgDef.wBits = OUTPUT_12Bits;
|
||||
else if( COLOR_TRUE32 == scanmode )
|
||||
sinfo.ImgDef.wBits = OUTPUT_10Bits;
|
||||
else
|
||||
sinfo.ImgDef.wBits = OUTPUT_8Bits;
|
||||
|
||||
sinfo.ImgDef.dwFlag = SCANDEF_QualityScan;
|
||||
memset (&crop, 0, sizeof(crop));
|
||||
crop.ImgDef.xyDpi.x = ndpi;
|
||||
crop.ImgDef.xyDpi.y = ndpi;
|
||||
crop.ImgDef.crArea.x = left; /* offset from left edge to area you want to scan */
|
||||
crop.ImgDef.crArea.y = top; /* offset from top edge to area you want to scan */
|
||||
crop.ImgDef.crArea.cx = width; /* always relative to 300 dpi */
|
||||
crop.ImgDef.crArea.cy = height;
|
||||
crop.ImgDef.wDataType = scanmode;
|
||||
crop.ImgDef.dwFlag = SCANDEF_QualityScan;
|
||||
|
||||
switch( s->val[OPT_EXT_MODE].w ) {
|
||||
case 1: sinfo.ImgDef.dwFlag |= SCANDEF_Transparency; break;
|
||||
case 2: sinfo.ImgDef.dwFlag |= SCANDEF_Negative; break;
|
||||
case 1: crop.ImgDef.dwFlag |= SCANDEF_Transparency; break;
|
||||
case 2: crop.ImgDef.dwFlag |= SCANDEF_Negative; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
sinfo.ImgDef.wLens = s->hw->caps.wLens;
|
||||
|
||||
/* only for parallel-port devices */
|
||||
if( s->hw->putImgInfo ) {
|
||||
result = s->hw->putImgInfo( s->hw, &sinfo.ImgDef );
|
||||
if( result < 0 ) {
|
||||
DBG( _DBG_ERROR, "dev->putImgInfo failed(%d)\n", result );
|
||||
s->hw->close( s->hw );
|
||||
return SANE_STATUS_IO_ERROR;
|
||||
}
|
||||
} else {
|
||||
|
||||
memcpy( &(crop.ImgDef), &sinfo.ImgDef, sizeof(ImgDef));
|
||||
|
||||
}
|
||||
|
||||
result = s->hw->getCropInfo( s->hw, &crop );
|
||||
result = dev->getCropInfo( dev, &crop );
|
||||
if( result < 0 ) {
|
||||
DBG( _DBG_ERROR, "dev->getCropInfo() failed(%d)\n", result );
|
||||
s->hw->close( s->hw );
|
||||
dev->close( dev );
|
||||
return SANE_STATUS_IO_ERROR;
|
||||
}
|
||||
|
||||
|
@ -2076,53 +1953,51 @@ SANE_Status sane_start( SANE_Handle handle )
|
|||
s->params.lines = crop.dwLinesPerArea;
|
||||
|
||||
/* build a SCANINFO block and get ready to scan it */
|
||||
sinfo.ImgDef.dwFlag |= (SCANDEF_BuildBwMap | SCANDEF_QualityScan);
|
||||
crop.ImgDef.dwFlag |= SCANDEF_QualityScan;
|
||||
|
||||
/* remove that for preview scans */
|
||||
if( s->val[OPT_PREVIEW].w )
|
||||
sinfo.ImgDef.dwFlag &= (~SCANDEF_QualityScan);
|
||||
crop.ImgDef.dwFlag &= (~SCANDEF_QualityScan);
|
||||
|
||||
/* set adjustments for brightness and contrast */
|
||||
sinfo.siBrightness = s->val[OPT_BRIGHTNESS].w;
|
||||
sinfo.siContrast = s->val[OPT_CONTRAST].w;
|
||||
sinfo.wDither = s->val[OPT_HALFTONE].w;
|
||||
|
||||
DBG( _DBG_SANE_INIT, "bright %i contrast %i\n", sinfo.siBrightness,
|
||||
sinfo.siContrast);
|
||||
memcpy( &sinfo.ImgDef, &crop.ImgDef, sizeof(ImgDef));
|
||||
|
||||
DBG( _DBG_SANE_INIT, "brightness %i, contrast %i\n",
|
||||
sinfo.siBrightness, sinfo.siContrast );
|
||||
|
||||
result = s->hw->setScanEnv( s->hw, &sinfo );
|
||||
result = dev->setScanEnv( dev, &sinfo );
|
||||
if( result < 0 ) {
|
||||
DBG( _DBG_ERROR, "dev->setEnv() failed(%d)\n", result );
|
||||
s->hw->close( s->hw );
|
||||
dev->close( dev );
|
||||
return SANE_STATUS_IO_ERROR;
|
||||
}
|
||||
|
||||
/* download gamma correction tables... */
|
||||
if( scanmode <= COLOR_256GRAY || scanmode == COLOR_GRAY16 ) {
|
||||
s->hw->setMap( s->hw, s->gamma_table[0], s->gamma_length, _MAP_MASTER);
|
||||
if( scanmode <= COLOR_GRAY16 ) {
|
||||
dev->setMap( dev, s->gamma_table[0], s->gamma_length, _MAP_MASTER);
|
||||
} else {
|
||||
s->hw->setMap( s->hw, s->gamma_table[1], s->gamma_length, _MAP_RED );
|
||||
s->hw->setMap( s->hw, s->gamma_table[2], s->gamma_length, _MAP_GREEN );
|
||||
s->hw->setMap( s->hw, s->gamma_table[3], s->gamma_length, _MAP_BLUE );
|
||||
dev->setMap( dev, s->gamma_table[1], s->gamma_length, _MAP_RED );
|
||||
dev->setMap( dev, s->gamma_table[2], s->gamma_length, _MAP_GREEN );
|
||||
dev->setMap( dev, s->gamma_table[3], s->gamma_length, _MAP_BLUE );
|
||||
}
|
||||
/* work-around for USB... */
|
||||
start.dwLinesPerScan = s->params.lines;
|
||||
|
||||
result = s->hw->startScan( s->hw, &start );
|
||||
result = dev->startScan( dev );
|
||||
if( result < 0 ) {
|
||||
DBG( _DBG_ERROR, "dev->startScan() failed(%d)\n", result );
|
||||
s->hw->close( s->hw );
|
||||
dev->close( dev );
|
||||
return SANE_STATUS_IO_ERROR;
|
||||
}
|
||||
|
||||
DBG( _DBG_SANE_INIT, "dwflag = 0x%lx dwBytesPerLine = %ld, "
|
||||
"dwLinesPerScan = %ld\n",
|
||||
start.dwFlag, start.dwBytesPerLine, start.dwLinesPerScan);
|
||||
DBG( _DBG_SANE_INIT, "dwflag = 0x%lx dwBytesPerLine = %ld \n",
|
||||
dev->scanning.dwFlag, dev->scanning.dwBytesLine );
|
||||
|
||||
s->buf = realloc( s->buf, (s->params.lines) * s->params.bytes_per_line );
|
||||
if( NULL == s->buf ) {
|
||||
DBG( _DBG_ERROR, "realloc failed\n" );
|
||||
s->hw->close( s->hw );
|
||||
dev->close( dev );
|
||||
return SANE_STATUS_NO_MEM;
|
||||
}
|
||||
|
||||
|
@ -2138,7 +2013,7 @@ SANE_Status sane_start( SANE_Handle handle )
|
|||
if( pipe(fds) < 0 ) {
|
||||
DBG( _DBG_ERROR, "ERROR: could not create pipe\n" );
|
||||
s->scanning = SANE_FALSE;
|
||||
s->hw->close( s->hw );
|
||||
dev->close( dev );
|
||||
return SANE_STATUS_IO_ERROR;
|
||||
}
|
||||
|
||||
|
@ -2151,7 +2026,7 @@ SANE_Status sane_start( SANE_Handle handle )
|
|||
if( s->reader_pid < 0 ) {
|
||||
DBG( _DBG_ERROR, "ERROR: could not create child process\n" );
|
||||
s->scanning = SANE_FALSE;
|
||||
s->hw->close( s->hw );
|
||||
dev->close( dev );
|
||||
return SANE_STATUS_IO_ERROR;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
# or simply
|
||||
# [merlin-device]
|
||||
#
|
||||
# or if you want a specific device but you have no idea about
|
||||
# the device node or you use libusb, simply set vendor- and product-ID
|
||||
# or if you want a specific device but you have no idea about the
|
||||
# device node or you use libusb, simply set vendor- and product-ID
|
||||
# [merlin-device] 0x07B3 0x0017
|
||||
# device auto
|
||||
#
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
* - 0.45 - added readLine function
|
||||
* - 0.46 - flag initialized is now used as device index
|
||||
* - added calFile to Plustek_Device
|
||||
* - removed _OPT_HALFTONE
|
||||
* .
|
||||
* <hr>
|
||||
* This file is part of the SANE package.
|
||||
|
@ -96,8 +97,10 @@
|
|||
# define PATH_MAX 1024
|
||||
#endif
|
||||
|
||||
/*
|
||||
* the default image size
|
||||
#define _MEASURE_BASE 300UL
|
||||
#define _DEF_DPI 50
|
||||
|
||||
/** the default image size
|
||||
*/
|
||||
#define _DEFAULT_TLX 0 /* 0..216 mm */
|
||||
#define _DEFAULT_TLY 0 /* 0..297 mm */
|
||||
|
@ -114,9 +117,16 @@
|
|||
#define _DEFAULT_NEG_BRX 37.5 /* 0..38.9 mm */
|
||||
#define _DEFAULT_NEG_BRY 25.5 /* 0..29.6 mm */
|
||||
|
||||
/*
|
||||
* image sizes for normal, transparent and negative modes
|
||||
/** image sizes for normal, transparent and negative modes
|
||||
*/
|
||||
#define _TPAPageWidth 500U
|
||||
#define _TPAPageHeight 510U
|
||||
#define _TPAMinDpi 150
|
||||
#define _TPAModeSupportMin COLOR_TRUE24
|
||||
|
||||
#define _NegativePageWidth 460UL
|
||||
#define _NegativePageHeight 350UL
|
||||
|
||||
#define _NORMAL_X 216.0
|
||||
#define _NORMAL_Y 297.0
|
||||
#define _TP_X ((double)_TPAPageWidth/300.0 * MM_PER_INCH)
|
||||
|
@ -124,42 +134,101 @@
|
|||
#define _NEG_X ((double)_NegativePageWidth/300.0 * MM_PER_INCH)
|
||||
#define _NEG_Y ((double)_NegativePageHeight/300.0 * MM_PER_INCH)
|
||||
|
||||
/** scan modes
|
||||
*/
|
||||
#define COLOR_BW 0
|
||||
#define COLOR_256GRAY 1
|
||||
#define COLOR_GRAY16 2
|
||||
#define COLOR_TRUE24 3
|
||||
#define COLOR_TRUE48 4
|
||||
|
||||
/** usb id buffer
|
||||
*/
|
||||
#define _MAX_ID_LEN 20
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
#define SFLAG_SCANNERDEV 0x00000002 /* is scannerdevice */
|
||||
#define SFLAG_FLATBED 0x00000004 /* is flatbed scanner */
|
||||
|
||||
#define SFLAG_ADF 0x00000010 /* Automatic document feeder */
|
||||
#define SFLAG_TPA 0x00000080 /* has transparency adapter */
|
||||
#define SFLAG_BUTTONOPT 0x00000100 /* has buttons */
|
||||
|
||||
#define SFLAG_CUSTOM_GAMMA 0x00000200 /* driver supports custom gamma */
|
||||
|
||||
/**
|
||||
*/
|
||||
#define SCANDEF_Transparency 0x00000100 /* Scanning from transparency*/
|
||||
#define SCANDEF_Negative 0x00000200 /* Scanning from negative */
|
||||
#define SCANDEF_QualityScan 0x00000400 /* Scanning in quality mode */
|
||||
#define SCANDEF_ContinuousScan 0x00001000
|
||||
#define SCANDEF_TPA (SCANDEF_Transparency | SCANDEF_Negative)
|
||||
|
||||
#define SCANDEF_Adf 0x00020000 /* Scan from ADF tray */
|
||||
|
||||
/**
|
||||
*/
|
||||
#define SOURCE_Reflection 0
|
||||
#define SOURCE_Transparency 1
|
||||
#define SOURCE_Negative 2
|
||||
#define SOURCE_ADF 3
|
||||
|
||||
/** for Gamma tables
|
||||
*/
|
||||
#define _MAP_RED 0
|
||||
#define _MAP_GREEN 1
|
||||
#define _MAP_BLUE 2
|
||||
#define _MAP_MASTER 3
|
||||
|
||||
/** generic error codes...
|
||||
*/
|
||||
#define _FIRST_ERR -9000
|
||||
|
||||
#define _E_ALLOC (_FIRST_ERR-1) /**< error allocating memory */
|
||||
#define _E_INVALID (_FIRST_ERR-2) /**< invalid parameter detected */
|
||||
#define _E_INTERNAL (_FIRST_ERR-3) /**< internal error */
|
||||
#define _E_ABORT (_FIRST_ERR-4) /**< operation aborted */
|
||||
|
||||
#define _E_LAMP_NOT_IN_POS (_FIRST_ERR-10)
|
||||
#define _E_LAMP_NOT_STABLE (_FIRST_ERR-11)
|
||||
#define _E_NODATA (_FIRST_ERR-12)
|
||||
#define _E_BUFFER_TOO_SMALL (_FIRST_ERR-13)
|
||||
#define _E_DATAREAD (_FIRST_ERR-14)
|
||||
|
||||
|
||||
/************************ some structures ************************************/
|
||||
|
||||
enum {
|
||||
OPT_NUM_OPTS = 0,
|
||||
OPT_MODE_GROUP,
|
||||
OPT_MODE,
|
||||
OPT_NUM_OPTS = 0,
|
||||
OPT_MODE_GROUP,
|
||||
OPT_MODE,
|
||||
OPT_EXT_MODE,
|
||||
OPT_RESOLUTION,
|
||||
OPT_PREVIEW,
|
||||
OPT_GEOMETRY_GROUP,
|
||||
OPT_TL_X,
|
||||
OPT_TL_Y,
|
||||
OPT_BR_X,
|
||||
OPT_BR_Y,
|
||||
OPT_RESOLUTION,
|
||||
OPT_PREVIEW,
|
||||
OPT_GEOMETRY_GROUP,
|
||||
OPT_TL_X,
|
||||
OPT_TL_Y,
|
||||
OPT_BR_X,
|
||||
OPT_BR_Y,
|
||||
OPT_ENHANCEMENT_GROUP,
|
||||
OPT_HALFTONE,
|
||||
OPT_BRIGHTNESS,
|
||||
OPT_CONTRAST,
|
||||
OPT_CUSTOM_GAMMA,
|
||||
OPT_GAMMA_VECTOR,
|
||||
OPT_GAMMA_VECTOR_R,
|
||||
OPT_GAMMA_VECTOR_G,
|
||||
OPT_GAMMA_VECTOR_B,
|
||||
NUM_OPTIONS
|
||||
OPT_BRIGHTNESS,
|
||||
OPT_CONTRAST,
|
||||
OPT_CUSTOM_GAMMA,
|
||||
OPT_GAMMA_VECTOR,
|
||||
OPT_GAMMA_VECTOR_R,
|
||||
OPT_GAMMA_VECTOR_G,
|
||||
OPT_GAMMA_VECTOR_B,
|
||||
NUM_OPTIONS
|
||||
};
|
||||
|
||||
/*
|
||||
* to distinguish between parallelport and USB device
|
||||
/**
|
||||
*/
|
||||
typedef enum {
|
||||
PARPORT = 0,
|
||||
USB,
|
||||
NUM_PORTTYPES
|
||||
} PORTTYPE;
|
||||
typedef struct {
|
||||
int x;
|
||||
int y;
|
||||
} OffsDef, *pOffsDef;
|
||||
|
||||
/** for adjusting the scanner settings
|
||||
*/
|
||||
|
@ -194,10 +263,53 @@ typedef struct {
|
|||
double ggamma;
|
||||
double bgamma;
|
||||
|
||||
|
||||
double graygamma;
|
||||
|
||||
} AdjDef, *pAdjDef;
|
||||
|
||||
typedef struct {
|
||||
unsigned short x;
|
||||
unsigned short y;
|
||||
unsigned short cx;
|
||||
unsigned short cy;
|
||||
} CropRect, *pCropRect;
|
||||
|
||||
typedef struct image {
|
||||
unsigned long dwFlag;
|
||||
CropRect crArea;
|
||||
XY xyDpi;
|
||||
unsigned short wDataType;
|
||||
} ImgDef, *pImgDef;
|
||||
|
||||
typedef struct {
|
||||
unsigned long dwPixelsPerLine;
|
||||
unsigned long dwBytesPerLine;
|
||||
unsigned long dwLinesPerArea;
|
||||
ImgDef ImgDef;
|
||||
} CropInfo, *pCropInfo;
|
||||
|
||||
typedef struct {
|
||||
ImgDef ImgDef;
|
||||
short siBrightness;
|
||||
short siContrast;
|
||||
} ScanInfo, *pScanInfo;
|
||||
|
||||
typedef struct {
|
||||
unsigned long dwFlag;
|
||||
unsigned short wMaxExtentX; /**< scanarea width */
|
||||
unsigned short wMaxExtentY; /**< scanarea height */
|
||||
} ScannerCaps, *pScannerCaps;
|
||||
|
||||
/** for defining the scanmodes
|
||||
*/
|
||||
typedef const struct mode_param
|
||||
{
|
||||
int color;
|
||||
int depth;
|
||||
int scanmode;
|
||||
} ModeParam, *pModeParam;
|
||||
|
||||
typedef struct Plustek_Device
|
||||
{
|
||||
SANE_Int initialized; /* device already initialized? */
|
||||
|
@ -219,12 +331,10 @@ typedef struct Plustek_Device
|
|||
/**************************** USB-stuff **********************************/
|
||||
char usbId[_MAX_ID_LEN];/* to keep Vendor and product */
|
||||
/* ID string (from conf) file */
|
||||
#ifdef _PLUSTEK_USB
|
||||
ScanDef scanning; /* here we hold all stuff for */
|
||||
struct ScanDef scanning; /* here we hold all stuff for */
|
||||
/* the USB-scanner */
|
||||
DeviceDef usbDev;
|
||||
struct DeviceDef usbDev;
|
||||
struct itimerval saveSettings; /* for lamp timer */
|
||||
#endif
|
||||
/*
|
||||
* each device we support may need other access functions...
|
||||
*/
|
||||
|
@ -232,16 +342,12 @@ typedef struct Plustek_Device
|
|||
int (*close) ( struct Plustek_Device* );
|
||||
void (*shutdown) ( struct Plustek_Device* );
|
||||
int (*getCaps) ( struct Plustek_Device* );
|
||||
int (*getLensInfo)( struct Plustek_Device*, pLensInfo );
|
||||
int (*getCropInfo)( struct Plustek_Device*, pCropInfo );
|
||||
int (*putImgInfo) ( struct Plustek_Device*, pImgDef );
|
||||
int (*setScanEnv) ( struct Plustek_Device*, pScanInfo );
|
||||
int (*setMap) ( struct Plustek_Device*, SANE_Word*,
|
||||
SANE_Word, SANE_Word );
|
||||
int (*startScan) ( struct Plustek_Device*, pStartScan );
|
||||
int (*startScan) ( struct Plustek_Device* );
|
||||
int (*stopScan) ( struct Plustek_Device*, int* );
|
||||
int (*readImage) ( struct Plustek_Device*, SANE_Byte*, unsigned long );
|
||||
|
||||
int (*prepare) ( struct Plustek_Device*, SANE_Byte* );
|
||||
int (*readLine) ( struct Plustek_Device* );
|
||||
|
||||
|
@ -264,7 +370,7 @@ typedef struct Plustek_Scanner
|
|||
SANE_Status exit_code; /* status of the reader process */
|
||||
int pipe; /* pipe to reader process */
|
||||
unsigned long bytes_read; /* number of bytes currently read*/
|
||||
Plustek_Device *hw; /* pointer to current device */
|
||||
pPlustek_Device hw; /* pointer to current device */
|
||||
Option_Value val[NUM_OPTIONS];
|
||||
SANE_Byte *buf; /* the image buffer */
|
||||
SANE_Bool scanning; /* TRUE during scan-process */
|
||||
|
|
|
@ -98,7 +98,6 @@
|
|||
# define _USER_MODE
|
||||
#endif
|
||||
|
||||
#include "plustek-share.h"
|
||||
#include "plustek-pp.h"
|
||||
|
||||
/*********************** the debug levels ************************************/
|
||||
|
@ -549,7 +548,7 @@ static SANE_Status do_cancel( Plustek_Scanner *scanner, SANE_Bool closepipe )
|
|||
*/
|
||||
static SANE_Status limitResolution( Plustek_Device *dev )
|
||||
{
|
||||
dev->dpi_range.min = /*lens.rDpiY.wMin; */ _DEF_DPI;
|
||||
dev->dpi_range.min = _DEF_DPI;
|
||||
if( dev->dpi_range.min < _DEF_DPI )
|
||||
dev->dpi_range.min = _DEF_DPI;
|
||||
|
||||
|
@ -1922,13 +1921,14 @@ SANE_Status sane_start( SANE_Handle handle )
|
|||
/*
|
||||
* CHECK: what about the 10 bit mode?
|
||||
*/
|
||||
#if 0
|
||||
if( COLOR_TRUE48 == scanmode )
|
||||
sinfo.ImgDef.wBits = OUTPUT_12Bits;
|
||||
else if( COLOR_TRUE32 == scanmode )
|
||||
sinfo.ImgDef.wBits = OUTPUT_10Bits;
|
||||
else
|
||||
sinfo.ImgDef.wBits = OUTPUT_8Bits;
|
||||
|
||||
#endif
|
||||
sinfo.ImgDef.dwFlag = SCANDEF_QualityScan;
|
||||
|
||||
switch( s->val[OPT_EXT_MODE].w ) {
|
||||
|
@ -1937,8 +1937,6 @@ SANE_Status sane_start( SANE_Handle handle )
|
|||
default: break;
|
||||
}
|
||||
|
||||
sinfo.ImgDef.wLens = s->hw->caps.wLens;
|
||||
|
||||
/* only for parallel-port devices */
|
||||
if( s->hw->putImgInfo ) {
|
||||
result = s->hw->putImgInfo( s->hw, &sinfo.ImgDef );
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.TH sane-plustek 5 "24 September 2003" "@PACKAGEVERSION@" "SANE Scanner Access Now Easy"
|
||||
.TH sane-plustek 5 "28 September 2003" "@PACKAGEVERSION@" "SANE Scanner Access Now Easy"
|
||||
.IX sane-plustek
|
||||
.SH NAME
|
||||
sane-plustek \- SANE backend for Plustek parallel port and
|
||||
|
@ -228,7 +228,7 @@ option cacheCalData b
|
|||
1 --> save results of coarse calibration in ~/.sane/ directory
|
||||
.RE
|
||||
.PP
|
||||
option altCalibrate b
|
||||
option altCalibration b
|
||||
.RS
|
||||
.I b
|
||||
0 --> use standard calibration routines,
|
||||
|
|
Ładowanie…
Reference in New Issue