kopia lustrzana https://gitlab.com/sane-project/backends
new version 0.47, added support for model overide when one manufacturer uses the
same model-id for various devices.merge-requests/1/head
rodzic
c3f2e4b7a6
commit
009189bd0a
|
@ -33,6 +33,9 @@
|
|||
* - removed homeing stuff from readline function
|
||||
* - fixed flag setting in usbDev_startScan()
|
||||
* - 0.46 - added additional branch to support alternate calibration
|
||||
* - 0.47 - added special handling with 0x400 vendor ID and model override
|
||||
* - removed PATH_MAX
|
||||
* - change usbDev_stopScan and usbDev_open prototype
|
||||
* .
|
||||
* <hr>
|
||||
* This file is part of the SANE package.
|
||||
|
@ -75,10 +78,6 @@
|
|||
* <hr>
|
||||
*/
|
||||
|
||||
#ifndef PATH_MAX
|
||||
# define PATH_MAX 1024
|
||||
#endif
|
||||
|
||||
/** useful for description tables
|
||||
*/
|
||||
typedef struct {
|
||||
|
@ -158,7 +157,7 @@ static void usb_initDev( pPlustek_Device dev, int idx, int handle, int vendor )
|
|||
tmp = DEVCAPSFLAG_TPA;
|
||||
}
|
||||
|
||||
/* copy the original values... */
|
||||
/* copy the original values... */
|
||||
memcpy( &dev->usbDev.Caps, Settings[idx].pDevCaps, sizeof(DCapsDef));
|
||||
memcpy( &dev->usbDev.HwSetting, Settings[idx].pHwDef, sizeof(HWDef));
|
||||
|
||||
|
@ -168,30 +167,29 @@ static void usb_initDev( pPlustek_Device dev, int idx, int handle, int vendor )
|
|||
}
|
||||
|
||||
if( dev->adj.warmup >= 0 )
|
||||
dev->usbDev.dwWarmup = dev->adj.warmup;
|
||||
dev->usbDev.dwWarmup = dev->adj.warmup;
|
||||
|
||||
if( dev->adj.lampOff >= 0 )
|
||||
dev->usbDev.dwLampOnPeriod = dev->adj.lampOff;
|
||||
dev->usbDev.dwLampOnPeriod = dev->adj.lampOff;
|
||||
|
||||
if( dev->adj.lampOffOnEnd >= 0 )
|
||||
dev->usbDev.bLampOffOnEnd = dev->adj.lampOffOnEnd;
|
||||
if( dev->adj.lampOffOnEnd >= 0 )
|
||||
dev->usbDev.bLampOffOnEnd = dev->adj.lampOffOnEnd;
|
||||
|
||||
if( dev->adj.skipCalibration > 0 )
|
||||
if( dev->adj.skipCalibration > 0 )
|
||||
dev->usbDev.Caps.workaroundFlag |= _WAF_BYPASS_CALIBRATION;
|
||||
|
||||
if( dev->adj.skipFine > 0 )
|
||||
if( dev->adj.skipFine > 0 )
|
||||
dev->usbDev.Caps.workaroundFlag |= _WAF_SKIP_FINE;
|
||||
|
||||
if( dev->adj.skipFineWhite > 0 )
|
||||
if( dev->adj.skipFineWhite > 0 )
|
||||
dev->usbDev.Caps.workaroundFlag |= _WAF_SKIP_WHITEFINE;
|
||||
|
||||
if( dev->adj.invertNegatives > 0 )
|
||||
|
||||
if( dev->adj.invertNegatives > 0 )
|
||||
dev->usbDev.Caps.workaroundFlag |= _WAF_INV_NEGATIVE_MAP;
|
||||
|
||||
DBG( _DBG_INFO, "Device WAF: 0x%08lx\n", dev->usbDev.Caps.workaroundFlag );
|
||||
|
||||
/*
|
||||
* adjust data origin
|
||||
|
||||
/* adjust data origin
|
||||
*/
|
||||
dev->usbDev.Caps.Positive.DataOrigin.x -= dev->adj.tpa.x;
|
||||
dev->usbDev.Caps.Positive.DataOrigin.y -= dev->adj.tpa.y;
|
||||
|
@ -202,9 +200,8 @@ static void usb_initDev( pPlustek_Device dev, int idx, int handle, int vendor )
|
|||
dev->usbDev.Caps.Normal.DataOrigin.x -= dev->adj.pos.x;
|
||||
dev->usbDev.Caps.Normal.DataOrigin.y -= dev->adj.pos.y;
|
||||
|
||||
/*
|
||||
* adjust shading position
|
||||
*/
|
||||
/** adjust shading position
|
||||
*/
|
||||
if( dev->adj.posShadingY >= 0 )
|
||||
dev->usbDev.Caps.Normal.ShadingOriginY = dev->adj.posShadingY;
|
||||
|
||||
|
@ -213,12 +210,11 @@ static void usb_initDev( pPlustek_Device dev, int idx, int handle, int vendor )
|
|||
|
||||
if( dev->adj.negShadingY >= 0 )
|
||||
dev->usbDev.Caps.Negative.ShadingOriginY = dev->adj.negShadingY;
|
||||
|
||||
/*
|
||||
* the following you normally get from the registry...
|
||||
|
||||
/* the following you normally get from the registry...
|
||||
*/
|
||||
bMaxITA = 0; /* Maximum integration time adjust */
|
||||
|
||||
|
||||
dev->usbDev.ModelStr = Settings[idx].pModelString;
|
||||
|
||||
dev->fd = handle;
|
||||
|
@ -442,7 +438,6 @@ static SANE_Bool usb_IsDeviceInList( char *usbIdStr )
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
static SANE_Status usb_attach( SANE_String_Const dev_name )
|
||||
{
|
||||
|
@ -484,7 +479,7 @@ static SANE_Bool usbDev_autodetect( SANE_Word *vendor, SANE_Word *product )
|
|||
|
||||
*vendor = v;
|
||||
*product = p;
|
||||
return SANE_TRUE;
|
||||
return SANE_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -492,26 +487,25 @@ static SANE_Bool usbDev_autodetect( SANE_Word *vendor, SANE_Word *product )
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
static int usbDev_open( const char *dev_name, void *misc )
|
||||
static int usbDev_open( Plustek_Device *dev )
|
||||
{
|
||||
char devStr[50];
|
||||
int result;
|
||||
int i;
|
||||
SANE_Int handle;
|
||||
SANE_Byte version;
|
||||
SANE_Word vendor, product;
|
||||
SANE_Bool was_empty;
|
||||
pPlustek_Device dev = (pPlustek_Device)misc;
|
||||
char devStr[50];
|
||||
int result;
|
||||
int i;
|
||||
int lc;
|
||||
SANE_Int handle;
|
||||
SANE_Byte version;
|
||||
SANE_Word vendor, product;
|
||||
SANE_Bool was_empty;
|
||||
|
||||
DBG( _DBG_INFO, "usbDev_open(%s,%s)\n", dev_name, dev->usbId );
|
||||
DBG( _DBG_INFO, "usbDev_open(%s,%s)\n", dev->name, dev->usbId );
|
||||
|
||||
/* preset our internal usb device structure */
|
||||
memset( &dev->usbDev, 0, sizeof(DeviceDef));
|
||||
/* preset our internal usb device structure */
|
||||
memset( &dev->usbDev, 0, sizeof(DeviceDef));
|
||||
USB_devname[0] = '\0';
|
||||
|
||||
if( !strcmp( dev_name, "auto" )) {
|
||||
if( !strcmp( dev->name, "auto" )) {
|
||||
|
||||
if( dev->usbId[0] == '\0' ) {
|
||||
|
||||
|
@ -545,7 +539,7 @@ static int usbDev_open( const char *dev_name, void *misc )
|
|||
|
||||
} else {
|
||||
|
||||
if( SANE_STATUS_GOOD != sanei_usb_open( dev_name, &handle ))
|
||||
if( SANE_STATUS_GOOD != sanei_usb_open( dev->name, &handle ))
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -590,31 +584,30 @@ static int usbDev_open( const char *dev_name, void *misc )
|
|||
vendor = strtol( &dev->usbId[0], 0, 0 );
|
||||
product = strtol( &dev->usbId[7], 0, 0 );
|
||||
DBG( _DBG_INFO, "... using the specified: "
|
||||
"0x%04x-0x%04x\n", vendor, product );
|
||||
"0x%04X-0x%04X\n", vendor, product );
|
||||
}
|
||||
|
||||
/*
|
||||
* before accessing the scanner, check if supported!
|
||||
*/
|
||||
if( !usb_IsDeviceInList( dev->usbId )) {
|
||||
DBG( _DBG_ERROR, "Device >%s<, is not supported!\n", dev->usbId );
|
||||
/* before accessing the scanner, check if supported!
|
||||
*/
|
||||
if( !usb_IsDeviceInList( dev->usbId )) {
|
||||
DBG( _DBG_ERROR, "Device >%s<, is not supported!\n", dev->usbId );
|
||||
sanei_usb_close( handle );
|
||||
return -1;
|
||||
}
|
||||
|
||||
if( SANE_STATUS_GOOD != usbio_DetectLM983x( handle, &version )) {
|
||||
if( SANE_STATUS_GOOD != usbio_DetectLM983x( handle, &version )) {
|
||||
sanei_usb_close( handle );
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((version < 3) || (version > 4)) {
|
||||
if ((version < 3) || (version > 4)) {
|
||||
DBG( _DBG_ERROR, "This is not a LM9831 or LM9832 chip based scanner.\n" );
|
||||
sanei_usb_close( handle );
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
dev->fd = handle;
|
||||
usbio_ResetLM983x ( dev );
|
||||
usbio_ResetLM983x ( dev );
|
||||
usb_IsScannerReady( dev );
|
||||
dev->fd = -1;
|
||||
|
||||
|
@ -622,7 +615,7 @@ static int usbDev_open( const char *dev_name, void *misc )
|
|||
dev->usbDev.product = product;
|
||||
|
||||
DBG( _DBG_INFO, "Detected vendor & product ID: "
|
||||
"0x%04x-0x%04x\n", vendor, product );
|
||||
"0x%04X-0x%04X\n", vendor, product );
|
||||
|
||||
/*
|
||||
* Plustek uses the misc IO 1/2 to get the PCB ID
|
||||
|
@ -639,26 +632,36 @@ static int usbDev_open( const char *dev_name, void *misc )
|
|||
if( handle >= 0 )
|
||||
return handle;
|
||||
|
||||
} else {
|
||||
} else {
|
||||
|
||||
/* now roam through the setting list... */
|
||||
strncpy( devStr, dev->usbId, 13 );
|
||||
devStr[13] = '\0';
|
||||
/* now roam through the setting list... */
|
||||
lc = 13;
|
||||
strncpy( devStr, dev->usbId, lc );
|
||||
devStr[lc] = '\0';
|
||||
|
||||
if( 0x400 == vendor ) {
|
||||
if((dev->adj.mov < 0) || (dev->adj.mov > 1)) {
|
||||
DBG( _DBG_INFO, "BearPaw MOV ot of range: %d\n", dev->adj.mov );
|
||||
dev->adj.mov = 0;
|
||||
}
|
||||
sprintf( devStr, "%s-%d", dev->usbId, dev->adj.mov );
|
||||
lc = strlen(devStr);
|
||||
DBG( _DBG_INFO, "BearPaw device: %s (%d)\n", devStr, lc );
|
||||
}
|
||||
|
||||
if( was_empty )
|
||||
dev->usbId[0] = '\0';
|
||||
|
||||
/*
|
||||
* if we don't use the PCD ID extension...
|
||||
*/
|
||||
|
||||
/* if we don't use the PCD ID extension...
|
||||
*/
|
||||
for( i = 0; NULL != Settings[i].pIDString; i++ ) {
|
||||
|
||||
if( 0 == strncmp( Settings[i].pIDString, devStr, 13 )) {
|
||||
DBG( _DBG_INFO, "Device description for >%s< found.\n", devStr );
|
||||
if( 0 == strncmp( Settings[i].pIDString, devStr, lc )) {
|
||||
DBG( _DBG_INFO, "Device description for >%s< found.\n", devStr );
|
||||
usb_initDev( dev, i, handle, vendor );
|
||||
return handle;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sanei_usb_close( handle );
|
||||
|
@ -891,9 +894,9 @@ static int usbDev_setScanEnv( Plustek_Device *dev, pScanInfo si )
|
|||
|
||||
/**
|
||||
*/
|
||||
static int usbDev_stopScan( Plustek_Device *dev, int *mode )
|
||||
static int usbDev_stopScan( Plustek_Device *dev )
|
||||
{
|
||||
DBG( _DBG_INFO, "usbDev_stopScan(mode=%u)\n", *mode );
|
||||
DBG( _DBG_INFO, "usbDev_stopScan()\n" );
|
||||
|
||||
/* in cancel-mode we first stop the motor */
|
||||
usb_ScanEnd( dev );
|
||||
|
@ -985,10 +988,11 @@ static int usbDev_Prepare( struct Plustek_Device *dev, SANE_Byte *buf )
|
|||
|
||||
} else {
|
||||
|
||||
if( dev->adj.altCalibrate )
|
||||
result = cano_DoCalibration( dev );
|
||||
else
|
||||
result = usb_DoCalibration( dev );
|
||||
if( dev->adj.altCalibrate ) {
|
||||
result = cano_DoCalibration( dev );
|
||||
} else {
|
||||
result = usb_DoCalibration( dev );
|
||||
}
|
||||
}
|
||||
|
||||
if( SANE_TRUE != result ) {
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
* - removed _WAF_FIX_GAIN and _WAF_FIX_OFS
|
||||
* - added skipCoarseCalib to ScanDef
|
||||
* - added additional defines for cis and epson-ccd sensor
|
||||
* - 0.47 - no changes
|
||||
* .
|
||||
* <hr>
|
||||
* This file is part of the SANE package.
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*
|
||||
* Based on sources acquired from Plustek Inc.<br>
|
||||
* Copyright (C) 2001-2003 Gerhard Jaeger <gerhard@gjaeger.de><br>
|
||||
* Large parts Copyright (C) 2003 Monty <monty@xiph.org>
|
||||
* Large parts Copyright (C) 2003 Christopher Montgomery <monty@xiph.org>
|
||||
*
|
||||
* Montys' comment:
|
||||
* The basic premise: The stock Plustek-usbshading.c in the plustek
|
||||
|
@ -34,6 +34,7 @@
|
|||
* - added CCD calibration capability
|
||||
* - added the usage of the swGain and swOffset values, to allow
|
||||
* tweaking the calibration results on a sensor base
|
||||
* - 0.47 - moved usb_HostSwap() to plustek_usbhw.c
|
||||
*
|
||||
* This file is part of the SANE package.
|
||||
*
|
||||
|
@ -214,7 +215,6 @@ static int cano_adjLampSetting( u_short *min,
|
|||
* where the lamp_off parameter is adjustable; I'd make it more general,
|
||||
* but I only have the CIS hardware to test.
|
||||
*/
|
||||
|
||||
static int cano_AdjustLightsource( pPlustek_Device dev)
|
||||
{
|
||||
char tmp[40];
|
||||
|
@ -231,7 +231,12 @@ static int cano_AdjustLightsource( pPlustek_Device dev)
|
|||
DBG( _DBG_INFO2, "cano_AdjustLightsource()\n" );
|
||||
|
||||
if( !(hw->bReg_0x26 & _ONE_CH_COLOR)) {
|
||||
DBG( _DBG_INFO2, "- function skipped\n" );
|
||||
DBG( _DBG_INFO2, "- function skipped, CCD device!\n" );
|
||||
|
||||
if( !usb_Wait4Warmup( dev )) {
|
||||
DBG( _DBG_ERROR, "cano_AdjustLightsource() - CANCEL detected\n" );
|
||||
return SANE_FALSE;
|
||||
}
|
||||
return SANE_TRUE;
|
||||
}
|
||||
|
||||
|
@ -862,9 +867,9 @@ static SANE_Bool cano_AdjustDarkShading( pPlustek_Device dev )
|
|||
}
|
||||
}
|
||||
|
||||
a_wDarkShading[i] = red/j + pParam->swOffset[0];
|
||||
a_wDarkShading[i+stepW] = green/j + pParam->swOffset[1];
|
||||
a_wDarkShading[i+stepW*2] = blue/j + pParam->swOffset[2];
|
||||
a_wDarkShading[i] = red/m_ScanParam.Size.dwPhyLines + pParam->swOffset[0];
|
||||
a_wDarkShading[i+stepW] = green/m_ScanParam.Size.dwPhyLines + pParam->swOffset[1];
|
||||
a_wDarkShading[i+stepW*2] = blue/m_ScanParam.Size.dwPhyLines + pParam->swOffset[2];
|
||||
}
|
||||
|
||||
if(usb_HostSwap())
|
||||
|
@ -987,9 +992,9 @@ static SANE_Bool cano_AdjustWhiteShading( pPlustek_Device dev )
|
|||
}
|
||||
|
||||
/* tweaked by the settings in swGain --> 1000/swGain[r,g,b] */
|
||||
red = (65535.*1000./pParam->swGain[0]) * 16384.*j/red;
|
||||
green = (65535.*1000./pParam->swGain[1]) * 16384.*j/green;
|
||||
blue = (65535.*1000./pParam->swGain[2]) * 16384.*j/blue;
|
||||
red = (65535.*1000./pParam->swGain[0]) * 16384.*m_ScanParam.Size.dwPhyLines/red;
|
||||
green = (65535.*1000./pParam->swGain[1]) * 16384.*m_ScanParam.Size.dwPhyLines/green;
|
||||
blue = (65535.*1000./pParam->swGain[2]) * 16384.*m_ScanParam.Size.dwPhyLines/blue;
|
||||
|
||||
a_wWhiteShading[i] = (red > 65535? 65535:red );
|
||||
a_wWhiteShading[i+stepW] = (green > 65535? 65535:green);
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
/** @file plustek-usbcalfile.c
|
||||
* @brief Functions for saving/restoring calibration settings
|
||||
*
|
||||
* Based on sources acquired from Plustek Inc.<br>
|
||||
* Copyright (C) 2001-2003 Gerhard Jaeger <gerhard@gjaeger.de>
|
||||
*
|
||||
* History:
|
||||
* - 0.46 - first version
|
||||
* - 0.47 - no changes
|
||||
* .
|
||||
* <hr>
|
||||
* This file is part of the SANE package.
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
* History:
|
||||
* - 0.40 - starting version of the USB support
|
||||
* - 0.41 - added EPSON1250 entries
|
||||
* - changed reg 0x58 of EPSON Hw0x04B8_0x010F_0 to 0x0d
|
||||
* - changed reg 0x58 of EPSON Hw0x04B8_0x010F to 0x0d
|
||||
* - reduced memory size of EPSON to 512
|
||||
* - adjusted tpa origin of UT24
|
||||
* - 0.42 - added register 0x27, 0x2c-0x37
|
||||
|
@ -38,9 +38,12 @@
|
|||
* - removed EPSON 660 stuff
|
||||
* - added Canon 1220U entry
|
||||
* - added entry for Compaq S4-100
|
||||
* -0.46 - fine-tuning for the CanoScan devices
|
||||
* - 0.46 - fine-tuning for the CanoScan devices
|
||||
* - fixed HP2200 shading position
|
||||
* - renamed to plustek-usbdevs.c
|
||||
* - 0.47 - added BearPaw 1200 settings for PID 0x4001 (LM9832)
|
||||
* - tweaked the LiDE20 MCLK setting for 75DPI grayscale
|
||||
* - enlarged the scan-area of the UMAX3400 to 11.7"
|
||||
* .
|
||||
* <hr>
|
||||
* This file is part of the SANE package.
|
||||
|
@ -542,7 +545,7 @@ static DCapsDef Cap0x0400_0x1001_0 =
|
|||
* Epson Perfection/Photo1260 (thanks to Till Kamppeter)
|
||||
* NS9832 + 4 Buttons + CCD????
|
||||
*/
|
||||
static DCapsDef Cap0x04B8_0x010F_0 =
|
||||
static DCapsDef Cap0x04B8_0x010F =
|
||||
{
|
||||
/* Normal */
|
||||
{{ 25, 85}, 10, -1, {2550, 3508}, { 100, 100 }, COLOR_BW },
|
||||
|
@ -564,14 +567,9 @@ static DCapsDef Cap0x04B8_0x010F_0 =
|
|||
|
||||
/* Umax 3400/3450
|
||||
*/
|
||||
static DCapsDef Cap0x1606_0x0060_0 =
|
||||
static DCapsDef Cap0x1606_0x0060 =
|
||||
{
|
||||
/* the ini file provided by umax says the scanner bed is 11.7", but
|
||||
setting the value below to 3510 (11.7 * 300) results in the head
|
||||
hitting the end at the end of the scan. so i'm just guessing that
|
||||
the scanner bed area in the .ini file includes the dead area at
|
||||
the beginning, and the number below does not. */
|
||||
{{ 0, 105}, 0, -1, {2550, 3510 - 105}, {100, 100}, COLOR_BW },
|
||||
{{ 0, 105}, 0, -1, {2550, 3508}, {100, 100}, COLOR_BW },
|
||||
{{ 0, 0}, 0, -1, {0, 0}, { 0, 0 }, 0 },
|
||||
{{ 0, 0}, 0, -1, {0, 0}, { 0, 0 }, 0 },
|
||||
{{ 0, 0}, 0, -1, {0, 0}, { 0, 0 }, 0 },
|
||||
|
@ -588,7 +586,7 @@ static DCapsDef Cap0x1606_0x0060_0 =
|
|||
|
||||
/* Umax 5400
|
||||
*/
|
||||
static DCapsDef Cap0x1606_0x0160_0 =
|
||||
static DCapsDef Cap0x1606_0x0160 =
|
||||
{
|
||||
{{ 30, 165}, 0, -1, {2550, 3508}, {100, 100}, COLOR_BW },
|
||||
{{ 0, 0}, 0, -1, {0, 0}, { 0, 0 }, 0 },
|
||||
|
@ -607,7 +605,7 @@ static DCapsDef Cap0x1606_0x0160_0 =
|
|||
|
||||
/* Canon N650U/N656U
|
||||
*/
|
||||
static DCapsDef Cap0x04A9_0x2206_0 =
|
||||
static DCapsDef Cap0x04A9_0x2206 =
|
||||
{
|
||||
{{ 0, 90}, 35, 10, {2550, 3508}, {75, 75}, COLOR_GRAY16 },
|
||||
{{ 0, 0}, 0, 0, {0, 0}, { 0, 0 }, 0 },
|
||||
|
@ -625,7 +623,7 @@ static DCapsDef Cap0x04A9_0x2206_0 =
|
|||
|
||||
/* Canon N1220U
|
||||
*/
|
||||
static DCapsDef Cap0x04A9_0x2207_0 =
|
||||
static DCapsDef Cap0x04A9_0x2207 =
|
||||
{
|
||||
{{ 0, 85}, 35, 10, {2550, 3508}, {75, 75}, COLOR_BW },
|
||||
{{ 0, 0}, 0, 0, {0, 0}, { 0, 0 }, 0 },
|
||||
|
@ -643,7 +641,7 @@ static DCapsDef Cap0x04A9_0x2207_0 =
|
|||
|
||||
/* Canon N670U/N676U/LiDE20
|
||||
*/
|
||||
static DCapsDef Cap0x04A9_0x220D_0 =
|
||||
static DCapsDef Cap0x04A9_0x220D =
|
||||
{
|
||||
{{ 0, 110}, 35, 10, {2550, 3508}, {75, 75}, COLOR_GRAY16 },
|
||||
{{ 0, 0}, 0, 0, {0, 0}, { 0, 0 }, 0 },
|
||||
|
@ -661,7 +659,7 @@ static DCapsDef Cap0x04A9_0x220D_0 =
|
|||
|
||||
/* Canon N1240U
|
||||
*/
|
||||
static DCapsDef Cap0x04A9_0x220E_0 =
|
||||
static DCapsDef Cap0x04A9_0x220E =
|
||||
{
|
||||
{{ 0, 100}, 50, 10, {2550, 3508}, {75, 75}, COLOR_BW },
|
||||
{{ 0, 0}, 0, 0, {0, 0}, { 0, 0 }, 0 },
|
||||
|
@ -1506,6 +1504,63 @@ static HWDef Hw0x0400_0x1000_0 =
|
|||
MODEL_MUSTEK600
|
||||
};
|
||||
|
||||
/** Mustek BearPaw 1200 (LM9832) */
|
||||
static HWDef Hw0x0400_0x1001_1 =
|
||||
{
|
||||
1.25, /* ok dMaxMotorSpeed (Max_Speed) */
|
||||
1.25, /* ok dMaxMoveSpeed (Max_Speed) */
|
||||
12, /* ok dIntegrationTimeLowLamp */
|
||||
12, /* ok dIntegrationTimeHighLamp */
|
||||
600, /* ok wMotorDpi (Full step DPI) */
|
||||
512, /* ok wRAMSize (KB) */
|
||||
9, /* ok dMinIntegrationTimeLowres (ms) */
|
||||
9, /* ok dMinIntegrationTimeHighres (ms) */
|
||||
1169, /* ok wGreenPWMDutyCycleLow (reg 0x2a + 0x2b) */
|
||||
1169, /* ok wGreenPWMDutyCycleHigh (reg 0x2a + 0x2b) */
|
||||
0x02, /* ok bSensorConfiguration (0x0b) */
|
||||
0x7c, /* ok sensor control settings (reg 0x0c) */
|
||||
0x3f, /* ok sensor control settings (reg 0x0d) */
|
||||
0x15, /* ok sensor control settings (reg 0x0e) */
|
||||
/* ok mono (reg 0x0f to 0x18) */
|
||||
{ 0x04, 0x07, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x03, 0x06},
|
||||
/* ok color (reg 0x0f to 0x18) */
|
||||
{ 0x04, 0x16, 0x01, 0x02, 0x05, 0x06, 0x00, 0x00, 0x0a, 0x16},
|
||||
_GREEN_CH, /* bReg_0x26 color mode - bits 4 and 5 */
|
||||
0, /* bReg 0x27 color mode */
|
||||
1, /* bReg 0x29 illumination mode */
|
||||
/* illumination mode settings (not used for CCD devices)*/
|
||||
{ 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0, 0, 0, 0 },
|
||||
257, /* ok StepperPhaseCorrection (reg 0x1a + 0x1b) */
|
||||
0x0e, /* ok bOpticBlackStart (reg 0x1c) */
|
||||
0x1d, /* ok bOpticBlackEnd (reg 0x1d) */
|
||||
140, /* ok wActivePixelsStart (reg 0x1e + 0x1f) */
|
||||
5369, /* ok wLineEnd (reg 0x20 + 0x21) */
|
||||
0, /* red lamp on (reg 0x2c + 0x2d) */
|
||||
16383, /* red lamp off (reg 0x2e + 0x2f) */
|
||||
0, /* green lamp on (reg 0x30 + 0x31) */
|
||||
0, /* green lamp off (reg 0x32 + 0x33) */
|
||||
0, /* blue lamp on (reg 0x34 + 0x35) */
|
||||
16383, /* blue lamp off (reg 0x36 + 0x37) */
|
||||
0x13, /* ok stepper motor control (reg 0x45) */
|
||||
0, /* wStepsAfterPaperSensor2 (reg 0x4c + 0x4d) */
|
||||
0x1e, /* steps to reverse on buffer full (reg 0x50) */
|
||||
0xfc, /* ok acceleration profile (reg 0x51) */
|
||||
0, /* ok lines to process (reg 0x54) */
|
||||
0x13, /* ok kickstart (reg 0x55) */
|
||||
0x03, /* ok pwm freq (reg 0x56) */
|
||||
0x20, /* ok pwm duty cycle (reg 0x57) */
|
||||
0x0d, /* ok Paper sense (reg 0x58) */
|
||||
0x44, /* ok misc io12 (reg 0x59) */
|
||||
0x44, /* ok misc io34 (reg 0x5a) */
|
||||
0x4f, /* ok misc io56 (reg 0x5b) */
|
||||
0, /* ok test mode ADC Output CODE MSB (reg 0x5c) */
|
||||
0, /* ok test mode ADC Output CODE LSB (reg 0x5d) */
|
||||
0, /* ok test mode (reg 0x5e) */
|
||||
_LM9832,
|
||||
MODEL_MUSTEK600
|
||||
};
|
||||
|
||||
/** BearPaw 2400 */
|
||||
static HWDef Hw0x0400_0x1001_0 =
|
||||
{
|
||||
|
@ -1569,7 +1624,7 @@ static HWDef Hw0x0400_0x1001_0 =
|
|||
};
|
||||
|
||||
/** EPSON Perfection/Photo 1250 */
|
||||
static HWDef Hw0x04B8_0x010F_0 =
|
||||
static HWDef Hw0x04B8_0x010F =
|
||||
{
|
||||
0.9, /* dMaxMotorSpeed (Max_Speed) */
|
||||
0.8, /* dMaxMoveSpeed (Max_Speed) */
|
||||
|
@ -1633,7 +1688,7 @@ static HWDef Hw0x04B8_0x010F_0 =
|
|||
};
|
||||
|
||||
/** EPSON Perfection/Photo 1260 */
|
||||
static HWDef Hw0x04B8_0x011D_0 =
|
||||
static HWDef Hw0x04B8_0x011D =
|
||||
{
|
||||
0.9, /* dMaxMotorSpeed (Max_Speed) */
|
||||
0.8, /* dMaxMoveSpeed (Max_Speed) */
|
||||
|
@ -1697,7 +1752,7 @@ static HWDef Hw0x04B8_0x011D_0 =
|
|||
};
|
||||
|
||||
/** Umax 3400/3450 */
|
||||
static HWDef Hw0x1606_0x0060_0 =
|
||||
static HWDef Hw0x1606_0x0060 =
|
||||
{
|
||||
1.5, /* dMaxMotorSpeed (Max_Speed) */
|
||||
0.8, /* dMaxMoveSpeed (Max_Speed) */
|
||||
|
@ -1762,7 +1817,7 @@ static HWDef Hw0x1606_0x0060_0 =
|
|||
};
|
||||
|
||||
/** Umax 5400 */
|
||||
static HWDef Hw0x1606_0x0160_0 =
|
||||
static HWDef Hw0x1606_0x0160 =
|
||||
{
|
||||
1.1, /* dMaxMotorSpeed (Max_Speed) */
|
||||
0.9, /* dMaxMoveSpeed (Max_Speed) */
|
||||
|
@ -1827,7 +1882,7 @@ static HWDef Hw0x1606_0x0160_0 =
|
|||
};
|
||||
|
||||
/** Canon 650/656 */
|
||||
static HWDef Hw0x04A9_0x2206_0 =
|
||||
static HWDef Hw0x04A9_0x2206 =
|
||||
{
|
||||
0.86, /* dMaxMotorSpeed (Max_Speed) */
|
||||
0.243, /* dMaxMoveSpeed (Max_Speed) */
|
||||
|
@ -1894,7 +1949,7 @@ static HWDef Hw0x04A9_0x2206_0 =
|
|||
};
|
||||
|
||||
/** Canon N1220U */
|
||||
static HWDef Hw0x04A9_0x2207_0 =
|
||||
static HWDef Hw0x04A9_0x2207 =
|
||||
{
|
||||
0.72, /* dMaxMotorSpeed (Max_Speed) */
|
||||
0.36, /* dMaxMoveSpeed (Max_Speed) */
|
||||
|
@ -1960,7 +2015,7 @@ static HWDef Hw0x04A9_0x2207_0 =
|
|||
};
|
||||
|
||||
/** Canon 670/676/LiDE20 */
|
||||
static HWDef Hw0x04A9_0x220D_0 =
|
||||
static HWDef Hw0x04A9_0x220D =
|
||||
{
|
||||
0.86, /* dMaxMotorSpeed (Max_Speed) */
|
||||
0.243, /* dMaxMoveSpeed (Max_Speed) */
|
||||
|
@ -2027,7 +2082,7 @@ static HWDef Hw0x04A9_0x220D_0 =
|
|||
};
|
||||
|
||||
/** Canon N1240U */
|
||||
static HWDef Hw0x04A9_0x220E_0 =
|
||||
static HWDef Hw0x04A9_0x220E =
|
||||
{
|
||||
0.72, /* dMaxMotorSpeed (Max_Speed) */
|
||||
0.36, /* dMaxMoveSpeed (Max_Speed) */
|
||||
|
@ -2120,46 +2175,47 @@ static SetDef Settings[] =
|
|||
{"0x07B3-0x0016-4", &Cap0x07B3_0x0016_4, &Hw0x07B3_0x0016_4, "Unknown device" },
|
||||
{"0x07B3-0x0017-2", &Cap0x07B3_0x0017_2, &Hw0x07B3_0x0017_2, "Unknown device" },
|
||||
{"0x07B3-0x0017-3", &Cap0x07B3_0x0017_3, &Hw0x07B3_0x0017_3, "Unknown device" },
|
||||
{"0x07B3-0x0007", &Cap0x07B3_0x0007_0, &Hw0x07B3_0x0007_0, "Unknown device" },
|
||||
{"0x07B3-0x000F", &Cap0x07B3_0x000F_0, &Hw0x07B3_0x000F_0, "Unknown device" },
|
||||
{"0x07B3-0x000F-4", &Cap0x07B3_0x000F_4, &Hw0x07B3_0x000F_4, "Unknown device" },
|
||||
{"0x07B3-0x0005-2", &Cap0x07B3_0x0005_2, &Hw0x07B3_0x0007_2, "Unknown device" }, /* TOKYO 600 */
|
||||
{"0x07B3-0x0014-1", &Cap0x07B3_0x0014_1, &Hw0x07B3_0x0017_1, "Unknown device" }, /* A3 */
|
||||
{"0x07B3-0x0012-0", &Cap0x07B3_0x0012_0, &Hw0x07B3_0x0012_0, "Unknown device" }, /* Brother Demo */
|
||||
|
||||
{"0x07B3-0x0007", &Cap0x07B3_0x0007_0, &Hw0x07B3_0x0007_0, "Unknown device" },
|
||||
{"0x07B3-0x000F", &Cap0x07B3_0x000F_0, &Hw0x07B3_0x000F_0, "Unknown device" },
|
||||
{"0x07B3-0x000F-4", &Cap0x07B3_0x000F_4, &Hw0x07B3_0x000F_4, "Unknown device" },
|
||||
{"0x07B3-0x0005-2", &Cap0x07B3_0x0005_2, &Hw0x07B3_0x0007_2, "Unknown device" }, /* TOKYO 600 */
|
||||
{"0x07B3-0x0014-1", &Cap0x07B3_0x0014_1, &Hw0x07B3_0x0017_1, "Unknown device" }, /* A3 */
|
||||
{"0x07B3-0x0012-0", &Cap0x07B3_0x0012_0, &Hw0x07B3_0x0012_0, "Unknown device" }, /* Brother Demo */
|
||||
|
||||
/* Mustek BearPaw...*/
|
||||
{"0x0400-0x1000", &Cap0x0400_0x1000_0, &Hw0x0400_0x1000_0, "BearPaw 1200" },
|
||||
{"0x0400-0x1001", &Cap0x0400_0x1001_0, &Hw0x0400_0x1001_0, "BearPaw 2400" },
|
||||
{"0x0400-0x1000-0", &Cap0x0400_0x1000_0, &Hw0x0400_0x1000_0, "BearPaw 1200" },
|
||||
{"0x0400-0x1001-1", &Cap0x0400_0x1000_0, &Hw0x0400_0x1001_1, "BearPaw 1200" },
|
||||
{"0x0400-0x1001-0", &Cap0x0400_0x1001_0, &Hw0x0400_0x1001_0, "BearPaw 2400" },
|
||||
|
||||
/* Genius devices... */
|
||||
{"0x0458-0x2007", &Cap0x07B3_0x0007_0, &Hw0x07B3_0x0007_0, "ColorPage-HR6 V2" },
|
||||
{"0x0458-0x2008", &Cap0x07B3_0x0007_0, &Hw0x07B3_0x0007_0, "ColorPage-HR6 V2" },
|
||||
{"0x0458-0x2009", &Cap0x07B3_0x000F_0, &Hw0x07B3_0x000F_0, "ColorPage-HR6A" },
|
||||
{"0x0458-0x2013", &Cap0x07B3_0x0007_4, &Hw0x07B3_0x0007_4, "ColorPage-HR7" },
|
||||
{"0x0458-0x2015", &Cap0x07B3_0x0005_4, &Hw0x07B3_0x0007_4, "ColorPage-HR7LE" },
|
||||
{"0x0458-0x2016", &Cap0x07B3_0x0005_4, &Hw0x07B3_0x0007_0, "ColorPage-HR6X" },
|
||||
{"0x0458-0x2007", &Cap0x07B3_0x0007_0, &Hw0x07B3_0x0007_0, "ColorPage-HR6 V2" },
|
||||
{"0x0458-0x2008", &Cap0x07B3_0x0007_0, &Hw0x07B3_0x0007_0, "ColorPage-HR6 V2" },
|
||||
{"0x0458-0x2009", &Cap0x07B3_0x000F_0, &Hw0x07B3_0x000F_0, "ColorPage-HR6A" },
|
||||
{"0x0458-0x2013", &Cap0x07B3_0x0007_4, &Hw0x07B3_0x0007_4, "ColorPage-HR7" },
|
||||
{"0x0458-0x2015", &Cap0x07B3_0x0005_4, &Hw0x07B3_0x0007_4, "ColorPage-HR7LE" },
|
||||
{"0x0458-0x2016", &Cap0x07B3_0x0005_4, &Hw0x07B3_0x0007_0, "ColorPage-HR6X" },
|
||||
|
||||
/* Hewlett Packard... */
|
||||
{"0x03F0-0x0505", &Cap0x03F0_0x0505, &Hw0x03F0_0x0505, "Scanjet 2100c" },
|
||||
{"0x03F0-0x0605", &Cap0x03F0_0x0605, &Hw0x03F0_0x0605, "Scanjet 2200c" },
|
||||
{"0x03F0-0x0505", &Cap0x03F0_0x0505, &Hw0x03F0_0x0505, "Scanjet 2100c" },
|
||||
{"0x03F0-0x0605", &Cap0x03F0_0x0605, &Hw0x03F0_0x0605, "Scanjet 2200c" },
|
||||
|
||||
/* EPSON... */
|
||||
{"0x04B8-0x010F", &Cap0x04B8_0x010F_0, &Hw0x04B8_0x010F_0, "Perfection 1250/Photo" },
|
||||
{"0x04B8-0x011D", &Cap0x04B8_0x010F_0, &Hw0x04B8_0x011D_0, "Perfection 1260/Photo" },
|
||||
{"0x04B8-0x010F", &Cap0x04B8_0x010F, &Hw0x04B8_0x010F, "Perfection 1250/Photo" },
|
||||
{"0x04B8-0x011D", &Cap0x04B8_0x010F, &Hw0x04B8_0x011D, "Perfection 1260/Photo" },
|
||||
|
||||
/* UMAX... */
|
||||
{"0x1606-0x0060", &Cap0x1606_0x0060_0, &Hw0x1606_0x0060_0, "3400/3450" },
|
||||
{"0x1606-0x0160", &Cap0x1606_0x0160_0, &Hw0x1606_0x0160_0, "5400" },
|
||||
{"0x1606-0x0060", &Cap0x1606_0x0060, &Hw0x1606_0x0060, "3400/3450" },
|
||||
{"0x1606-0x0160", &Cap0x1606_0x0160, &Hw0x1606_0x0160, "5400" },
|
||||
|
||||
/* COMPAQ... */
|
||||
{"0x049F-0x001A", &Cap0x1606_0x0060_0, &Hw0x1606_0x0060_0, "S4-100" },
|
||||
{"0x049F-0x001A", &Cap0x1606_0x0060, &Hw0x1606_0x0060, "S4-100" },
|
||||
|
||||
/* CANON... */
|
||||
{"0x04A9-0x2206", &Cap0x04A9_0x2206_0, &Hw0x04A9_0x2206_0, "N650U/N656U" },
|
||||
{"0x04A9-0x2207", &Cap0x04A9_0x2207_0, &Hw0x04A9_0x2207_0, "N1220U" },
|
||||
{"0x04A9-0x220D", &Cap0x04A9_0x220D_0, &Hw0x04A9_0x220D_0, "N670U/N676U/LiDE20" },
|
||||
{"0x04A9-0x220E", &Cap0x04A9_0x220E_0, &Hw0x04A9_0x220E_0, "N1240U/LiDE30" },
|
||||
|
||||
{"0x04A9-0x2206", &Cap0x04A9_0x2206, &Hw0x04A9_0x2206, "N650U/N656U" },
|
||||
{"0x04A9-0x2207", &Cap0x04A9_0x2207, &Hw0x04A9_0x2207, "N1220U" },
|
||||
{"0x04A9-0x220D", &Cap0x04A9_0x220D, &Hw0x04A9_0x220D, "N670U/N676U/LiDE20" },
|
||||
{"0x04A9-0x220E", &Cap0x04A9_0x220E, &Hw0x04A9_0x220E, "N1240U/LiDE30" },
|
||||
|
||||
/* Please add other devices here...
|
||||
* The first entry is a string, composed out of the vendor and product id,
|
||||
* it's used by the driver to select the device settings. For other devices
|
||||
|
@ -2178,7 +2234,7 @@ static SetDef Settings[] =
|
|||
* The fourth entry is simply the name of the device, which will be
|
||||
* displayed by the frontend
|
||||
*/
|
||||
{ NULL, NULL, NULL, NULL } /* last entry, never remove... */
|
||||
{ NULL, NULL, NULL, NULL } /* last entry, never remove... */
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -2284,8 +2340,8 @@ static ClkMotorDef Motors[] = {
|
|||
{ 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0 },
|
||||
|
||||
/* Gray mode MCLK settings */
|
||||
{ 12.0, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0 },
|
||||
{ 12.0, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0 }
|
||||
{ 12.5, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0 },
|
||||
{ 12.5, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0 }
|
||||
},
|
||||
|
||||
{ MODEL_CANON1200, 8, 51, 3,
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
* - 0.46 - fixed problem in usb_GetLampStatus for CIS devices, as we
|
||||
* read back reg[0x29] to wrong position
|
||||
* made it compile without itimer definitions
|
||||
* moved usb_HostSwap() to this file.
|
||||
* - 0.47 - moved usb_HostSwap() and usb_Swap() to this file.
|
||||
* .
|
||||
* <hr>
|
||||
* This file is part of the SANE package.
|
||||
|
@ -104,11 +104,18 @@ static SANE_Bool usb_HostSwap( void )
|
|||
DBG( _DBG_READ, "We're big-endian! No need to swap!\n" );
|
||||
return 0;
|
||||
}
|
||||
DBG( _DBG_READ, "We're little-endian! NatSemi LM983x is big!"
|
||||
"Must swap calibration data!\n" );
|
||||
DBG( _DBG_READ, "We're little-endian! NatSemi LM983x is big!\n" );
|
||||
DBG( _DBG_READ, "--> Must swap calibration data!\n" );
|
||||
return 1;
|
||||
}
|
||||
|
||||
/** as the name says..
|
||||
*/
|
||||
static void usb_Swap( u_short *pw, u_long dwBytes )
|
||||
{
|
||||
for( dwBytes /= 2; dwBytes--; pw++ )
|
||||
_SWAP(((u_char*) pw)[0], ((u_char*)pw)[1]);
|
||||
}
|
||||
|
||||
/** usb_GetMotorSet
|
||||
* according to the model, the function returns the address of
|
||||
|
|
|
@ -22,7 +22,8 @@
|
|||
* - fixed a bug in usb_GrayScalePseudo16 function
|
||||
* - fixed a bug in usb_GrayDuplicatePseudo16 function
|
||||
* - removed the scaler stuff for CIS devices
|
||||
* - 0.46 - no changes
|
||||
* - 0.46 - minor fixes
|
||||
* - 0.47 - added big-endian/little endian stuff
|
||||
* .
|
||||
* <hr>
|
||||
* This file is part of the SANE package.
|
||||
|
@ -204,8 +205,7 @@ static void usb_ReverseBitStream( u_char *pSrc, u_char *pTar, int iPixels,
|
|||
*pTar = bPad;
|
||||
}
|
||||
|
||||
/*.............................................................................
|
||||
*
|
||||
/**
|
||||
*/
|
||||
static void usb_AverageColorByte( struct Plustek_Device *dev )
|
||||
{
|
||||
|
@ -233,45 +233,47 @@ static void usb_AverageColorByte( struct Plustek_Device *dev )
|
|||
}
|
||||
}
|
||||
|
||||
/*.............................................................................
|
||||
*
|
||||
/**
|
||||
*/
|
||||
static void usb_AverageColorWord( struct Plustek_Device *dev )
|
||||
{
|
||||
u_char ls = 2;
|
||||
u_long dw;
|
||||
pScanDef scanning = &dev->scanning;
|
||||
pScanDef scan = &dev->scanning;
|
||||
|
||||
if((scanning->sParam.bSource == SOURCE_Negative ||
|
||||
scanning->sParam.bSource == SOURCE_Transparency) &&
|
||||
scanning->sParam.PhyDpi.x > 800)
|
||||
{
|
||||
scanning->Red.pcw[0].Colors[0] = _HILO2WORD (scanning->Red.pcw[0].HiLo[0]) >> 2;
|
||||
scanning->Green.pcw[0].Colors[0] = _HILO2WORD (scanning->Green.pcw[0].HiLo[0]) >> 2;
|
||||
scanning->Blue.pcw[0].Colors[0] = _HILO2WORD (scanning->Blue.pcw[0].HiLo[0]) >> 2;
|
||||
if((scan->sParam.bSource == SOURCE_Negative ||
|
||||
scan->sParam.bSource == SOURCE_Transparency) &&
|
||||
scan->sParam.PhyDpi.x > 800) {
|
||||
|
||||
scan->Red.pcw[0].Colors[0] = _HILO2WORD(scan->Red.pcw[0].HiLo[0]) >> ls;
|
||||
scan->Green.pcw[0].Colors[0] = _HILO2WORD(scan->Green.pcw[0].HiLo[0]) >> ls;
|
||||
scan->Blue.pcw[0].Colors[0] = _HILO2WORD(scan->Blue.pcw[0].HiLo[0]) >> ls;
|
||||
|
||||
for (dw = 0; dw < (scanning->sParam.Size.dwPhyPixels - 1); dw++)
|
||||
for (dw = 0; dw < (scan->sParam.Size.dwPhyPixels - 1); dw++)
|
||||
{
|
||||
scanning->Red.pcw[dw + 1].Colors[0] = _HILO2WORD (scanning->Red.pcw[dw + 1].HiLo[0]) >> 2;
|
||||
scanning->Green.pcw[dw + 1].Colors[0] = _HILO2WORD (scanning->Green.pcw[dw + 1].HiLo[0]) >> 2;
|
||||
scanning->Blue.pcw[dw + 1].Colors[0] = _HILO2WORD (scanning->Blue.pcw[dw + 1].HiLo[0]) >> 2;
|
||||
scan->Red.pcw[dw + 1].Colors[0] = _HILO2WORD(scan->Red.pcw[dw + 1].HiLo[0]) >> ls;
|
||||
scan->Green.pcw[dw + 1].Colors[0] = _HILO2WORD(scan->Green.pcw[dw + 1].HiLo[0]) >> ls;
|
||||
scan->Blue.pcw[dw + 1].Colors[0] = _HILO2WORD(scan->Blue.pcw[dw + 1].HiLo[0]) >> ls;
|
||||
|
||||
scanning->Red.pcw[dw].Colors[0] = (u_short)(((u_long)scanning->Red.pcw[dw].Colors[0] + (u_long)scanning->Red.pcw[dw + 1].Colors[0]) / 2);
|
||||
scanning->Green.pcw[dw].Colors[0] = (u_short)(((u_long)scanning->Green.pcw[dw].Colors[0] + (u_long)scanning->Green.pcw[dw + 1].Colors[0]) / 2);
|
||||
scanning->Blue.pcw[dw].Colors[0] = (u_short)(((u_long)scanning->Blue.pcw[dw].Colors[0] + (u_long)scanning->Blue.pcw[dw + 1].Colors[0]) / 2);
|
||||
scan->Red.pcw[dw].Colors[0] = (u_short)(((u_long)scan->Red.pcw[dw].Colors[0] +
|
||||
(u_long)scan->Red.pcw[dw + 1].Colors[0]) / 2);
|
||||
scan->Green.pcw[dw].Colors[0] = (u_short)(((u_long)scan->Green.pcw[dw].Colors[0] +
|
||||
(u_long)scan->Green.pcw[dw + 1].Colors[0]) / 2);
|
||||
scan->Blue.pcw[dw].Colors[0] = (u_short)(((u_long)scan->Blue.pcw[dw].Colors[0] +
|
||||
(u_long)scan->Blue.pcw[dw + 1].Colors[0]) / 2);
|
||||
|
||||
scanning->Red.pcw[dw].Colors[0] = _HILO2WORD (scanning->Red.pcw[dw].HiLo[0]) << 2;
|
||||
scanning->Green.pcw[dw].Colors[0] = _HILO2WORD (scanning->Green.pcw[dw].HiLo[0]) << 2;
|
||||
scanning->Blue.pcw[dw].Colors[0] = _HILO2WORD (scanning->Blue.pcw[dw].HiLo[0]) << 2;
|
||||
scan->Red.pcw[dw].Colors[0] = _HILO2WORD(scan->Red.pcw[dw].HiLo[0]) << ls;
|
||||
scan->Green.pcw[dw].Colors[0] = _HILO2WORD(scan->Green.pcw[dw].HiLo[0]) << ls;
|
||||
scan->Blue.pcw[dw].Colors[0] = _HILO2WORD(scan->Blue.pcw[dw].HiLo[0]) << ls;
|
||||
}
|
||||
|
||||
scanning->Red.pcw[dw].Colors[0] = _HILO2WORD (scanning->Red.pcw[dw].HiLo[0]) << 2;
|
||||
scanning->Green.pcw[dw].Colors[0] = _HILO2WORD (scanning->Green.pcw[dw].HiLo[0]) << 2;
|
||||
scanning->Blue.pcw[dw].Colors[0] = _HILO2WORD (scanning->Blue.pcw[dw].HiLo[0]) << 2;
|
||||
scan->Red.pcw[dw].Colors[0] = _HILO2WORD(scan->Red.pcw[dw].HiLo[0]) << ls;
|
||||
scan->Green.pcw[dw].Colors[0] = _HILO2WORD(scan->Green.pcw[dw].HiLo[0]) << ls;
|
||||
scan->Blue.pcw[dw].Colors[0] = _HILO2WORD(scan->Blue.pcw[dw].HiLo[0]) << ls;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
static void usb_AverageGrayByte( struct Plustek_Device *dev )
|
||||
{
|
||||
|
@ -289,8 +291,7 @@ static void usb_AverageGrayByte( struct Plustek_Device *dev )
|
|||
|
||||
}
|
||||
|
||||
/*.............................................................................
|
||||
*
|
||||
/**
|
||||
*/
|
||||
static void usb_AverageGrayWord( struct Plustek_Device *dev )
|
||||
{
|
||||
|
@ -328,7 +329,7 @@ static int usb_GetScaler( pScanDef scanning )
|
|||
ratio = (double)scanning->sParam.UserDpi.x/
|
||||
(double)scanning->sParam.PhyDpi.x;
|
||||
|
||||
return (int)(1.0/ratio * _SCALER);
|
||||
return (int)(1.0/ratio * _SCALER);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -576,9 +577,11 @@ static void usb_ColorScale8_2( struct Plustek_Device *dev )
|
|||
*/
|
||||
static void usb_ColorScale16( struct Plustek_Device *dev )
|
||||
{
|
||||
int izoom, ddax;
|
||||
u_long dw;
|
||||
pScanDef scanning = &dev->scanning;
|
||||
u_char ls;
|
||||
int izoom, ddax;
|
||||
u_long dw;
|
||||
SANE_Bool swap = usb_HostSwap();
|
||||
pScanDef scanning = &dev->scanning;
|
||||
|
||||
usb_AverageColorWord( dev );
|
||||
|
||||
|
@ -592,54 +595,47 @@ static void usb_ColorScale16( struct Plustek_Device *dev )
|
|||
dwPixels = 0;
|
||||
}
|
||||
|
||||
izoom = usb_GetScaler( scanning );
|
||||
izoom = usb_GetScaler( scanning );
|
||||
|
||||
if( scanning->dwFlag & SCANFLAG_RightAlign ) {
|
||||
if( scanning->dwFlag & SCANFLAG_RightAlign )
|
||||
ls = Shift;
|
||||
else
|
||||
ls = 0;
|
||||
|
||||
for( dwBitsPut = 0, ddax = 0; dw; dwBitsPut++ ) {
|
||||
for( dwBitsPut = 0, ddax = 0; dw; dwBitsPut++ ) {
|
||||
|
||||
ddax -= _SCALER;
|
||||
ddax -= _SCALER;
|
||||
|
||||
while((ddax < 0) && (dw > 0)) {
|
||||
while((ddax < 0) && (dw > 0)) {
|
||||
|
||||
if( swap ) {
|
||||
|
||||
scanning->UserBuf.pw_rgb[dwPixels].Red =
|
||||
_HILO2WORD(scanning->Red.pcw[dwBitsPut].HiLo[0]) >> Shift;
|
||||
_HILO2WORD(scanning->Red.pcw[dwBitsPut].HiLo[0]) >> ls;
|
||||
|
||||
scanning->UserBuf.pw_rgb[dwPixels].Green =
|
||||
_HILO2WORD(scanning->Green.pcw[dwBitsPut].HiLo[0]) >> Shift;
|
||||
_HILO2WORD(scanning->Green.pcw[dwBitsPut].HiLo[0]) >> ls;
|
||||
|
||||
scanning->UserBuf.pw_rgb[dwPixels].Blue =
|
||||
_HILO2WORD(scanning->Blue.pcw[dwBitsPut].HiLo[0]) >> Shift;
|
||||
|
||||
dwPixels = dwPixels + iNext;
|
||||
ddax += izoom;
|
||||
dw--;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
for( dwBitsPut = 0, ddax = 0; dw; dwBitsPut++ ) {
|
||||
_HILO2WORD(scanning->Blue.pcw[dwBitsPut].HiLo[0]) >> ls;
|
||||
|
||||
ddax -= _SCALER;
|
||||
|
||||
while((ddax < 0) && (dw > 0)) {
|
||||
} else {
|
||||
|
||||
scanning->UserBuf.pw_rgb[dwPixels].Red =
|
||||
_HILO2WORD(scanning->Red.pcw[dwBitsPut].HiLo[0]);
|
||||
|
||||
scanning->Red.pw[dwBitsPut] >> ls;
|
||||
|
||||
scanning->UserBuf.pw_rgb[dwPixels].Green =
|
||||
_HILO2WORD(scanning->Green.pcw[dwBitsPut].HiLo[0]);
|
||||
|
||||
scanning->Green.pw[dwBitsPut] >> ls;
|
||||
|
||||
scanning->UserBuf.pw_rgb[dwPixels].Blue =
|
||||
_HILO2WORD(scanning->Blue.pcw[dwBitsPut].HiLo[0]);
|
||||
|
||||
dwPixels = dwPixels + iNext;
|
||||
ddax += izoom;
|
||||
dw--;
|
||||
scanning->Blue.pw[dwBitsPut] >> ls;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dwPixels = dwPixels + iNext;
|
||||
ddax += izoom;
|
||||
dw--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -647,10 +643,12 @@ static void usb_ColorScale16( struct Plustek_Device *dev )
|
|||
*/
|
||||
static void usb_ColorScale16_2( struct Plustek_Device *dev )
|
||||
{
|
||||
u_char ls;
|
||||
HiLoDef tmp;
|
||||
int izoom, ddax;
|
||||
u_long dw;
|
||||
pScanDef scanning = &dev->scanning;
|
||||
SANE_Bool swap = usb_HostSwap();
|
||||
pScanDef scanning = &dev->scanning;
|
||||
|
||||
usb_AverageColorWord( dev );
|
||||
|
||||
|
@ -666,62 +664,54 @@ static void usb_ColorScale16_2( struct Plustek_Device *dev )
|
|||
|
||||
izoom = usb_GetScaler( scanning );
|
||||
|
||||
if( scanning->dwFlag & SCANFLAG_RightAlign ) {
|
||||
if( scanning->dwFlag & SCANFLAG_RightAlign )
|
||||
ls = Shift;
|
||||
else
|
||||
ls = 0;
|
||||
|
||||
for( dwBitsPut = 0, ddax = 0; dw; dwBitsPut++ ) {
|
||||
for( dwBitsPut = 0, ddax = 0; dw; dwBitsPut++ ) {
|
||||
|
||||
ddax -= _SCALER;
|
||||
ddax -= _SCALER;
|
||||
|
||||
while((ddax < 0) && (dw > 0)) {
|
||||
while((ddax < 0) && (dw > 0)) {
|
||||
|
||||
if( swap ) {
|
||||
|
||||
tmp = *((pHiLoDef)&scanning->Red.pw[dwBitsPut]);
|
||||
scanning->UserBuf.pw_rgb[dwPixels].Red = _HILO2WORD(tmp) >> Shift;
|
||||
scanning->UserBuf.pw_rgb[dwPixels].Red = _HILO2WORD(tmp) >> ls;
|
||||
|
||||
tmp = *((pHiLoDef)&scanning->Green.pw[dwBitsPut]);
|
||||
scanning->UserBuf.pw_rgb[dwPixels].Green = _HILO2WORD(tmp) >> Shift;
|
||||
scanning->UserBuf.pw_rgb[dwPixels].Green = _HILO2WORD(tmp) >> ls;
|
||||
|
||||
tmp = *((pHiLoDef)&scanning->Blue.pw[dwBitsPut]);
|
||||
scanning->UserBuf.pw_rgb[dwPixels].Blue = _HILO2WORD(tmp) >> Shift;
|
||||
scanning->UserBuf.pw_rgb[dwPixels].Blue = _HILO2WORD(tmp) >> ls;
|
||||
|
||||
dwPixels = dwPixels + iNext;
|
||||
ddax += izoom;
|
||||
dw--;
|
||||
} else {
|
||||
|
||||
scanning->UserBuf.pw_rgb[dwPixels].Red =
|
||||
scanning->Red.pw[dwBitsPut] >> ls;
|
||||
|
||||
scanning->UserBuf.pw_rgb[dwPixels].Green =
|
||||
scanning->Green.pw[dwBitsPut] >> ls;
|
||||
|
||||
scanning->UserBuf.pw_rgb[dwPixels].Blue =
|
||||
scanning->Blue.pw[dwBitsPut] >> ls;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
for( dwBitsPut = 0, ddax = 0; dw; dwBitsPut++ ) {
|
||||
|
||||
ddax -= _SCALER;
|
||||
|
||||
while((ddax < 0) && (dw > 0)) {
|
||||
|
||||
tmp = *((pHiLoDef)&scanning->Red.pw[dwBitsPut]);
|
||||
scanning->UserBuf.pw_rgb[dwPixels].Red = _HILO2WORD(tmp);
|
||||
|
||||
tmp = *((pHiLoDef)&scanning->Green.pw[dwBitsPut]);
|
||||
scanning->UserBuf.pw_rgb[dwPixels].Green = _HILO2WORD(tmp);
|
||||
|
||||
tmp = *((pHiLoDef)&scanning->Blue.pw[dwBitsPut]);
|
||||
scanning->UserBuf.pw_rgb[dwPixels].Blue = _HILO2WORD(tmp);
|
||||
|
||||
dwPixels = dwPixels + iNext;
|
||||
ddax += izoom;
|
||||
dw--;
|
||||
}
|
||||
dwPixels = dwPixels + iNext;
|
||||
ddax += izoom;
|
||||
dw--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
static void usb_ColorScalePseudo16( struct Plustek_Device *dev )
|
||||
{
|
||||
int izoom, ddax;
|
||||
u_long dw;
|
||||
pScanDef scanning = &dev->scanning;
|
||||
pScanDef scanning = &dev->scanning;
|
||||
|
||||
usb_AverageColorByte( dev );
|
||||
|
||||
|
@ -735,7 +725,7 @@ static void usb_ColorScalePseudo16( struct Plustek_Device *dev )
|
|||
dwPixels = 0;
|
||||
}
|
||||
|
||||
izoom = usb_GetScaler( scanning );
|
||||
izoom = usb_GetScaler( scanning );
|
||||
|
||||
wR = (u_short)scanning->Red.pcb[0].a_bColor[0];
|
||||
wG = (u_short)scanning->Green.pcb[0].a_bColor[1];
|
||||
|
@ -764,16 +754,15 @@ static void usb_ColorScalePseudo16( struct Plustek_Device *dev )
|
|||
wR = (u_short)scanning->Red.pcb[dwBitsPut].a_bColor[0];
|
||||
wG = (u_short)scanning->Green.pcb[dwBitsPut].a_bColor[0];
|
||||
wB = (u_short)scanning->Blue.pcb[dwBitsPut].a_bColor[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*.............................................................................
|
||||
* do a simple memcopy from "driver-space" to "user-space"
|
||||
/** do a simple memcopy from "driver-space" to "user-space"
|
||||
*/
|
||||
static void usb_ColorDuplicate8( struct Plustek_Device *dev )
|
||||
{
|
||||
u_long dw;
|
||||
pScanDef scanning = &dev->scanning;
|
||||
pScanDef scanning = &dev->scanning;
|
||||
|
||||
usb_AverageColorByte( dev );
|
||||
|
||||
|
@ -799,8 +788,7 @@ static void usb_ColorDuplicate8( struct Plustek_Device *dev )
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* reorder from rgb line to rgb pixel (CIS scanner)
|
||||
/** reorder from rgb line to rgb pixel (CIS scanner)
|
||||
*/
|
||||
static void usb_ColorDuplicate8_2( struct Plustek_Device *dev )
|
||||
{
|
||||
|
@ -825,99 +813,95 @@ static void usb_ColorDuplicate8_2( struct Plustek_Device *dev )
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
static void usb_ColorDuplicate16( struct Plustek_Device *dev )
|
||||
{
|
||||
u_long dw;
|
||||
pScanDef scanning = &dev->scanning;
|
||||
u_char ls;
|
||||
u_long dw;
|
||||
pScanDef scan = &dev->scanning;
|
||||
SANE_Bool swap = usb_HostSwap();
|
||||
|
||||
usb_AverageColorWord( dev );
|
||||
|
||||
if( scanning->sParam.bSource == SOURCE_ADF ) {
|
||||
if( scan->sParam.bSource == SOURCE_ADF ) {
|
||||
iNext = -1;
|
||||
dwPixels = scanning->sParam.Size.dwPixels - 1;
|
||||
dwPixels = scan->sParam.Size.dwPixels - 1;
|
||||
} else {
|
||||
iNext = 1;
|
||||
dwPixels = 0;
|
||||
}
|
||||
|
||||
if( scanning->dwFlag & SCANFLAG_RightAlign ) {
|
||||
|
||||
for (dw = 0; dw < scanning->sParam.Size.dwPixels; dw++,
|
||||
dwPixels = dwPixels + iNext) {
|
||||
scanning->UserBuf.pw_rgb[dwPixels].Red =
|
||||
_HILO2WORD(scanning->Red.pcw[dw].HiLo[0]) >> Shift;
|
||||
scanning->UserBuf.pw_rgb[dwPixels].Green =
|
||||
_HILO2WORD(scanning->Green.pcw[dw].HiLo[0]) >> Shift;
|
||||
scanning->UserBuf.pw_rgb[dwPixels].Blue =
|
||||
_HILO2WORD(scanning->Blue.pcw[dw].HiLo[0]) >> Shift;
|
||||
}
|
||||
} else {
|
||||
|
||||
for (dw = 0; dw < scanning->sParam.Size.dwPixels; dw++,
|
||||
if( scan->dwFlag & SCANFLAG_RightAlign )
|
||||
ls = Shift;
|
||||
else
|
||||
ls = 0;
|
||||
|
||||
for (dw = 0; dw < scan->sParam.Size.dwPixels; dw++,
|
||||
dwPixels = dwPixels + iNext) {
|
||||
|
||||
scanning->UserBuf.pw_rgb[dwPixels].Red =
|
||||
_HILO2WORD(scanning->Red.pcw[dw].HiLo[0]);
|
||||
scanning->UserBuf.pw_rgb[dwPixels].Green =
|
||||
_HILO2WORD(scanning->Green.pcw[dw].HiLo[0]);
|
||||
scanning->UserBuf.pw_rgb[dwPixels].Blue =
|
||||
_HILO2WORD(scanning->Blue.pcw[dw].HiLo[0]);
|
||||
if( swap ) {
|
||||
scan->UserBuf.pw_rgb[dwPixels].Red =
|
||||
_HILO2WORD(scan->Red.pcw[dw].HiLo[0]) >> ls;
|
||||
scan->UserBuf.pw_rgb[dwPixels].Green =
|
||||
_HILO2WORD(scan->Green.pcw[dw].HiLo[0]) >> ls;
|
||||
scan->UserBuf.pw_rgb[dwPixels].Blue =
|
||||
_HILO2WORD(scan->Blue.pcw[dw].HiLo[0]) >> ls;
|
||||
} else {
|
||||
scan->UserBuf.pw_rgb[dwPixels].Red = scan->Red.pw[dw] >> ls;
|
||||
scan->UserBuf.pw_rgb[dwPixels].Green= scan->Green.pw[dw] >> ls;
|
||||
scan->UserBuf.pw_rgb[dwPixels].Blue = scan->Blue.pw[dw] >> ls;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
static void usb_ColorDuplicate16_2( struct Plustek_Device *dev )
|
||||
{
|
||||
HiLoDef tmp;
|
||||
u_long dw;
|
||||
pScanDef scanning = &dev->scanning;
|
||||
u_char ls;
|
||||
HiLoDef tmp;
|
||||
u_long dw;
|
||||
pScanDef scan = &dev->scanning;
|
||||
SANE_Bool swap = usb_HostSwap();
|
||||
|
||||
usb_AverageColorWord( dev );
|
||||
|
||||
if( scanning->sParam.bSource == SOURCE_ADF ) {
|
||||
if( scan->sParam.bSource == SOURCE_ADF ) {
|
||||
iNext = -1;
|
||||
dwPixels = scanning->sParam.Size.dwPixels - 1;
|
||||
dwPixels = scan->sParam.Size.dwPixels - 1;
|
||||
} else {
|
||||
iNext = 1;
|
||||
dwPixels = 0;
|
||||
}
|
||||
|
||||
if( scanning->dwFlag & SCANFLAG_RightAlign ) {
|
||||
if( scan->dwFlag & SCANFLAG_RightAlign )
|
||||
ls = Shift;
|
||||
else
|
||||
ls = 0;
|
||||
|
||||
for( dw = 0; dw < scan->sParam.Size.dwPixels;
|
||||
dw++, dwPixels = dwPixels + iNext) {
|
||||
|
||||
for (dw = 0; dw < scanning->sParam.Size.dwPixels; dw++, dwPixels = dwPixels + iNext)
|
||||
{
|
||||
tmp = *((pHiLoDef)&scanning->Red.pw[dw]);
|
||||
scanning->UserBuf.pw_rgb[dwPixels].Red = _HILO2WORD(tmp) >> Shift;
|
||||
if( swap ) {
|
||||
tmp = *((pHiLoDef)&scan->Red.pw[dw]);
|
||||
scan->UserBuf.pw_rgb[dwPixels].Red = _HILO2WORD(tmp) >> ls;
|
||||
|
||||
tmp = *((pHiLoDef)&scanning->Green.pw[dw]);
|
||||
scanning->UserBuf.pw_rgb[dwPixels].Green = _HILO2WORD(tmp) >> Shift;
|
||||
tmp = *((pHiLoDef)&scan->Green.pw[dw]);
|
||||
scan->UserBuf.pw_rgb[dwPixels].Green = _HILO2WORD(tmp) >> ls;
|
||||
|
||||
tmp = *((pHiLoDef)&scanning->Blue.pw[dw]);
|
||||
scanning->UserBuf.pw_rgb[dwPixels].Blue = _HILO2WORD(tmp) >> Shift;
|
||||
}
|
||||
} else {
|
||||
tmp = *((pHiLoDef)&scan->Blue.pw[dw]);
|
||||
scan->UserBuf.pw_rgb[dwPixels].Blue = _HILO2WORD(tmp) >> ls;
|
||||
|
||||
for (dw = 0; dw < scanning->sParam.Size.dwPixels; dw++, dwPixels = dwPixels + iNext)
|
||||
{
|
||||
tmp = *((pHiLoDef)&scanning->Red.pw[dw]);
|
||||
scanning->UserBuf.pw_rgb[dwPixels].Red = _HILO2WORD(tmp);
|
||||
} else {
|
||||
|
||||
tmp = *((pHiLoDef)&scanning->Green.pw[dw]);
|
||||
scanning->UserBuf.pw_rgb[dwPixels].Green = _HILO2WORD(tmp);
|
||||
|
||||
tmp = *((pHiLoDef)&scanning->Blue.pw[dw]);
|
||||
scanning->UserBuf.pw_rgb[dwPixels].Blue = _HILO2WORD(tmp);
|
||||
scan->UserBuf.pw_rgb[dwPixels].Red = scan->Red.pw[dw] >> ls;
|
||||
scan->UserBuf.pw_rgb[dwPixels].Green = scan->Green.pw[dw] >> ls;
|
||||
scan->UserBuf.pw_rgb[dwPixels].Blue = scan->Blue.pw[dw] >> ls;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
static void usb_ColorDuplicatePseudo16( struct Plustek_Device *dev )
|
||||
{
|
||||
|
@ -962,40 +946,36 @@ static void usb_ColorDuplicatePseudo16( struct Plustek_Device *dev )
|
|||
static void usb_ColorDuplicateGray( struct Plustek_Device *dev )
|
||||
{
|
||||
u_long dw;
|
||||
pScanDef scanning = &dev->scanning;
|
||||
pScanDef scan = &dev->scanning;
|
||||
|
||||
usb_AverageColorByte( dev );
|
||||
|
||||
if (scanning->sParam.bSource == SOURCE_ADF)
|
||||
{
|
||||
if (scan->sParam.bSource == SOURCE_ADF) {
|
||||
iNext = -1;
|
||||
dwPixels = scanning->sParam.Size.dwPixels - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dwPixels = scan->sParam.Size.dwPixels - 1;
|
||||
} else {
|
||||
iNext = 1;
|
||||
dwPixels = 0;
|
||||
}
|
||||
|
||||
switch(scanning->fGrayFromColor)
|
||||
{
|
||||
switch(scan->fGrayFromColor) {
|
||||
|
||||
case 1:
|
||||
for (dw = 0; dw < scanning->sParam.Size.dwPixels; dw++, dwPixels = dwPixels + iNext)
|
||||
scanning->UserBuf.pb[dwPixels] = scanning->Red.pcb[dw].a_bColor[0];
|
||||
for (dw = 0; dw < scan->sParam.Size.dwPixels; dw++, dwPixels = dwPixels + iNext)
|
||||
scan->UserBuf.pb[dwPixels] = scan->Red.pcb[dw].a_bColor[0];
|
||||
break;
|
||||
case 2:
|
||||
for (dw = 0; dw < scanning->sParam.Size.dwPixels; dw++, dwPixels = dwPixels + iNext)
|
||||
scanning->UserBuf.pb[dwPixels] = scanning->Green.pcb[dw].a_bColor[0];
|
||||
for (dw = 0; dw < scan->sParam.Size.dwPixels; dw++, dwPixels = dwPixels + iNext)
|
||||
scan->UserBuf.pb[dwPixels] = scan->Green.pcb[dw].a_bColor[0];
|
||||
break;
|
||||
case 3:
|
||||
for (dw = 0; dw < scanning->sParam.Size.dwPixels; dw++, dwPixels = dwPixels + iNext)
|
||||
scanning->UserBuf.pb[dwPixels] = scanning->Blue.pcb[dw].a_bColor[0];
|
||||
for (dw = 0; dw < scan->sParam.Size.dwPixels; dw++, dwPixels = dwPixels + iNext)
|
||||
scan->UserBuf.pb[dwPixels] = scan->Blue.pcb[dw].a_bColor[0];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
static void usb_ColorDuplicateGray_2( struct Plustek_Device *dev )
|
||||
{
|
||||
|
@ -1033,7 +1013,6 @@ static void usb_ColorDuplicateGray_2( struct Plustek_Device *dev )
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
static void usb_BWScale( struct Plustek_Device *dev )
|
||||
{
|
||||
|
@ -1084,7 +1063,6 @@ static void usb_BWScale( struct Plustek_Device *dev )
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
static void usb_BWDuplicate( struct Plustek_Device *dev )
|
||||
{
|
||||
|
@ -1102,7 +1080,6 @@ static void usb_BWDuplicate( struct Plustek_Device *dev )
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
static void usb_GrayScale8( struct Plustek_Device *dev )
|
||||
{
|
||||
|
@ -1138,12 +1115,13 @@ static void usb_GrayScale8( struct Plustek_Device *dev )
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
static void usb_GrayScale16( struct Plustek_Device *dev )
|
||||
{
|
||||
int izoom, ddax;
|
||||
pScanDef scanning = &dev->scanning;
|
||||
u_char ls;
|
||||
int izoom, ddax;
|
||||
pScanDef scanning = &dev->scanning;
|
||||
SANE_Bool swap = usb_HostSwap();
|
||||
|
||||
usb_AverageGrayWord( dev);
|
||||
|
||||
|
@ -1161,40 +1139,30 @@ static void usb_GrayScale16( struct Plustek_Device *dev )
|
|||
izoom = usb_GetScaler( scanning );
|
||||
ddax = 0;
|
||||
|
||||
if( scanning->dwFlag & SCANFLAG_RightAlign ) {
|
||||
if( scanning->dwFlag & SCANFLAG_RightAlign )
|
||||
ls = Shift;
|
||||
else
|
||||
ls = 0;
|
||||
|
||||
for( dwPixels = scanning->sParam.Size.dwPixels; dwPixels; pwm++ ) {
|
||||
for( dwPixels = scanning->sParam.Size.dwPixels; dwPixels; pwm++ ) {
|
||||
|
||||
ddax -= _SCALER;
|
||||
ddax -= _SCALER;
|
||||
|
||||
while((ddax < 0) && (dwPixels > 0)) {
|
||||
while((ddax < 0) && (dwPixels > 0)) {
|
||||
|
||||
*pwDest = _PHILO2WORD( pwm ) >> Shift;
|
||||
pwDest = pwDest + iNext;
|
||||
ddax += izoom;
|
||||
dwPixels--;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
if( swap )
|
||||
*pwDest = _PHILO2WORD( pwm ) >> ls;
|
||||
else
|
||||
*pwDest = *((u_short*)pwm) >> ls;
|
||||
|
||||
for( dwPixels = scanning->sParam.Size.dwPixels; dwPixels; pwm++ ) {
|
||||
|
||||
ddax -= _SCALER;
|
||||
|
||||
while((ddax < 0) && (dwPixels > 0)) {
|
||||
|
||||
*pwDest = _PHILO2WORD( pwm );
|
||||
pwDest = pwDest + iNext;
|
||||
ddax += izoom;
|
||||
dwPixels--;
|
||||
}
|
||||
}
|
||||
pwDest = pwDest + iNext;
|
||||
ddax += izoom;
|
||||
dwPixels--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
static void usb_GrayScalePseudo16( struct Plustek_Device *dev )
|
||||
{
|
||||
|
@ -1214,7 +1182,7 @@ static void usb_GrayScalePseudo16( struct Plustek_Device *dev )
|
|||
pbSrce = scanning->Green.pb;
|
||||
wG = (u_short)*pbSrce;
|
||||
|
||||
izoom = usb_GetScaler( scanning );
|
||||
izoom = usb_GetScaler( scanning );
|
||||
ddax = 0;
|
||||
|
||||
for( dwPixels = scanning->sParam.Size.dwPixels; dwPixels; pbSrce++ ) {
|
||||
|
@ -1256,35 +1224,39 @@ static void usb_GrayDuplicate8( struct Plustek_Device *dev )
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
static void usb_GrayDuplicate16( struct Plustek_Device *dev )
|
||||
{
|
||||
pScanDef scanning = &dev->scanning;
|
||||
u_char ls;
|
||||
pScanDef scanning = &dev->scanning;
|
||||
SANE_Bool swap = usb_HostSwap();
|
||||
|
||||
usb_AverageGrayWord( dev );
|
||||
|
||||
if (scanning->sParam.bSource == SOURCE_ADF)
|
||||
{
|
||||
if( scanning->sParam.bSource == SOURCE_ADF ) {
|
||||
iNext = -1;
|
||||
pwDest = scanning->UserBuf.pw + scanning->sParam.Size.dwPixels - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
iNext = 1;
|
||||
pwDest = scanning->UserBuf.pw;
|
||||
}
|
||||
pwm = scanning->Green.philo;
|
||||
if (scanning->dwFlag & SCANFLAG_RightAlign)
|
||||
for (dwPixels = scanning->sParam.Size.dwPixels; dwPixels--; pwm++, pwDest = pwDest + iNext)
|
||||
*pwDest = (_PHILO2WORD(pwm)) >> Shift;
|
||||
|
||||
if( scanning->dwFlag & SCANFLAG_RightAlign )
|
||||
ls = Shift;
|
||||
else
|
||||
for (dwPixels = scanning->sParam.Size.dwPixels; dwPixels--; pwm++, pwDest = pwDest + iNext)
|
||||
*pwDest = (_PHILO2WORD(pwm)) & Mask;
|
||||
ls = 0;
|
||||
|
||||
pwm = scanning->Green.philo;
|
||||
for ( dwPixels = scanning->sParam.Size.dwPixels; dwPixels--;
|
||||
pwm++, pwDest = pwDest + iNext) {
|
||||
if( swap )
|
||||
*pwDest = (_PHILO2WORD(pwm)) >> ls;
|
||||
else
|
||||
*pwDest = *((u_short*)pwm) >> ls;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
static void usb_GrayDuplicatePseudo16( struct Plustek_Device *dev )
|
||||
{
|
||||
|
@ -1314,8 +1286,7 @@ static void usb_GrayDuplicatePseudo16( struct Plustek_Device *dev )
|
|||
}
|
||||
}
|
||||
|
||||
/*.............................................................................
|
||||
* function to select the apropriate pixel copy function
|
||||
/** function to select the apropriate pixel copy function
|
||||
*/
|
||||
static void usb_GetImageProc( struct Plustek_Device *dev )
|
||||
{
|
||||
|
@ -1498,74 +1469,74 @@ static SANE_Int usb_ReadData( struct Plustek_Device *dev )
|
|||
return 0;
|
||||
}
|
||||
|
||||
if( scanning->sParam.Size.dwTotalBytes > scanning->dwBytesScanBuf )
|
||||
dw = scanning->dwBytesScanBuf;
|
||||
else
|
||||
dw = scanning->sParam.Size.dwTotalBytes;
|
||||
if( scanning->sParam.Size.dwTotalBytes > scanning->dwBytesScanBuf )
|
||||
dw = scanning->dwBytesScanBuf;
|
||||
else
|
||||
dw = scanning->sParam.Size.dwTotalBytes;
|
||||
|
||||
scanning->sParam.Size.dwTotalBytes -= dw;
|
||||
scanning->sParam.Size.dwTotalBytes -= dw;
|
||||
|
||||
if(!scanning->sParam.Size.dwTotalBytes && dw < (pl * 1024))
|
||||
{
|
||||
if(!(a_bRegs[0x4e] = (u_char)ceil((double)dw /
|
||||
if(!scanning->sParam.Size.dwTotalBytes && dw < (pl * 1024))
|
||||
{
|
||||
if(!(a_bRegs[0x4e] = (u_char)ceil((double)dw /
|
||||
(4.0 * hw->wDRAMSize)))) {
|
||||
a_bRegs[0x4e] = 1;
|
||||
a_bRegs[0x4e] = 1;
|
||||
}
|
||||
|
||||
a_bRegs[0x4f] = 0;
|
||||
a_bRegs[0x4f] = 0;
|
||||
|
||||
sanei_lm983x_write( dev->fd, 0x4e, &a_bRegs[0x4e], 2, SANE_TRUE );
|
||||
}
|
||||
sanei_lm983x_write( dev->fd, 0x4e, &a_bRegs[0x4e], 2, SANE_TRUE );
|
||||
}
|
||||
|
||||
while( scanning->bLinesToSkip ) {
|
||||
while( scanning->bLinesToSkip ) {
|
||||
|
||||
DBG( _DBG_READ, "Skipping %u lines\n", scanning->bLinesToSkip );
|
||||
DBG( _DBG_READ, "Skipping %u lines\n", scanning->bLinesToSkip );
|
||||
|
||||
dwBytes = scanning->bLinesToSkip*scanning->sParam.Size.dwPhyBytes;
|
||||
dwBytes = scanning->bLinesToSkip*scanning->sParam.Size.dwPhyBytes;
|
||||
|
||||
if (dwBytes > scanning->dwBytesScanBuf) {
|
||||
if (dwBytes > scanning->dwBytesScanBuf) {
|
||||
|
||||
dwBytes = scanning->dwBytesScanBuf;
|
||||
scanning->bLinesToSkip -= scanning->dwLinesScanBuf;
|
||||
} else {
|
||||
scanning->bLinesToSkip = 0;
|
||||
}
|
||||
dwBytes = scanning->dwBytesScanBuf;
|
||||
scanning->bLinesToSkip -= scanning->dwLinesScanBuf;
|
||||
} else {
|
||||
scanning->bLinesToSkip = 0;
|
||||
}
|
||||
|
||||
if( !usb_ScanReadImage( dev, scanning->pbGetDataBuf, dwBytes ))
|
||||
if( !usb_ScanReadImage( dev, scanning->pbGetDataBuf, dwBytes ))
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if( usb_ScanReadImage( dev, scanning->pbGetDataBuf, dw )) {
|
||||
if( usb_ScanReadImage( dev, scanning->pbGetDataBuf, dw )) {
|
||||
|
||||
dumpPic( "plustek-pic.raw", scanning->pbGetDataBuf, dw );
|
||||
|
||||
if( scanning->dwLinesDiscard ) {
|
||||
if( scanning->dwLinesDiscard ) {
|
||||
|
||||
DBG( _DBG_READ, "Discarding %lu lines\n",
|
||||
scanning->dwLinesDiscard );
|
||||
DBG( _DBG_READ, "Discarding %lu lines\n",
|
||||
scanning->dwLinesDiscard );
|
||||
|
||||
dwRet = dw / scanning->sParam.Size.dwPhyBytes;
|
||||
dwRet = dw / scanning->sParam.Size.dwPhyBytes;
|
||||
|
||||
if (scanning->dwLinesDiscard > dwRet) {
|
||||
scanning->dwLinesDiscard -= dwRet;
|
||||
dwRet = 0;
|
||||
} else {
|
||||
dwRet -= scanning->dwLinesDiscard;
|
||||
scanning->dwLinesDiscard = 0;
|
||||
}
|
||||
} else {
|
||||
if (scanning->dwLinesDiscard > dwRet) {
|
||||
scanning->dwLinesDiscard -= dwRet;
|
||||
dwRet = 0;
|
||||
} else {
|
||||
dwRet -= scanning->dwLinesDiscard;
|
||||
scanning->dwLinesDiscard = 0;
|
||||
}
|
||||
} else {
|
||||
|
||||
dwRet = dw / scanning->sParam.Size.dwPhyBytes;
|
||||
}
|
||||
dwRet = dw / scanning->sParam.Size.dwPhyBytes;
|
||||
}
|
||||
|
||||
scanning->pbGetDataBuf += scanning->dwBytesScanBuf;
|
||||
if( scanning->pbGetDataBuf >= scanning->pbScanBufEnd ) {
|
||||
scanning->pbGetDataBuf = scanning->pbScanBufBegin;
|
||||
}
|
||||
scanning->pbGetDataBuf += scanning->dwBytesScanBuf;
|
||||
if( scanning->pbGetDataBuf >= scanning->pbScanBufEnd ) {
|
||||
scanning->pbGetDataBuf = scanning->pbScanBufBegin;
|
||||
}
|
||||
|
||||
if( dwRet )
|
||||
return dwRet;
|
||||
}
|
||||
if( dwRet )
|
||||
return dwRet;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
* - 0.45 - fixed dumpRegs
|
||||
* - added dimension stuff to dumpPic
|
||||
* - 0.46 - disabled reset prior to the detection of Merlin
|
||||
* - 0.47 - no changes
|
||||
* .
|
||||
* <hr>
|
||||
* This file is part of the SANE package.
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
* - 0.44 - map inversion for negatatives now only upon user request
|
||||
* - 0.45 - no changes
|
||||
* - 0.46 - no changes
|
||||
* - 0.47 - no changes
|
||||
* .
|
||||
* <hr>
|
||||
* This file is part of the SANE package.
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
* - fixed CIS PhyBytes adjustment
|
||||
* - removed CanoScan specific setting stuff
|
||||
* - 0.46 - fixed problem in usb_SetScanParameters()
|
||||
* - 0.47 - no changes
|
||||
* .
|
||||
* <hr>
|
||||
* This file is part of the SANE package.
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
* - 0.46 - CanoScan will now be calibrated by code in plustek-usbcal.c
|
||||
* - added functions to save and restore calibration data from a file
|
||||
* - fixed some TPA issues
|
||||
* - 0.47 - made calibration work on big-endian machines
|
||||
* .
|
||||
* <hr>
|
||||
* This file is part of the SANE package.
|
||||
|
@ -72,8 +73,8 @@
|
|||
#define _MAX_SHAD 0x4000
|
||||
#define _SHADING_BUF (_MAX_SHAD*3) /**< max size of the shading buffer */
|
||||
|
||||
/*#define SWAP_COARSE*/
|
||||
/*#define SWAP_FINE*/
|
||||
#define SWAP_COARSE
|
||||
#define SWAP_FINE
|
||||
|
||||
static u_short a_wWhiteShading[_SHADING_BUF] = {0};
|
||||
static u_short a_wDarkShading[_SHADING_BUF] = {0};
|
||||
|
@ -132,7 +133,11 @@ static void usb_line_statistics( char *cmt, u_short* buf,
|
|||
|
||||
for( dw = 0; dw < dim_x; pvd++, dw++ ) {
|
||||
|
||||
#ifdef SWAP_FINE
|
||||
tmp = pvd->Mono;
|
||||
#else
|
||||
tmp = _LOBYTE(pvd->Mono) * 256 + _HIBYTE(pvd->Mono);
|
||||
#endif
|
||||
|
||||
if( tmp > mad ) {
|
||||
mad = tmp;
|
||||
|
@ -153,7 +158,11 @@ static void usb_line_statistics( char *cmt, u_short* buf,
|
|||
|
||||
for( dw = 0; dw < dim_x; pvd2++, dw++ ) {
|
||||
|
||||
#ifdef SWAP_FINE
|
||||
tmp = pvd2->Mono;
|
||||
#else
|
||||
tmp = _LOBYTE(pvd2->Mono) * 256 + _HIBYTE(pvd2->Mono);
|
||||
#endif
|
||||
|
||||
if( tmp > ubd ) {
|
||||
cud++;
|
||||
|
@ -547,14 +556,6 @@ static void usb_GetSoftwareOffsetGain( pPlustek_Device dev )
|
|||
}
|
||||
}
|
||||
|
||||
/** as the name says..
|
||||
*/
|
||||
static void usb_Swap( u_short *pw, u_long dwBytes )
|
||||
{
|
||||
for( dwBytes /= 2; dwBytes--; pw++ )
|
||||
_SWAP(((u_char*) pw)[0], ((u_char*)pw)[1]);
|
||||
}
|
||||
|
||||
/** according to the pixel values,
|
||||
*/
|
||||
static u_char usb_GetNewGain( u_short wMax, int channel )
|
||||
|
@ -1140,6 +1141,9 @@ static void usb_GetNewOffset( u_long *pdwSum, u_long *pdwDiff,
|
|||
* black pixels.
|
||||
* Affects register 0x38, 0x39 and 0x3a
|
||||
*/
|
||||
static SANE_Bool cano_AdjustOffset( pPlustek_Device dev );
|
||||
|
||||
|
||||
static SANE_Bool usb_AdjustOffset( pPlustek_Device dev )
|
||||
{
|
||||
char tmp[40];
|
||||
|
@ -1150,7 +1154,7 @@ static SANE_Bool usb_AdjustOffset( pPlustek_Device dev )
|
|||
u_long dw, dwPixels;
|
||||
u_long dwDiff[3], dwSum[3];
|
||||
|
||||
pHWDef hw = &dev->usbDev.HwSetting;
|
||||
pHWDef hw = &dev->usbDev.HwSetting;
|
||||
|
||||
if( usb_IsEscPressed())
|
||||
return SANE_FALSE;
|
||||
|
@ -1356,7 +1360,7 @@ static void usb_GetDarkShading( pPlustek_Device dev, u_short *pwDest,
|
|||
#ifndef SWAP_FINE
|
||||
wtmp = ((int)_PHILO2WORD(pSrce) + iOffset);
|
||||
#else
|
||||
wtmp = (*(int*)pSrce + iOffset);
|
||||
wtmp = (*((int*)pSrce) + iOffset);
|
||||
#endif
|
||||
if( wtmp < 0 )
|
||||
wtmp = 0;
|
||||
|
@ -1383,7 +1387,7 @@ static void usb_GetDarkShading( pPlustek_Device dev, u_short *pwDest,
|
|||
#ifndef SWAP_FINE
|
||||
dwSum[dw & 1] += (u_long)_PHILO2WORD(pSrce);
|
||||
#else
|
||||
dwSum[dw & 1] += *(u_long*)pSrce;
|
||||
dwSum[dw & 1] += (u_long)(*(u_short*)pSrce);
|
||||
#endif
|
||||
}
|
||||
dwSum[0] /= ((dwPixels + 1UL) >> 1);
|
||||
|
@ -1416,25 +1420,23 @@ static void usb_GetDarkShading( pPlustek_Device dev, u_short *pwDest,
|
|||
pwDest[dw] = (u_short)dwSum[dw & 1];
|
||||
} else {
|
||||
|
||||
u_long dwEnd = 0;
|
||||
|
||||
/* Standard CCD */
|
||||
|
||||
/* do some averaging on the line */
|
||||
for( dw = dwEnd; dw < dwPixels; dw++, pSrce += dwAdd ) {
|
||||
for( dw = 0; dw < dwPixels; dw++, pSrce += dwAdd ) {
|
||||
#ifndef SWAP_FINE
|
||||
dwSum[0] += (u_long)_PHILO2WORD(pSrce);
|
||||
#else
|
||||
dwSum[0] += *(u_long*)pSrce;
|
||||
dwSum[0] += (u_long)(*(u_short*)pSrce);
|
||||
#endif
|
||||
}
|
||||
|
||||
dwSum[0] /= (dwPixels - dwEnd);
|
||||
dwSum[0] /= dwPixels;
|
||||
|
||||
/* add our offset... */
|
||||
dwSum[0] = (int)dwSum[0] + iOffset;
|
||||
if((int)dwSum[0] < 0)
|
||||
dwSum [0] = 0;
|
||||
dwSum[0] = 0;
|
||||
#ifndef SWAP_FINE
|
||||
dwSum[0] = (u_long)_LOBYTE(_LOWORD(dwSum[0])) * 256UL +
|
||||
_HIBYTE(_LOWORD(dwSum[0]));
|
||||
|
@ -1443,13 +1445,13 @@ static void usb_GetDarkShading( pPlustek_Device dev, u_short *pwDest,
|
|||
#endif
|
||||
|
||||
/* fill the shading data */
|
||||
for( dw = dwEnd; dw < dwPixels; dw++ )
|
||||
for( dw = 0; dw < dwPixels; dw++ )
|
||||
pwDest[dw] = (u_short)dwSum[0];
|
||||
}
|
||||
}
|
||||
#ifdef SWAP_FINE
|
||||
if(usb_HostSwap())
|
||||
usb_Swap( pwDest, dwPixels );
|
||||
usb_Swap( pwDest, dwPixels *2 );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1629,7 +1631,8 @@ static SANE_Bool usb_AdjustWhiteShading( pPlustek_Device dev )
|
|||
pMonoWordDef pValue;
|
||||
u_long* pdw;
|
||||
int i;
|
||||
|
||||
SANE_Bool swap = usb_HostSwap();
|
||||
|
||||
if( scaps->workaroundFlag & _WAF_SKIP_FINE )
|
||||
return SANE_TRUE;
|
||||
|
||||
|
@ -1797,7 +1800,7 @@ static SANE_Bool usb_AdjustWhiteShading( pPlustek_Device dev )
|
|||
}
|
||||
|
||||
if( _LM9831 == hw->chip ) {
|
||||
|
||||
|
||||
u_short *pwDest = (u_short*)pBuf;
|
||||
pHiLoDef pwSrce = (pHiLoDef)pBuf;
|
||||
|
||||
|
@ -1807,9 +1810,17 @@ static SANE_Bool usb_AdjustWhiteShading( pPlustek_Device dev )
|
|||
|
||||
for( dwLines = dwShadingLines /*SHADING_Lines*/; dwLines; dwLines--) {
|
||||
|
||||
for( dw = 0; dw < m_dwPixels * m_ScanParam.bChannels; dw++ )
|
||||
pwDest[dw] = _HILO2WORD( pwSrce[dw] );
|
||||
|
||||
#ifdef SWAP_FINE
|
||||
if(usb_HostSwap()) {
|
||||
#endif
|
||||
for( dw = 0; dw < m_dwPixels * m_ScanParam.bChannels; dw++ )
|
||||
pwDest[dw] = _HILO2WORD( pwSrce[dw] );
|
||||
#ifdef SWAP_FINE
|
||||
} else {
|
||||
for( dw = 0; dw < m_dwPixels * m_ScanParam.bChannels; dw++ )
|
||||
pwDest[dw] = ((u_short*)pwSrce)[dw];
|
||||
}
|
||||
#endif
|
||||
pwDest += (u_long)m_dwPixels * m_ScanParam.bChannels;
|
||||
pwSrce = (pHiLoDef)((u_char*)pwSrce + m_ScanParam.Size.dwPhyBytes);
|
||||
}
|
||||
|
@ -1822,9 +1833,21 @@ static SANE_Bool usb_AdjustWhiteShading( pPlustek_Device dev )
|
|||
|
||||
for( dwLines = dwShadingLines/*SHADING_Lines*/; dwLines; dwLines-- ) {
|
||||
|
||||
for( dw = 0; dw < m_ScanParam.Size.dwPhyPixels * m_ScanParam.bChannels; dw++)
|
||||
pwDest[dw] = _HILO2WORD( pwSrce[dw] );
|
||||
|
||||
#ifdef SWAP_FINE
|
||||
if(usb_HostSwap()) {
|
||||
#endif
|
||||
for( dw = 0; dw < m_ScanParam.Size.dwPhyPixels *
|
||||
m_ScanParam.bChannels; dw++) {
|
||||
pwDest[dw] = _HILO2WORD( pwSrce[dw] );
|
||||
}
|
||||
#ifdef SWAP_FINE
|
||||
} else {
|
||||
for( dw = 0; dw < m_ScanParam.Size.dwPhyPixels *
|
||||
m_ScanParam.bChannels; dw++) {
|
||||
pwDest[dw] = ((u_short*)pwSrce)[dw];
|
||||
}
|
||||
}
|
||||
#endif
|
||||
pwDest += m_ScanParam.Size.dwPhyPixels * m_ScanParam.bChannels;
|
||||
pwSrce = (pHiLoDef)((u_char*)pwSrce + m_ScanParam.Size.dwPhyBytes);
|
||||
}
|
||||
|
@ -1939,7 +1962,11 @@ static SANE_Bool usb_AdjustWhiteShading( pPlustek_Device dev )
|
|||
pValue->Mono = (u_short)(GAIN_Target * 16384U / pValue->Mono);
|
||||
else
|
||||
pValue->Mono = GAIN_Target;
|
||||
_SWAP(pValue->HiLo.bHi, pValue->HiLo.bLo);
|
||||
|
||||
#ifdef SWAP_FINE
|
||||
if( swap )
|
||||
#endif
|
||||
_SWAP(pValue->HiLo.bHi, pValue->HiLo.bLo);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -1984,7 +2011,7 @@ static SANE_Bool usb_AdjustWhiteShading( pPlustek_Device dev )
|
|||
wV = pwAv [dw];
|
||||
for (w = 0; w < m_wShadow; w++, pw += m_ScanParam.Size.dwPhyPixels)
|
||||
if (wV < pw [dw])
|
||||
_SWAP (wV, pw [dw]);
|
||||
_SWAP (wV, pw[dw]);
|
||||
pwAv [dw] = wV;
|
||||
}
|
||||
}
|
||||
|
@ -1992,18 +2019,23 @@ static SANE_Bool usb_AdjustWhiteShading( pPlustek_Device dev )
|
|||
/* Sum */
|
||||
pdw = (u_long*)m_pSum; /* HEINER: check this */
|
||||
|
||||
for (dwLines = m_wHilight, pwAv = m_pAvMono + m_ScanParam.Size.dwPhyPixels * dwLines;
|
||||
dwLines < (dwShadingLines/*SHADING_Lines*/ - m_wShadow); dwLines++, pwAv += m_ScanParam.Size.dwPhyPixels)
|
||||
for (dwLines = m_wHilight,
|
||||
pwAv = m_pAvMono + m_ScanParam.Size.dwPhyPixels * dwLines;
|
||||
dwLines < (dwShadingLines/*SHADING_Lines*/ - m_wShadow);
|
||||
dwLines++, pwAv += m_ScanParam.Size.dwPhyPixels) {
|
||||
for (dw = 0; dw < m_ScanParam.Size.dwPhyPixels; dw++)
|
||||
pdw[dw] += pwAv [dw];
|
||||
pdw[dw] += pwAv[dw];
|
||||
}
|
||||
|
||||
/* Software gain */
|
||||
pValue = (pMonoWordDef)a_wWhiteShading;
|
||||
if( scanning->sParam.bSource != SOURCE_Negative ) {
|
||||
|
||||
for( dw = 0; dw < m_ScanParam.Size.dwPhyPixels; dw++) {
|
||||
|
||||
pdw[dw] = pdw [dw] * 1000 / ((dwShadingLines/*SHADING_Lines*/ -
|
||||
m_wHilight - m_wShadow) * scanning->sParam.swGain[1]);
|
||||
|
||||
if( pdw[dw] > 65535U )
|
||||
pValue[dw].Mono = 65535;
|
||||
else
|
||||
|
@ -2011,14 +2043,24 @@ static SANE_Bool usb_AdjustWhiteShading( pPlustek_Device dev )
|
|||
|
||||
if( pValue[dw].Mono > 16384U ) {
|
||||
pValue[dw].Mono = (u_short)(GAIN_Target * 16384U / pValue[dw].Mono);
|
||||
_SWAP(pValue[dw].HiLo.bHi, pValue[dw].HiLo.bLo);
|
||||
} else
|
||||
} else {
|
||||
pValue[dw].Mono = GAIN_Target;
|
||||
}
|
||||
|
||||
#ifdef SWAP_FINE
|
||||
if( swap )
|
||||
#endif
|
||||
_SWAP(pValue[dw].HiLo.bHi, pValue[dw].HiLo.bLo);
|
||||
}
|
||||
|
||||
} else{
|
||||
for( dw = 0; dw < m_ScanParam.Size.dwPhyPixels; dw++ )
|
||||
|
||||
for( dw = 0; dw < m_ScanParam.Size.dwPhyPixels; dw++ ) {
|
||||
pValue[dw].Mono = (u_short)(pdw[dw] /
|
||||
(dwShadingLines - m_wHilight - m_wShadow));
|
||||
(dwShadingLines - m_wHilight - m_wShadow));
|
||||
|
||||
/* swapping will be done later... */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2036,14 +2078,25 @@ static void usb_ResizeWhiteShading( double dAmp, u_short *pwShading, int iGain )
|
|||
u_short w;
|
||||
|
||||
for( dw = 0; dw < m_ScanParam.Size.dwPhyPixels; dw++ ) {
|
||||
|
||||
dwAmp = (u_long)(GAIN_Target * 0x4000 /
|
||||
(pwShading[dw] + 1) * dAmp) * iGain / 1000;
|
||||
if( dwAmp <= GAIN_Target)
|
||||
w = (u_short)dwAmp;
|
||||
else
|
||||
w = GAIN_Target;
|
||||
#ifndef SWAP_FINE
|
||||
pwShading[dw] = (u_short)_LOBYTE(w) * 256 + _HIBYTE(w);
|
||||
#else
|
||||
pwShading[dw] = w;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef SWAP_FINE
|
||||
if( usb_HostSwap()) {
|
||||
usb_Swap( pwShading, m_ScanParam.Size.dwPhyPixels );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
/**
|
||||
*/
|
||||
|
|
|
@ -59,11 +59,13 @@
|
|||
* - changed readImage interface for USB devices
|
||||
* - homeing of USB scanner is now working correctly
|
||||
* - 0.46 - added plustek-usbcal.c for extra CIS device calibration
|
||||
* based in Montys' great work
|
||||
* based on Montys' great work
|
||||
* - added altCalibration option
|
||||
* - removed parallelport support --> new backend: plustek_pp
|
||||
* - cleanup
|
||||
* - added sanei_thread support
|
||||
* - 0.47 - added mov-option (model override)
|
||||
* - removed drvOpen
|
||||
*.
|
||||
* <hr>
|
||||
* This file is part of the SANE package.
|
||||
|
@ -139,8 +141,8 @@
|
|||
#include "../include/sane/sanei.h"
|
||||
#include "../include/sane/saneopts.h"
|
||||
|
||||
#define BACKEND_VERSION "0.46-9"
|
||||
#define BACKEND_NAME plustek
|
||||
#define BACKEND_VERSION "0.47-2"
|
||||
#define BACKEND_NAME plustek
|
||||
#include "../include/sane/sanei_backend.h"
|
||||
#include "../include/sane/sanei_config.h"
|
||||
#include "../include/sane/sanei_thread.h"
|
||||
|
@ -244,6 +246,7 @@ static void show_cnf( pCnfDef cnf )
|
|||
DBG( _DBG_SANE_INIT,"Device configuration:\n" );
|
||||
DBG( _DBG_SANE_INIT,"device name : >%s<\n",cnf->devName );
|
||||
DBG( _DBG_SANE_INIT,"USB-ID : >%s<\n",cnf->usbId );
|
||||
DBG( _DBG_SANE_INIT,"model ovr. : %d\n", cnf->adj.mov );
|
||||
DBG( _DBG_SANE_INIT,"warmup : %ds\n", cnf->adj.warmup );
|
||||
DBG( _DBG_SANE_INIT,"lampOff : %d\n", cnf->adj.lampOff );
|
||||
DBG( _DBG_SANE_INIT,"lampOffOnEnd : %s\n", _YN(cnf->adj.lampOffOnEnd ));
|
||||
|
@ -272,32 +275,12 @@ static void show_cnf( pCnfDef cnf )
|
|||
DBG( _DBG_SANE_INIT,"---------------------\n" );
|
||||
}
|
||||
|
||||
/** open the device specific driver and reset the internal timing stuff
|
||||
* @param dev - pointer to the device specific structure
|
||||
* @return the function returns the result of the open call, on success
|
||||
* of course the handle
|
||||
*/
|
||||
static int drvopen( Plustek_Device *dev )
|
||||
{
|
||||
int handle;
|
||||
|
||||
DBG( _DBG_INFO, "drvopen()\n" );
|
||||
|
||||
handle = dev->open((const char*)dev->name, (void *)dev );
|
||||
|
||||
tsecs = 0;
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
||||
/** Calls the device specific stop and close functions.
|
||||
* @param dev - pointer to the device specific structure
|
||||
* @return The function always returns SANE_STATUS_GOOD
|
||||
*/
|
||||
static SANE_Status drvclose( Plustek_Device *dev )
|
||||
{
|
||||
int int_cnt;
|
||||
|
||||
if( dev->fd >= 0 ) {
|
||||
|
||||
DBG( _DBG_INFO, "drvclose()\n" );
|
||||
|
@ -306,12 +289,9 @@ static SANE_Status drvclose( Plustek_Device *dev )
|
|||
DBG( _DBG_INFO, "TIME END 1: %lus\n", time(NULL)-tsecs);
|
||||
}
|
||||
|
||||
/*
|
||||
* don't check the return values, simply do it and close the driver
|
||||
*/
|
||||
int_cnt = 0;
|
||||
dev->stopScan( dev, &int_cnt );
|
||||
dev->close( dev );
|
||||
/* don't check the return values, simply do it */
|
||||
dev->stopScan( dev );
|
||||
dev->close ( dev );
|
||||
}
|
||||
dev->fd = -1;
|
||||
|
||||
|
@ -1035,7 +1015,6 @@ static SANE_Status attach( const char *dev_name, pCnfDef cnf,
|
|||
dev->sane.type = "USB flatbed scanner";
|
||||
|
||||
#ifdef _PLUSTEK_USB
|
||||
dev->open = usbDev_open;
|
||||
dev->close = usbDev_close;
|
||||
dev->getCaps = usbDev_getCaps;
|
||||
dev->getCropInfo = usbDev_getCropInfo;
|
||||
|
@ -1067,7 +1046,7 @@ static SANE_Status attach( const char *dev_name, pCnfDef cnf,
|
|||
/*
|
||||
* go ahead and open the scanner device
|
||||
*/
|
||||
handle = drvopen( dev );
|
||||
handle = usbDev_open( dev );
|
||||
if( handle < 0 ) {
|
||||
DBG( _DBG_ERROR,"open failed: %d\n", handle );
|
||||
return SANE_STATUS_IO_ERROR;
|
||||
|
@ -1253,7 +1232,9 @@ SANE_Status sane_init( SANE_Int *version_code, SANE_Auth_Callback authorize )
|
|||
|
||||
decodeVal( str, "tpaOffX", _INT, &config.adj.tpa.x, &ival );
|
||||
decodeVal( str, "tpaOffY", _INT, &config.adj.tpa.y, &ival );
|
||||
|
||||
|
||||
decodeVal( str, "mov", _INT, &config.adj.mov, &ival);
|
||||
|
||||
dval = 1.0;
|
||||
decodeVal( str, "grayGamma", _FLOAT, &config.adj.graygamma,&dval);
|
||||
decodeVal( str, "redGamma", _FLOAT, &config.adj.rgamma, &dval );
|
||||
|
@ -1270,14 +1251,16 @@ SANE_Status sane_init( SANE_Int *version_code, SANE_Auth_Callback authorize )
|
|||
if( config.devName[0] != '\0' ) {
|
||||
attach( config.devName, &config, 0 );
|
||||
} else {
|
||||
DBG( _DBG_WARNING, "section contains no device name,"
|
||||
" ignored!\n" );
|
||||
if( first_dev != NULL ) {
|
||||
DBG( _DBG_WARNING, "section contains no device name,"
|
||||
" ignored!\n" );
|
||||
}
|
||||
}
|
||||
|
||||
/* re-initialize the configuration structure */
|
||||
init_config_struct( &config );
|
||||
|
||||
tmp = config.usbId;
|
||||
tmp = config.usbId;
|
||||
decodeUsbIDs( str, &tmp );
|
||||
|
||||
DBG( _DBG_SANE_INIT, "... next device\n" );
|
||||
|
@ -1290,12 +1273,12 @@ SANE_Status sane_init( SANE_Int *version_code, SANE_Auth_Callback authorize )
|
|||
/* ignore other stuff... */
|
||||
DBG( _DBG_SANE_INIT, "ignoring >%s<\n", str );
|
||||
}
|
||||
fclose (fp);
|
||||
fclose (fp);
|
||||
|
||||
/* try to attach the last device in the config file... */
|
||||
if( config.devName[0] != '\0' )
|
||||
if( config.devName[0] != '\0' )
|
||||
attach( config.devName, &config, 0 );
|
||||
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
|
@ -1850,7 +1833,7 @@ SANE_Status sane_start( SANE_Handle handle )
|
|||
/*
|
||||
* open the driver and get some information about the scanner
|
||||
*/
|
||||
dev->fd = drvopen( dev );
|
||||
dev->fd = usbDev_open( dev );
|
||||
if( dev->fd < 0 ) {
|
||||
DBG( _DBG_ERROR,"sane_start: open failed: %d\n", errno );
|
||||
|
||||
|
@ -1958,16 +1941,18 @@ SANE_Status sane_start( SANE_Handle handle )
|
|||
DBG( _DBG_ERROR, "dev->setEnv() failed(%d)\n", result );
|
||||
dev->close( dev );
|
||||
return SANE_STATUS_IO_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/* download gamma correction tables... */
|
||||
if( scanmode <= COLOR_GRAY16 ) {
|
||||
dev->setMap( dev, s->gamma_table[0], s->gamma_length, _MAP_MASTER);
|
||||
} else {
|
||||
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 );
|
||||
}
|
||||
dev->setMap( dev, s->gamma_table[2], s->gamma_length, _MAP_GREEN );
|
||||
dev->setMap( dev, s->gamma_table[3], s->gamma_length, _MAP_BLUE );
|
||||
}
|
||||
|
||||
tsecs = 0; /* reset timer */
|
||||
|
||||
result = dev->startScan( dev );
|
||||
if( result < 0 ) {
|
||||
|
@ -2017,42 +2002,13 @@ SANE_Status sane_start( SANE_Handle handle )
|
|||
return SANE_STATUS_IO_ERROR;
|
||||
}
|
||||
|
||||
/* reader_pid = 0 ===> child process */
|
||||
#if 0
|
||||
if( 0 == s->reader_pid ) {
|
||||
|
||||
sigset_t ignore_set;
|
||||
struct SIGACTION act;
|
||||
|
||||
DBG( _DBG_SANE_INIT, "reader process...\n" );
|
||||
|
||||
if( sanei_thread_is_forked()) {
|
||||
close( s->r_pipe );
|
||||
s->r_pipe = -1;
|
||||
}
|
||||
|
||||
sigfillset ( &ignore_set );
|
||||
sigdelset ( &ignore_set, SIGTERM );
|
||||
sigprocmask( SIG_SETMASK, &ignore_set, 0 );
|
||||
|
||||
memset ( &act, 0, sizeof (act));
|
||||
sigaction( SIGTERM, &act, 0 );
|
||||
|
||||
status = reader_process( s );
|
||||
|
||||
DBG( _DBG_SANE_INIT, "reader process done, status = %i\n", status );
|
||||
|
||||
/* don't use exit() since that would run the atexit() handlers */
|
||||
_exit( status );
|
||||
}
|
||||
#endif
|
||||
signal( SIGCHLD, sig_chldhandler );
|
||||
|
||||
if( sanei_thread_is_forked()) {
|
||||
close( s->w_pipe );
|
||||
s->w_pipe = -1;
|
||||
}
|
||||
|
||||
|
||||
DBG( _DBG_SANE_INIT, "sane_start done\n" );
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
@ -2063,7 +2019,7 @@ SANE_Status sane_read( SANE_Handle handle, SANE_Byte *data,
|
|||
SANE_Int max_length, SANE_Int *length )
|
||||
{
|
||||
Plustek_Scanner *s = (Plustek_Scanner*)handle;
|
||||
ssize_t nread;
|
||||
ssize_t nread;
|
||||
|
||||
*length = 0;
|
||||
|
||||
|
|
|
@ -90,14 +90,20 @@ option cacheCalData 0
|
|||
#
|
||||
option altCalibration 0
|
||||
|
||||
#
|
||||
# for skipping whole calibration step
|
||||
#
|
||||
option skipCalibration 0
|
||||
|
||||
#
|
||||
# for skipping entire fine calibration step
|
||||
# coarse calibration is done
|
||||
#
|
||||
option skipFine 0
|
||||
|
||||
#
|
||||
# discard the result of the fine white calibration
|
||||
#
|
||||
option skipFineWhite 0
|
||||
|
||||
# for replacing the gain values found during
|
||||
|
@ -121,6 +127,18 @@ option grayGamma 1.0
|
|||
#
|
||||
option enableTPA 0
|
||||
|
||||
#
|
||||
# model override functionality, currently only available for
|
||||
# Mustek devices, using NSCs' vendor ID: 0x0400 and
|
||||
# also their product ID: 0x1000 (LM9831) 0x1001 (LM9832)
|
||||
#
|
||||
# mov/PID | 0x1000 | 0x1001
|
||||
# ---------------------------------------
|
||||
# 0 (default)| BearPaw1200 | BearPaw 2400
|
||||
# 1 | ignored | BearPaw 1200
|
||||
#
|
||||
option mov 0
|
||||
|
||||
#
|
||||
# and of course the device-name
|
||||
#
|
||||
|
|
|
@ -43,6 +43,9 @@
|
|||
* - 0.46 - flag initialized is now used as device index
|
||||
* - added calFile to Plustek_Device
|
||||
* - removed _OPT_HALFTONE
|
||||
* - 0.47 - added mov to adjustment
|
||||
* - changed stopScan function definition
|
||||
* - removed open function
|
||||
* .
|
||||
* <hr>
|
||||
* This file is part of the SANE package.
|
||||
|
@ -233,6 +236,7 @@ typedef struct {
|
|||
/** for adjusting the scanner settings
|
||||
*/
|
||||
typedef struct {
|
||||
int mov; /**< model override */
|
||||
int lampOff;
|
||||
int lampOffOnEnd;
|
||||
int warmup;
|
||||
|
@ -263,7 +267,6 @@ typedef struct {
|
|||
double ggamma;
|
||||
double bgamma;
|
||||
|
||||
|
||||
double graygamma;
|
||||
|
||||
} AdjDef, *pAdjDef;
|
||||
|
@ -340,7 +343,6 @@ typedef struct Plustek_Device
|
|||
/*
|
||||
* each device we support may need other access functions...
|
||||
*/
|
||||
int (*open) ( const char*, void* );
|
||||
int (*close) ( struct Plustek_Device* );
|
||||
void (*shutdown) ( struct Plustek_Device* );
|
||||
int (*getCaps) ( struct Plustek_Device* );
|
||||
|
@ -349,7 +351,7 @@ typedef struct Plustek_Device
|
|||
int (*setMap) ( struct Plustek_Device*, SANE_Word*,
|
||||
SANE_Word, SANE_Word );
|
||||
int (*startScan) ( struct Plustek_Device* );
|
||||
int (*stopScan) ( struct Plustek_Device*, int* );
|
||||
int (*stopScan) ( struct Plustek_Device* );
|
||||
int (*prepare) ( struct Plustek_Device*, SANE_Byte* );
|
||||
int (*readLine) ( struct Plustek_Device* );
|
||||
|
||||
|
@ -395,7 +397,7 @@ typedef struct Plustek_Scanner
|
|||
typedef struct {
|
||||
|
||||
char devName[PATH_MAX];
|
||||
char usbId[_MAX_ID_LEN];
|
||||
char usbId[_MAX_ID_LEN];
|
||||
|
||||
/* contains the stuff to adjust... */
|
||||
AdjDef adj;
|
||||
|
|
Ładowanie…
Reference in New Issue