added Canon D660U support, cleanup, bug-fixing.

merge-requests/1/head
Gerhard Jaeger 2004-04-04 13:56:46 +00:00
rodzic dc125d1479
commit 68aa020c41
8 zmienionych plików z 938 dodań i 551 usunięć

Wyświetl plik

@ -152,10 +152,10 @@ static void usb_initDev( pPlustek_Device dev, int idx, int handle, int vendor )
u_short tmp = 0;
DBG( _DBG_INFO, "usb_initDev(%d,0x%04x,%i)\n",
idx, vendor, dev->initialized );
idx, vendor, dev->initialized );
/* save capability flags... */
if( dev->initialized >= 0 ) {
tmp = DEVCAPSFLAG_TPA;
tmp = DEVCAPSFLAG_TPA;
}
/* copy the original values... */
@ -189,7 +189,7 @@ static void usb_initDev( pPlustek_Device dev, int idx, int handle, int vendor )
dev->usbDev.Caps.workaroundFlag |= _WAF_INV_NEGATIVE_MAP;
DBG( _DBG_INFO, "Device WAF: 0x%08lx\n", dev->usbDev.Caps.workaroundFlag );
/* adjust data origin
*/
dev->usbDev.Caps.Positive.DataOrigin.x -= dev->adj.tpa.x;
@ -222,6 +222,18 @@ static void usb_initDev( pPlustek_Device dev, int idx, int handle, int vendor )
if( dev->adj.graygamma == 1.0 )
dev->adj.graygamma = dev->usbDev.HwSetting.gamma;
/* FIXME: not needed here??? */
#if 0
if( dev->adj.rlampoff > 0 )
dev->usbDev.HwSetting.red_lamp_off = dev->adj.rlampoff;
if( dev->adj.glampoff > 0 )
dev->usbDev.HwSetting.green_lamp_off = dev->adj.glampoff;
if( dev->adj.blampoff > 0 )
dev->usbDev.HwSetting.blue_lamp_off = dev->adj.blampoff;
#endif
/* the following you normally get from the registry...
*/
bMaxITA = 0; /* Maximum integration time adjust */
@ -247,20 +259,19 @@ static void usb_initDev( pPlustek_Device dev, int idx, int handle, int vendor )
if( t & 0x02 ) {
DBG( _DBG_INFO, "TPA detected\n" );
dev->usbDev.Caps.wFlags |= DEVCAPSFLAG_TPA;
dev->usbDev.Caps.wFlags |= DEVCAPSFLAG_TPA;
} else
DBG( _DBG_INFO, "TPA NOT detected\n" );
if( dev->adj.enableTpa ) {
DBG( _DBG_INFO, "Enabled TPA for EPSON (override)\n" );
dev->usbDev.Caps.wFlags |= DEVCAPSFLAG_TPA;
}
}
dev->usbDev.Caps.wFlags |= DEVCAPSFLAG_TPA;
}
}
/*
* well now we patch the vendor string...
* if not found, the default vendor will be Plustek
*/
/* well now we patch the vendor string...
* if not found, the default vendor will be Plustek
*/
for( i = 0; usbVendors[i].desc != NULL; i++ ) {
if( usbVendors[i].id == vendor ) {
@ -285,10 +296,10 @@ static void usb_initDev( pPlustek_Device dev, int idx, int handle, int vendor )
sParam.bDataType = SCANDATATYPE_Color;
sParam.bSource = SOURCE_Reflection;
sParam.Origin.x = 0;
sParam.Origin.y = 0;
sParam.Origin.y = 0;
sParam.siThreshold = 0;
sParam.UserDpi.x = 150;
sParam.UserDpi.y = 150;
sParam.UserDpi.y = 150;
sParam.dMCLK = 4;
sParam.Size.dwPixels = 0;
@ -416,9 +427,9 @@ static void usbDev_shutdown( Plustek_Device *dev )
if( 0 != dev->usbDev.bLampOffOnEnd ) {
DBG( _DBG_INFO, "Switching lamp off...\n" );
DBG( _DBG_INFO, "Switching lamp off...\n" );
usb_LampOn( dev, SANE_FALSE, SANE_FALSE );
}
}
dev->fd = -1;
sanei_usb_close( handle );
@ -782,8 +793,10 @@ static int usbDev_setScanEnv( Plustek_Device *dev, pScanInfo si )
/* clear all the stuff */
memset( &dev->scanning, 0, sizeof(ScanDef));
if( si->ImgDef.dwFlag & SCANDEF_Adf && si->ImgDef.dwFlag & SCANDEF_ContinuousScan)
if((si->ImgDef.dwFlag & SCANDEF_Adf) &&
(si->ImgDef.dwFlag & SCANDEF_ContinuousScan)) {
dev->scanning.sParam.dMCLK = dMCLK_ADF;
}
/* Save necessary informations */
dev->scanning.fGrayFromColor = 0;
@ -791,12 +804,25 @@ static int usbDev_setScanEnv( Plustek_Device *dev, pScanInfo si )
if( si->ImgDef.wDataType == COLOR_256GRAY ) {
if( !(si->ImgDef.dwFlag & SCANDEF_Adf ) &&
(dev->usbDev.Caps.OpticDpi.x == 1200 && si->ImgDef.xyDpi.x <= 300)) {
(dev->usbDev.Caps.OpticDpi.x == 1200 && si->ImgDef.xyDpi.x <= 300)) {
dev->scanning.fGrayFromColor = 2;
si->ImgDef.wDataType = COLOR_TRUE24;
DBG( _DBG_INFO, "* Gray from color set!\n" );
}
if((dev->usbDev.vendor == 0x04A9) && (dev->usbDev.product == 0x2208)) {
DBG( _DBG_INFO, "* Gray(GRAY256) from color set (D660U)!\n" );
dev->scanning.fGrayFromColor = 2;
si->ImgDef.wDataType = COLOR_TRUE24;
}
} else if ( si->ImgDef.wDataType == COLOR_GRAY16 ) {
if((dev->usbDev.vendor == 0x04A9) && (dev->usbDev.product == 0x2208)) {
DBG( _DBG_INFO, "* Gray(GRAY16) from color set (D660U)!\n" );
dev->scanning.fGrayFromColor = 2;
si->ImgDef.wDataType = COLOR_TRUE48;
}
}
usb_SaveImageInfo( dev, &si->ImgDef );
@ -920,15 +946,14 @@ static int usbDev_stopScan( Plustek_Device *dev )
dev->scanning.pScanBuffer = NULL;
usb_StartLampTimer( dev );
}
return 0;
return 0;
}
/**
*/
static int usbDev_startScan( Plustek_Device *dev )
{
pScanDef scanning = &dev->scanning;
pScanDef scanning = &dev->scanning;
static int iSkipLinesForADF = 0;
DBG( _DBG_INFO, "usbDev_startScan()\n" );
@ -944,7 +969,7 @@ static int usbDev_startScan( Plustek_Device *dev )
/* Allocate shading buffer */
if((dev->scanning.dwFlag & SCANDEF_Adf) &&
(dev->scanning.dwFlag & SCANDEF_ContinuousScan)) {
(dev->scanning.dwFlag & SCANDEF_ContinuousScan)) {
dev->scanning.fCalibrated = SANE_TRUE;
} else {
@ -968,7 +993,6 @@ static int usbDev_startScan( Plustek_Device *dev )
usb_StopLampTimer( dev );
return 0;
}
return _E_ALLOC;
}
@ -979,10 +1003,11 @@ static int usbDev_startScan( Plustek_Device *dev )
*/
static int usbDev_Prepare( struct Plustek_Device *dev, SANE_Byte *buf )
{
int result;
pScanDef scanning = &dev->scanning;
pDCapsDef scaps = &dev->usbDev.Caps;
pHWDef hw = &dev->usbDev.HwSetting;
int result;
SANE_Bool use_alt_cal = SANE_FALSE;
pScanDef scanning = &dev->scanning;
pDCapsDef scaps = &dev->usbDev.Caps;
pHWDef hw = &dev->usbDev.HwSetting;
DBG( _DBG_INFO, "usbDev_PrepareScan()\n" );
@ -995,20 +1020,28 @@ static int usbDev_Prepare( struct Plustek_Device *dev, SANE_Byte *buf )
if((dev->usbDev.vendor == 0x04A9) &&
(dev->usbDev.product==0x2206 || dev->usbDev.product==0x2207 ||
dev->usbDev.product==0x220D || dev->usbDev.product==0x220E)) {
result = cano_DoCalibration( dev );
use_alt_cal = SANE_TRUE;
} else {
if( dev->adj.altCalibrate ) {
result = cano_DoCalibration( dev );
} else {
result = usb_DoCalibration( dev );
}
if( dev->adj.altCalibrate )
use_alt_cal = SANE_TRUE;
}
if( SANE_TRUE != result ) {
/* for the skip functionality use the "old" calibration functions */
if( dev->usbDev.Caps.workaroundFlag & _WAF_BYPASS_CALIBRATION ) {
use_alt_cal = SANE_FALSE;
}
if( use_alt_cal ) {
result = cano_DoCalibration( dev );
} else {
result = usb_DoCalibration( dev );
}
if( SANE_TRUE != result ) {
DBG( _DBG_INFO, "calibration failed!!!\n" );
return result;
return result;
}
if( dev->adj.cacheCalData )
@ -1025,22 +1058,22 @@ static int usbDev_Prepare( struct Plustek_Device *dev, SANE_Byte *buf )
return 0;
}
/*
* if we bypass the calibration step, we wait on lamp warmup here...
*/
if( scaps->workaroundFlag & _WAF_BYPASS_CALIBRATION ) {
if( !usb_Wait4Warmup( dev )) {
DBG( _DBG_INFO, "ReadImage() - Cancel detected...\n" );
return 0;
}
}
/*
* if we bypass the calibration step, we wait on lamp warmup here...
*/
if( scaps->workaroundFlag & _WAF_BYPASS_CALIBRATION ) {
if( !usb_Wait4Warmup( dev )) {
DBG( _DBG_INFO, "usbDev_Prepare() - Cancel detected...\n" );
return 0;
}
}
scanning->pbScanBufBegin = scanning->pScanBuffer;
scanning->pbScanBufBegin = scanning->pScanBuffer;
if((dev->caps.dwFlag & SFLAG_ADF) && (scaps->OpticDpi.x == 600))
scanning->dwLinesScanBuf = 8;
else
scanning->dwLinesScanBuf = 32;
if((dev->caps.dwFlag & SFLAG_ADF) && (scaps->OpticDpi.x == 600))
scanning->dwLinesScanBuf = 8;
else
scanning->dwLinesScanBuf = 32;
/* gives faster feedback to the frontend ! */
scanning->dwLinesScanBuf = 2;

Wyświetl plik

@ -222,7 +222,7 @@ enum _DEVCAPSFLAG
enum _WORKAROUNDS
{
_WAF_NONE = 0x00000000, /* no fix anywhere needed */
_WAF_BSHIFT7_BUG = 0x00000001, /* to fix U12 bug in 14bit mode */
_WAF_BSHIFT7_BUG = 0x00000001, /* to fix U12 bug in 14bit mode */
_WAF_MISC_IO_LAMPS = 0x00000002, /* special lamp switching */
_WAF_BLACKFINE = 0x00000004, /* use black calibration strip */
_WAF_BYPASS_CALIBRATION = 0x00000008, /* no calibration,use linear gamma */
@ -258,14 +258,15 @@ typedef enum
MODEL_KaoHsiung = 0,
MODEL_HuaLien,
MODEL_Tokyo600,
MODEL_EPSON, /**< for EPSON1250/1260 */
MODEL_MUSTEK600, /**< for BearPaw 1200 */
MODEL_MUSTEK1200, /**< for BearPaw 2400 */
MODEL_HP, /**< for HP2x00 */
MODEL_CANON600 , /**< for CanoScan 600dpi models */
MODEL_CANON1200, /**< for Canon 1200dpi models */
MODEL_UMAX, /**< for UMAX 3400/3450 */
MODEL_UMAX1200, /**< for UMAX 5400 */
MODEL_EPSON, /**< for EPSON1250/1260 */
MODEL_MUSTEK600, /**< for BearPaw 1200 */
MODEL_MUSTEK1200, /**< for BearPaw 2400 */
MODEL_HP, /**< for HP2x00 */
MODEL_CANON600 , /**< for CanoScan 600dpi models */
MODEL_CANON1200, /**< for Canon 1200dpi models */
MODEL_CANONCCD1200, /**< for Canon CCD 1200dpi models */
MODEL_UMAX, /**< for UMAX 3400/3450 */
MODEL_UMAX1200, /**< for UMAX 5400 */
MODEL_LAST
} eModelDef;

Wyświetl plik

@ -44,6 +44,7 @@
* - 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"
* - added CanoScan D660U
* .
* <hr>
* This file is part of the SANE package.
@ -343,7 +344,7 @@ static DCapsDef Cap0x07B3_0x0010_4 =
12, 0, kNEC3778, 0x00, _WAF_NONE, _NO_MIO
};
/* Plustek Model: ???
/* Plustek Model: UA18?
* KH: NS9831 + TPA + Button + NEC3778
*/
static DCapsDef Cap0x07B3_0x000F_4 =
@ -385,7 +386,7 @@ static DCapsDef Cap0x07B3_0x0017_4 =
{1200, 1200},
DEVCAPSFLAG_Positive + DEVCAPSFLAG_Negative,
SENSORORDER_rgb,
12, 4, kNEC3778, 0x07, _WAF_NONE, _NO_MIO
12, 4, kNEC3778, 0x07, _WAF_NONE, _NO_MIO
};
/* Plustek Model: ???
@ -607,18 +608,18 @@ static DCapsDef Cap0x1606_0x0160 =
*/
static DCapsDef Cap0x04A9_0x2206 =
{
{{ 0, 90}, 35, 10, {2550, 3508}, {75, 75}, COLOR_GRAY16 },
{{ 0, 0}, 0, 0, {0, 0}, { 0, 0 }, 0 },
{{ 0, 0}, 0, 0, {0, 0}, { 0, 0 }, 0 },
{{ 0, 0}, 0, 0, {0, 0}, { 0, 0 }, 0 },
{600, 600},
0,
SENSORORDER_rgb,
8, /* sensor distance */
1, /* number of buttons */
kCIS650, /* use default settings during calibration */
0, /* not used here... */
_WAF_MISC_IO_LAMPS | _WAF_BLACKFINE, _NO_MIO
{{ 0, 90}, 35, 10, {2550, 3508}, {75, 75}, COLOR_GRAY16 },
{{ 0, 0}, 0, 0, {0, 0}, { 0, 0 }, 0 },
{{ 0, 0}, 0, 0, {0, 0}, { 0, 0 }, 0 },
{{ 0, 0}, 0, 0, {0, 0}, { 0, 0 }, 0 },
{600, 600},
0,
SENSORORDER_rgb,
8, /* sensor distance */
1, /* number of buttons */
kCIS650, /* use default settings during calibration */
0, /* not used here... */
_WAF_MISC_IO_LAMPS | _WAF_BLACKFINE, _NO_MIO
};
/* Canon N1220U
@ -626,17 +627,35 @@ static DCapsDef Cap0x04A9_0x2206 =
static DCapsDef Cap0x04A9_0x2207 =
{
{{ 0, 85}, 35, 10, {2550, 3508}, {75, 75}, COLOR_BW },
{{ 0, 0}, 0, 0, {0, 0}, { 0, 0 }, 0 },
{{ 0, 0}, 0, 0, {0, 0}, { 0, 0 }, 0 },
{{ 0, 0}, 0, 0, {0, 0}, { 0, 0 }, 0 },
{1200, 1200},
0,
SENSORORDER_rgb,
16, /* sensor distance */
1, /* number of buttons */
kCIS1220, /* use default settings during calibration */
0, /* not used here... */
_WAF_MISC_IO_LAMPS | _WAF_BLACKFINE, _NO_MIO
{{ 0, 0}, 0, 0, {0, 0}, { 0, 0 }, 0 },
{{ 0, 0}, 0, 0, {0, 0}, { 0, 0 }, 0 },
{{ 0, 0}, 0, 0, {0, 0}, { 0, 0 }, 0 },
{1200, 1200},
0,
SENSORORDER_rgb,
16, /* sensor distance */
1, /* number of buttons */
kCIS1220, /* use default settings during calibration */
0, /* not used here... */
_WAF_MISC_IO_LAMPS | _WAF_BLACKFINE, _NO_MIO
};
/* Canon D660U
*/
static DCapsDef Cap0x04A9_0x2208 =
{
{{ 45, 125}, 15, -1, {2550, 3508}, { 50, 50}, COLOR_BW },
{{1060, 744}, 510, -1, { 473, 414}, {150, 150}, COLOR_GRAY16 },
{{1082, 842}, 610, -1, { 567, 414}, {150, 150}, COLOR_GRAY16 },
{{ 0, 0}, 0, 0, { 0, 0}, { 0, 0}, 0 },
{600, 600},
DEVCAPSFLAG_Positive + DEVCAPSFLAG_Negative,
SENSORORDER_rgb,
4,
1,
kNEC8861, /* use default settings during calibration */
0,
_WAF_MISC_IO_LAMPS, _MIO5 + _TPA(_MIO6)
};
/* Canon N670U/N676U/LiDE20
@ -662,17 +681,17 @@ static DCapsDef Cap0x04A9_0x220D =
static DCapsDef Cap0x04A9_0x220E =
{
{{ 0, 100}, 50, 10, {2550, 3508}, {75, 75}, COLOR_BW },
{{ 0, 0}, 0, 0, {0, 0}, { 0, 0 }, 0 },
{{ 0, 0}, 0, 0, {0, 0}, { 0, 0 }, 0 },
{{ 0, 0}, 0, 0, {0, 0}, { 0, 0 }, 0 },
{1200, 1200},
0,
SENSORORDER_rgb,
16, /* sensor distance */
3, /* number of buttons */
kCIS1240, /* use default settings during calibration */
0, /* not used here... */
_WAF_MISC_IO_LAMPS | _WAF_BLACKFINE, _NO_MIO
{{ 0, 0}, 0, 0, {0, 0}, { 0, 0 }, 0 },
{{ 0, 0}, 0, 0, {0, 0}, { 0, 0 }, 0 },
{{ 0, 0}, 0, 0, {0, 0}, { 0, 0 }, 0 },
{1200, 1200},
0,
SENSORORDER_rgb,
16, /* sensor distance */
3, /* number of buttons */
kCIS1240, /* use default settings during calibration */
0, /* not used here... */
_WAF_MISC_IO_LAMPS | _WAF_BLACKFINE, _NO_MIO
};
/******************* additional Hardware descriptions ************************/
@ -1728,14 +1747,14 @@ static HWDef Hw0x04B8_0x011D =
{0x02, 0x07, 0x00, 0x01, 0x04, 0x07, 0x00, 0x00, 0x03, 0x07},
/* ok mono (reg 0x0f to 0x18) */
{0x06, 0x0b, 0x00, 0x05, 0x0c, 0x17, 0x00, 0x00, 0x0a, 0x17},
{0x06, 0x0b, 0x00, 0x05, 0x0c, 0x17, 0x00, 0x00, 0x0a, 0x17},
/* ok color (reg 0x0f to 0x18) */
_GREEN_CH, /* ok bReg_0x26 color mode - bits 4 and 5 */
0x42, /* ok bReg 0x27 color mode */
3, /* 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 },
_GREEN_CH, /* ok bReg_0x26 color mode - bits 4 and 5 */
0x42, /* ok bReg 0x27 color mode */
3, /* 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 },
1, /* ok StepperPhaseCorrection (reg 0x1a + 0x1b) */
0x00, /* ok bOpticBlackStart (reg 0x1c) */
@ -1796,12 +1815,12 @@ static HWDef Hw0x1606_0x0060 =
{0x01, 0x0c, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x16, 0x0c},
/* color (reg 0x0f to 0x18) */
_GREEN_CH, /* bReg_0x26 color mode - bits 4 and 5 */
0x40, /* 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 },
_GREEN_CH, /* bReg_0x26 color mode - bits 4 and 5 */
0x40, /* 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 },
1, /* StepperPhaseCorrection (reg 0x1a + 0x1b) */
0x2f, /* bOpticBlackStart (reg 0x1c) */
@ -1834,8 +1853,8 @@ static HWDef Hw0x1606_0x0060 =
0, /* test mode ADC Output CODE LSB (reg 0x5d) */
0, /* test mode (reg 0x5e) */
_LM9832, /* might be LM9831 on UMAX 3450! */
MODEL_UMAX,
1.0
MODEL_UMAX,
1.0
};
/** Umax 5400 */
@ -1862,12 +1881,12 @@ static HWDef Hw0x1606_0x0160 =
{0x01, 0x0c, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x16, 0x0c},
/* color (reg 0x0f to 0x18) */
_GREEN_CH, /* bReg_0x26 color mode - bits 4 and 5 */
0x40, /* 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 },
_GREEN_CH, /* bReg_0x26 color mode - bits 4 and 5 */
0x40, /* 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 },
1, /* StepperPhaseCorrection (reg 0x1a + 0x1b) */
20, /* bOpticBlackStart (reg 0x1c) */
@ -1900,8 +1919,8 @@ static HWDef Hw0x1606_0x0160 =
0, /* test mode ADC Output CODE LSB (reg 0x5d) */
0, /* test mode (reg 0x5e) */
_LM9832,
MODEL_UMAX1200,
1.0
MODEL_UMAX1200,
1.0
};
/** Canon 650/656 */
@ -1924,18 +1943,18 @@ static HWDef Hw0x04A9_0x2206 =
0x00, /* sensor control settings (reg 0x0e) */
/* mono & color (reg 0x0f to 0x18) the
same for CIS devices */
same for CIS devices */
{0x00, 0x00, 0x04, 0x05, 0x06, 0x07, 0x00, 0x00, 0x00, 0x05},
{0x00, 0x00, 0x04, 0x05, 0x06, 0x07, 0x00, 0x00, 0x00, 0x05},
{0x00, 0x00, 0x04, 0x05, 0x06, 0x07, 0x00, 0x00, 0x00, 0x05},
{0x00, 0x00, 0x04, 0x05, 0x06, 0x07, 0x00, 0x00, 0x00, 0x05},
(_BLUE_CH | _ONE_CH_COLOR), /* bReg_0x26 color mode */
(_BLUE_CH | _ONE_CH_COLOR), /* bReg_0x26 color mode */
0x00, /* bReg 0x27 color mode */
2, /* bReg 0x29 illumination mode (runtime) */
/* illumination mode settings */
{ 3, 0, 0, 23, 1300, 0, 0 },
{ 2, 23, 4000, 23, 2600, 23, 850 },
0x00, /* bReg 0x27 color mode */
2, /* bReg 0x29 illumination mode (runtime) */
/* illumination mode settings */
{ 3, 0, 0, 23, 1300, 0, 0 },
{ 2, 23, 4000, 23, 2600, 23, 850 },
1, /* StepperPhaseCorrection (reg 0x1a + 0x1b) */
0, /* bOpticBlackStart (reg 0x1c) */
@ -1968,8 +1987,8 @@ static HWDef Hw0x04A9_0x2206 =
0, /* test mode ADC Output CODE LSB (reg 0x5d) */
0, /* test mode (reg 0x5e) */
_LM9832,
MODEL_CANON600,
2.0
MODEL_CANON600,
2.0
};
/** Canon N1220U */
@ -2001,8 +2020,8 @@ static HWDef Hw0x04A9_0x2207 =
0x00, /* bReg 0x27 color mode */
2, /* bReg 0x29 illumination mode */
{ 3, 0, 0, 23, 4950, 0, 0 },
{ 2, 23, 16383, 23, 15000, 23, 6600 },
{ 3, 0, 0, 23, 4950, 0, 0 },
{ 2, 23, 16383, 23, 15000, 23, 6600 },
1, /* StepperPhaseCorrection (reg 0x1a + 0x1b) */
0, /* bOpticBlackStart (reg 0x1c) */
@ -2036,7 +2055,72 @@ static HWDef Hw0x04A9_0x2207 =
0, /* test mode (reg 0x5e) */
_LM9832,
MODEL_CANON1200,
2.0
2.0
};
/** Canon D660U */
static HWDef Hw0x04A9_0x2208 =
{
1.2, /* dMaxMotorSpeed (Max_Speed) */
1.1, /* dMaxMoveSpeed (Max_Speed) */
9, /* dIntegrationTimeLowLamp */
9, /* dIntegrationTimeHighLamp */
300, /* wMotorDpi (Full step DPI) */
512, /* wRAMSize (KB) */
8, /* dMinIntegrationTimeLowres (ms) */
8, /* dMinIntegrationTimeHighres (ms) */
4095, /* wGreenPWMDutyCycleLow (reg 0x2a + 0x2b) */
4095, /* wGreenPWMDutyCycleHigh (reg 0x2a + 0x2b) */
0x02, /* bSensorConfiguration (0x0b) */
0x60, /* sensor control settings (reg 0x0c) */
0x2f, /* sensor control settings (reg 0x0d) */
0x13, /* sensor control settings (reg 0x0e) */
#if 0
{0x02, 0x07, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x0b },
#endif
{0x06, 0x17, 0x01, 0x03, 0x05, 0x07, 0x00, 0x00, 0x0b },
{0x06, 0x17, 0x01, 0x03, 0x05, 0x07, 0x00, 0x00, 0x0b },
_GREEN_CH,
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 },
0, /* StepperPhaseCorrection (reg 0x1a + 0x1b) */
13, /* bOpticBlackStart (reg 0x1c) */
33, /* bOpticBlackEnd (reg 0x1d) */
64, /* wActivePixelsStart (reg 0x1e + 0x1f) */
5440, /* wLineEnd (reg 0x20 + 0x21) */
16383, /* red lamp on (reg 0x2c + 0x2d) */
1, /* 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) */
0, /* blue lamp off (reg 0x36 + 0x37) */
3, /* stepper motor control (reg 0x45) */
0, /* wStepsAfterPaperSensor2 (reg 0x4c + 0x4d) */
0x20, /* steps to reverse when buffer is full reg 0x50) */
0xfc, /* acceleration profile (reg 0x51) */
0, /* lines to process (reg 0x54) */
0, /* kickstart (reg 0x55) */
0x02, /* pwm freq (reg 0x56) */
0x1f, /* pwm duty cycle (reg 0x57) */
0x05, /* Paper sense (reg 0x58) */
0x44, /* misc io12 (reg 0x59) */
0x14, /* misc io34 (reg 0x5a) */
0x11, /* misc io56 (reg 0x5b) */
0, /* test mode ADC Output CODE MSB (reg 0x5c) */
0, /* test mode ADC Output CODE LSB (reg 0x5d) */
0, /* test mode (reg 0x5e) */
_LM9832,
MODEL_CANONCCD1200,
1.0
};
/** Canon 670/676/LiDE20 */
@ -2058,19 +2142,19 @@ static HWDef Hw0x04A9_0x220D =
0x2f, /* sensor control settings (reg 0x0d) */
0x00, /* sensor control settings (reg 0x0e) */
{0x00, 0x00, 0x04, 0x05, 0x06, 0x07, 0x00, 0x00, 0x00, 0x05},
{0x00, 0x00, 0x04, 0x05, 0x06, 0x07, 0x00, 0x00, 0x00, 0x05},
/* mono (reg 0x0f to 0x18) */
{0x00, 0x00, 0x04, 0x05, 0x06, 0x07, 0x00, 0x00, 0x00, 0x05},
{0x00, 0x00, 0x04, 0x05, 0x06, 0x07, 0x00, 0x00, 0x00, 0x05},
/* color (reg 0x0f to 0x18) */
(_BLUE_CH | _ONE_CH_COLOR), /* bReg_0x26 color mode */
(_BLUE_CH | _ONE_CH_COLOR), /* bReg_0x26 color mode */
0x00, /* bReg 0x27 color mode */
2, /* bReg 0x29 illumination mode (runtime) */
0x00, /* bReg 0x27 color mode */
2, /* bReg 0x29 illumination mode (runtime) */
{ 3, 0, 0, 23, 1800, 0, 0 },
{ 2, 23, 3800, 23, 3300, 23, 2700 },
{ 3, 0, 0, 23, 1800, 0, 0 },
{ 2, 23, 3800, 23, 3300, 23, 2700 },
1, /* StepperPhaseCorrection (reg 0x1a + 0x1b) */
0, /* bOpticBlackStart (reg 0x1c) */
@ -2103,8 +2187,8 @@ static HWDef Hw0x04A9_0x220D =
0, /* test mode ADC Output CODE LSB (reg 0x5d) */
0, /* test mode (reg 0x5e) */
_LM9833,
MODEL_CANON600,
2.0
MODEL_CANON600,
2.0
};
/** Canon N1240U */
@ -2172,7 +2256,7 @@ static HWDef Hw0x04A9_0x220E =
0, /* test mode (reg 0x5e) */
_LM9833,
MODEL_CANON1200,
2.0
2.0
};
/******************** all available combinations *****************************/
@ -2240,6 +2324,7 @@ static SetDef Settings[] =
/* CANON... */
{"0x04A9-0x2206", &Cap0x04A9_0x2206, &Hw0x04A9_0x2206, "N650U/N656U" },
{"0x04A9-0x2207", &Cap0x04A9_0x2207, &Hw0x04A9_0x2207, "N1220U" },
{"0x04A9-0x2208", &Cap0x04A9_0x2208, &Hw0x04A9_0x2208, "D660U" },
{"0x04A9-0x220D", &Cap0x04A9_0x220D, &Hw0x04A9_0x220D, "N670U/N676U/LiDE20" },
{"0x04A9-0x220E", &Cap0x04A9_0x220E, &Hw0x04A9_0x220E, "N1240U/LiDE30" },
@ -2426,6 +2511,26 @@ static ClkMotorDef Motors[] = {
{ 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 9.0, 9.0, 18.0, 18.0 },
{ 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 9.0, 9.0, 18.0, 18.0 }
},
{ MODEL_CANONCCD1200, 2, 31, 6,
/* Motor settings (PWM and PWM_Duty) */
/* <=75dpi <=100dpi <=150dpi <=200dpi <=300dpi */
{{ 2, 31, 1 }, { 2, 31, 1 }, { 2, 31, 1 }, { 2, 31, 1 }, { 2, 31, 1 },
/* <=400dpi <=600dpi <=800dpi <=1200dpi <=2400dpi */
{ 2, 31, 1 }, { 2, 31, 1 }, { 2, 31, 1 }, { 2, 31, 1 }, { 2, 31, 1 }},
/* Color mode MCLK settings */
#if 1
{ 2.0, 2.0, 2.0, 2.0, 2.0, 2.5, 3.0, 4.0, 6.0, 6.0 },
{ 2.0, 2.0, 2.0, 2.0, 3.0, 2.5, 3.0, 4.0, 6.0, 6.0 },
#else
{ 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0 },
{ 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 5.0, 6.0, 6.0, 6.0 },
#endif
/* Gray mode MCLK settings */
{ 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0 },
{ 6.5, 6.5, 6.0, 6.0, 6.0, 6.0, 8.0, 12.0, 12.0, 12.0 }
}
};
/* END PLUSTEK-USBDEVS.C ....................................................*/

Wyświetl plik

@ -32,6 +32,8 @@
* read back reg[0x29] to wrong position
* made it compile without itimer definitions
* - 0.47 - moved usb_HostSwap() and usb_Swap() to this file.
* - fixed lampOff timer for systems w/o setitimer
* - added lamp off adjustment for CIS devices
* .
* <hr>
* This file is part of the SANE package.
@ -741,12 +743,40 @@ static void usb_AdjustCISLampSettings( Plustek_Device *dev, SANE_Bool on )
if( !on ) {
hw->red_lamp_on = 16383;
hw->red_lamp_on = 0x3fff;
hw->red_lamp_off = 0;
hw->green_lamp_on = 16383;
hw->green_lamp_on = 0x3fff;
hw->green_lamp_off = 0;
hw->blue_lamp_on = 16383;
hw->blue_lamp_on = 0x3fff;
hw->blue_lamp_off = 0;
} else {
if( dev->adj.rlampoff > 0 ) {
hw->red_lamp_off = dev->adj.rlampoff;
if( hw->red_lamp_off > 0x3fff )
hw->red_lamp_off = 0x3fff;
DBG( _DBG_INFO2,
" * red_lamp_off adjusted: %u\n", hw->red_lamp_off );
}
if( dev->adj.glampoff > 0 ) {
hw->green_lamp_off = dev->adj.glampoff;
if( hw->green_lamp_off > 0x3fff )
hw->green_lamp_off = 0x3fff;
DBG( _DBG_INFO2,
" * green_lamp_off adjusted: %u\n", hw->green_lamp_off );
}
if( dev->adj.blampoff > 0 ) {
hw->blue_lamp_off = dev->adj.blampoff;
if( hw->blue_lamp_off > 0x3fff )
hw->blue_lamp_off = 0x3fff;
DBG( _DBG_INFO2,
" * blue_lamp_off adjusted: %u\n", hw->blue_lamp_off );
}
}
a_bRegs[0x29] = hw->bReg_0x29;
@ -880,7 +910,7 @@ static int usb_GetLampStatus( pPlustek_Device dev )
* used for all devices that use some misc I/O pins to switch the lamp
*/
static SANE_Bool usb_switchLampX( pPlustek_Device dev,
SANE_Bool on, SANE_Bool tpa )
SANE_Bool on, SANE_Bool tpa )
{
SANE_Byte reg, msk;
pDCapsDef sc = &dev->usbDev.Caps;
@ -890,21 +920,20 @@ static SANE_Bool usb_switchLampX( pPlustek_Device dev,
else
usb_GetLampRegAndMask( sc->lamp, &reg, &msk );
if( 0 == reg )
return SANE_FALSE; /* no need to switch something */
if( 0 == reg )
return SANE_FALSE; /* no need to switch something */
DBG( _DBG_INFO, "usb_switchLampX(ON=%u,TPA=%u)\n", on, tpa );
if( on )
a_bRegs[reg] |= msk;
else
else
a_bRegs[reg] &= ~msk;
DBG( _DBG_INFO, "Switch Lamp: %u, regs[0x%02x] = 0x%02x\n",
on, reg, a_bRegs[reg] );
usbio_WriteReg( dev->fd, reg, a_bRegs[reg] );
return SANE_TRUE;
on, reg, a_bRegs[reg] );
usbio_WriteReg( dev->fd, reg, a_bRegs[reg] );
return SANE_TRUE;
}
/** usb_switchLamp
@ -920,8 +949,7 @@ static SANE_Bool usb_switchLamp( pPlustek_Device dev, SANE_Bool on )
} else {
result = usb_switchLampX( dev, on, SANE_FALSE );
}
return result;
return result;
}
/** usb_LedOn
@ -951,20 +979,20 @@ static void usb_LedOn( pPlustek_Device dev, SANE_Bool fOn )
/** usb_LampOn
*/
static SANE_Bool usb_LampOn( pPlustek_Device dev,
SANE_Bool fOn, SANE_Bool fResetTimer )
SANE_Bool fOn, SANE_Bool fResetTimer )
{
pDCapsDef sc = &dev->usbDev.Caps;
pScanDef scanning = &dev->scanning;
pScanDef scanning = &dev->scanning;
pHWDef hw = &dev->usbDev.HwSetting;
int iLampStatus = usb_GetLampStatus( dev );
int lampId = -1;
struct timeval t;
struct timeval t;
if( NULL == scanning ) {
DBG( _DBG_ERROR, "NULL-Pointer detected: usb_LampOn()\n" );
return SANE_FALSE;
}
switch( scanning->sParam.bSource ) {
case SOURCE_Reflection:
@ -1010,7 +1038,7 @@ static SANE_Bool usb_LampOn( pPlustek_Device dev,
a_bRegs[0x36] = 16383 / 256;
a_bRegs[0x37] = 16383 % 256;
}
}
}
if( _WAF_MISC_IO_LAMPS & sc->workaroundFlag ) {
@ -1031,7 +1059,7 @@ static SANE_Bool usb_LampOn( pPlustek_Device dev,
}
sanei_lm983x_write( dev->fd, 0x29,
&a_bRegs[0x29], 0x37-0x29+1, SANE_TRUE );
&a_bRegs[0x29], 0x37-0x29+1, SANE_TRUE );
if( lampId != dev->usbDev.currentLamp ) {
@ -1042,10 +1070,10 @@ static SANE_Bool usb_LampOn( pPlustek_Device dev,
gettimeofday( &t, NULL );
dev->usbDev.dwTicksLampOn = t.tv_sec;
DBG( _DBG_INFO, "Warmup-Timer started\n" );
}
}
}
}
} else {
int iStatusChange = iLampStatus & ~lampId;
@ -1066,9 +1094,9 @@ static SANE_Bool usb_LampOn( pPlustek_Device dev,
if( iStatusChange & DEV_LampTPA ) {
a_bRegs[0x36] = 16383 / 256;
a_bRegs[0x37] = 16383 % 256;
}
}
}
if( _WAF_MISC_IO_LAMPS & sc->workaroundFlag ) {
a_bRegs[0x2c] = hw->red_lamp_on / 256;
@ -1088,7 +1116,7 @@ static SANE_Bool usb_LampOn( pPlustek_Device dev,
}
sanei_lm983x_write( dev->fd, 0x29,
&a_bRegs[0x29], 0x37-0x29+1, SANE_TRUE );
&a_bRegs[0x29], 0x37-0x29+1, SANE_TRUE );
}
}
@ -1100,8 +1128,7 @@ static SANE_Bool usb_LampOn( pPlustek_Device dev,
return SANE_TRUE;
}
/**
* Function to preset the registers for the specific device, which
/** Function to preset the registers for the specific device, which
* should never change during the whole operation
* Affected registers:<br>
* 0x0b - 0x0e - Sensor settings - directly from the HWDef<br>
@ -1223,50 +1250,57 @@ static SANE_Bool usb_ModuleStatus( pPlustek_Device dev )
return SANE_FALSE;
}
/* HEINER: replace!!! */
static pPlustek_Device dev_xxx = NULL;
/**
* ISR to switch lamp off after time has elapsed
*/
static void usb_LampTimerIrq( int sig )
static void usb_LampSwitch( Plustek_Device *dev, SANE_Bool sw )
{
int handle = -1;
if( -1 == dev->fd ) {
if( SANE_STATUS_GOOD == sanei_usb_open(dev->sane.name, &handle)) {
dev->fd = handle;
}
}
/* needs to be recalibrated */
dev->scanning.fCalibrated = SANE_FALSE;
if( -1 != dev->fd )
usb_LampOn( dev, sw, SANE_FALSE );
if( -1 != handle ) {
dev->fd = -1;
sanei_usb_close( handle );
}
}
/* HEINER: replace!!! */
static pPlustek_Device dev_xxx = NULL;
/** ISR to switch lamp off after time has elapsed
*/
static void usb_LampTimerIrq( int sig )
{
if( NULL == dev_xxx )
return;
_VAR_NOT_USED( sig );
DBG( _DBG_INFO, "LAMP OFF!!!\n" );
if( -1 == dev_xxx->fd ) {
if( SANE_STATUS_GOOD == sanei_usb_open(dev_xxx->sane.name, &handle)) {
dev_xxx->fd = handle;
}
}
/* needs to be recalibrated */
dev_xxx->scanning.fCalibrated = SANE_FALSE;
if( -1 != dev_xxx->fd )
usb_LampOn( dev_xxx, SANE_FALSE, SANE_FALSE );
if( -1 != handle ) {
dev_xxx->fd = -1;
sanei_usb_close( handle );
}
usb_LampSwitch( dev_xxx, SANE_FALSE );
}
/** usb_StartLampTimer
*/
static void usb_StartLampTimer( pPlustek_Device dev )
{
#ifdef HAVE_SETITIMER
sigset_t block, pause_mask;
struct sigaction s;
#ifdef HAVE_SETITIMER
struct itimerval interval;
#endif
/* block SIGALRM */
sigemptyset( &block );
sigaddset ( &block, SIGALRM );
@ -1278,30 +1312,29 @@ static void usb_StartLampTimer( pPlustek_Device dev )
s.sa_flags = 0;
s.sa_handler = usb_LampTimerIrq;
if( sigaction( SIGALRM, &s, NULL ) < 0 )
if( sigaction( SIGALRM, &s, NULL ) < 0 )
DBG( _DBG_ERROR, "Can't setup timer-irq handler\n" );
sigprocmask( SIG_UNBLOCK, &block, &pause_mask );
/*
* define a one-shot timer
*/
#ifdef HAVE_SETITIMER
/* define a one-shot timer */
interval.it_value.tv_usec = 0;
interval.it_value.tv_sec = dev->usbDev.dwLampOnPeriod;
interval.it_interval.tv_usec = 0;
interval.it_interval.tv_sec = 0;
dev_xxx = dev;
if( 0 != dev->usbDev.dwLampOnPeriod ) {
dev_xxx = dev;
setitimer( ITIMER_REAL, &interval, &dev->saveSettings );
DBG( _DBG_INFO, "Lamp-Timer started\n" );
DBG( _DBG_INFO, "Lamp-Timer started (using ITIMER)\n" );
}
#else
dev_xxx = dev;
alarm( dev->usbDev.dwLampOnPeriod );
DBG( _DBG_INFO, "Lamp-Timer not available on this plattform\n" );
if( 0 != dev->usbDev.dwLampOnPeriod ) {
dev_xxx = dev;
alarm( dev->usbDev.dwLampOnPeriod );
DBG( _DBG_INFO, "Lamp-Timer started (using ALARM)\n" );
}
#endif
}
@ -1309,27 +1342,23 @@ static void usb_StartLampTimer( pPlustek_Device dev )
*/
static void usb_StopLampTimer( pPlustek_Device dev )
{
#ifdef HAVE_SETITIMER
sigset_t block, pause_mask;
/* block SIGALRM */
sigemptyset( &block );
sigaddset ( &block, SIGALRM );
sigprocmask( SIG_BLOCK, &block, &pause_mask );
dev_xxx = NULL;
#ifdef HAVE_SETITIMER
if( 0 != dev->usbDev.dwLampOnPeriod )
setitimer( ITIMER_REAL, &dev->saveSettings, NULL );
dev_xxx = NULL;
DBG( _DBG_INFO, "Lamp-Timer stopped\n" );
#else
_VAR_NOT_USED( dev );
dev_xxx = NULL;
alarm( 0 );
#endif
DBG( _DBG_INFO, "Lamp-Timer stopped\n" );
}
/**
@ -1360,7 +1389,7 @@ static SANE_Bool usb_IsEscPressed( void )
static SANE_Bool usb_Wait4Warmup( pPlustek_Device dev )
{
u_long dw;
struct timeval t;
struct timeval t;
pHWDef hw = &dev->usbDev.HwSetting;
@ -1369,7 +1398,7 @@ static SANE_Bool usb_Wait4Warmup( pPlustek_Device dev )
return SANE_TRUE;
}
/*
/*
* wait until warmup period has been elapsed
*/
gettimeofday( &t, NULL);

Wyświetl plik

@ -333,7 +333,6 @@ static int usb_GetScaler( pScanDef scanning )
}
/**
*
*/
static void usb_ColorScaleGray( struct Plustek_Device *dev )
{
@ -487,8 +486,100 @@ static void usb_ColorScaleGray_2( struct Plustek_Device *dev )
}
}
/*.............................................................................
* here we copy and scale from scanner world to user world...
/**
*/
static void usb_ColorScaleGray16( struct Plustek_Device *dev )
{
u_char ls;
int izoom, ddax;
u_long dw;
SANE_Bool swap = usb_HostSwap();
pScanDef scanning = &dev->scanning;
usb_AverageColorByte( dev );
dw = scanning->sParam.Size.dwPixels;
if( scanning->sParam.bSource == SOURCE_ADF ) {
iNext = -1;
dwPixels = scanning->sParam.Size.dwPixels - 1;
} else {
iNext = 1;
dwPixels = 0;
}
izoom = usb_GetScaler( scanning );
if( scanning->dwFlag & SCANFLAG_RightAlign )
ls = Shift;
else
ls = 0;
switch( scanning->fGrayFromColor ) {
case 1:
for( dwBitsPut = 0, ddax = 0; dw; dwBitsPut++ ) {
ddax -= _SCALER;
while((ddax < 0) && (dw > 0)) {
if( swap ) {
scanning->UserBuf.pw_rgb[dwBitsPut].Red =
_HILO2WORD(scanning->Red.pcw[dwBitsPut].HiLo[0]) >> ls;
} else {
scanning->UserBuf.pw_rgb[dwPixels].Red =
scanning->Red.pw[dwBitsPut] >> ls;
}
dwPixels = dwPixels + iNext;
ddax += izoom;
dw--;
}
}
break;
case 2:
for( dwBitsPut = 0, ddax = 0; dw; dwBitsPut++ ) {
ddax -= _SCALER;
while((ddax < 0) && (dw > 0)) {
if( swap ) {
scanning->UserBuf.pw_rgb[dwBitsPut].Green =
_HILO2WORD(scanning->Green.pcw[dwBitsPut].HiLo[0]) >> ls;
} else {
scanning->UserBuf.pw_rgb[dwPixels].Green =
scanning->Green.pw[dwBitsPut] >> ls;
}
dwPixels = dwPixels + iNext;
ddax += izoom;
dw--;
}
}
break;
case 3:
for( dwBitsPut = 0, ddax = 0; dw; dwBitsPut++ ) {
ddax -= _SCALER;
while((ddax < 0) && (dw > 0)) {
if( swap ) {
scanning->UserBuf.pw_rgb[dwBitsPut].Blue =
_HILO2WORD(scanning->Blue.pcw[dwBitsPut].HiLo[0]) >> ls;
} else {
scanning->UserBuf.pw_rgb[dwPixels].Blue =
scanning->Blue.pw[dwBitsPut] >> ls;
}
dwPixels = dwPixels + iNext;
ddax += izoom;
dw--;
}
}
break;
}
}
/** here we copy and scale from scanner world to user world...
*/
static void usb_ColorScale8( struct Plustek_Device *dev )
{
@ -596,12 +687,12 @@ static void usb_ColorScale16( struct Plustek_Device *dev )
}
izoom = usb_GetScaler( scanning );
if( scanning->dwFlag & SCANFLAG_RightAlign )
ls = Shift;
else
ls = 0;
for( dwBitsPut = 0, ddax = 0; dw; dwBitsPut++ ) {
ddax -= _SCALER;
@ -941,7 +1032,6 @@ static void usb_ColorDuplicatePseudo16( struct Plustek_Device *dev )
}
/**
*
*/
static void usb_ColorDuplicateGray( struct Plustek_Device *dev )
{
@ -1012,6 +1102,64 @@ static void usb_ColorDuplicateGray_2( struct Plustek_Device *dev )
}
}
/**
*/
static void usb_ColorDuplicateGray16( struct Plustek_Device *dev )
{
u_char ls;
u_long dw;
pScanDef scan = &dev->scanning;
SANE_Bool swap = usb_HostSwap();
usb_AverageColorByte( dev );
if (scan->sParam.bSource == SOURCE_ADF) {
iNext = -1;
dwPixels = scan->sParam.Size.dwPixels - 1;
} else {
iNext = 1;
dwPixels = 0;
}
if( scan->dwFlag & SCANFLAG_RightAlign )
ls = Shift;
else
ls = 0;
switch(scan->fGrayFromColor) {
case 1:
if( swap ) {
for (dw = 0; dw < scan->sParam.Size.dwPixels; dw++, dwPixels = dwPixels + iNext)
scan->UserBuf.pw_rgb[dwPixels].Red =
_HILO2WORD(scan->Red.pcw[dw].HiLo[0]) >> ls;
} else {
for (dw = 0; dw < scan->sParam.Size.dwPixels; dw++, dwPixels = dwPixels + iNext)
scan->UserBuf.pw_rgb[dwPixels].Red = scan->Red.pw[dw] >> ls;
}
break;
case 2:
if( swap ) {
for (dw = 0; dw < scan->sParam.Size.dwPixels; dw++, dwPixels = dwPixels + iNext)
scan->UserBuf.pw_rgb[dwPixels].Green =
_HILO2WORD(scan->Green.pcw[dw].HiLo[0]) >> ls;
} else {
for (dw = 0; dw < scan->sParam.Size.dwPixels; dw++, dwPixels = dwPixels + iNext)
scan->UserBuf.pw_rgb[dwPixels].Green = scan->Green.pw[dw] >> ls;
}
break;
case 3:
if( swap ) {
for (dw = 0; dw < scan->sParam.Size.dwPixels; dw++, dwPixels = dwPixels + iNext)
scan->UserBuf.pw_rgb[dwPixels].Blue =
_HILO2WORD(scan->Blue.pcw[dw].HiLo[0]) >> ls;
} else {
for (dw = 0; dw < scan->sParam.Size.dwPixels; dw++, dwPixels = dwPixels + iNext)
scan->UserBuf.pw_rgb[dwPixels].Blue = scan->Blue.pw[dw] >> ls;
}
break;
}
}
/**
*/
static void usb_BWScale( struct Plustek_Device *dev )
@ -1311,6 +1459,10 @@ static void usb_GetImageProc( struct Plustek_Device *dev )
scanning->pfnProcess = usb_ColorScale16;
DBG( _DBG_INFO, "ImageProc is: ColorScale16\n" );
}
if (scanning->fGrayFromColor) {
scanning->pfnProcess = usb_ColorScaleGray16;
DBG( _DBG_INFO, "ImageProc is: ColorScaleGray16\n" );
}
} else if (scanning->dwFlag & SCANFLAG_Pseudo48) {
scanning->pfnProcess = usb_ColorScalePseudo16;
@ -1374,6 +1526,10 @@ static void usb_GetImageProc( struct Plustek_Device *dev )
scanning->pfnProcess = usb_ColorDuplicate16;
DBG( _DBG_INFO, "ImageProc is: ColorDuplicate16\n" );
}
if (scanning->fGrayFromColor) {
scanning->pfnProcess = usb_ColorDuplicateGray16;
DBG( _DBG_INFO, "ImageProc is: ColorDuplicateGray16\n" );
}
} else if (scanning->dwFlag & SCANFLAG_Pseudo48) {
scanning->pfnProcess = usb_ColorDuplicatePseudo16;
DBG( _DBG_INFO, "ImageProc is: ColorDuplicatePseudo16\n" );

Wyświetl plik

@ -2695,10 +2695,10 @@ static SANE_Bool usb_DownloadShadingData( pPlustek_Device dev, u_char bJobID )
}
/* set RAM configuration AND
* Gain = Multiplier Coefficient/16384
* External DRAM for Multiplier Coefficient Source
* External DRAM for Offset Coefficient Source
*/
* Gain = Multiplier Coefficient/16384
* External DRAM for Multiplier Coefficient Source
* External DRAM for Offset Coefficient Source
*/
a_bRegs[0x42] = (u_char)((hw->wDRAMSize > 512)? 0x66: 0x26);
if( scaps->workaroundFlag & _WAF_SKIP_WHITEFINE ) {
@ -2719,10 +2719,10 @@ static SANE_Bool usb_DownloadShadingData( pPlustek_Device dev, u_char bJobID )
a_bRegs[0x41] = 0x00;
/* set RAM configuration AND
* GAIN = Multiplier Coefficient/16384
* CFG Register 0x40/0x41 for Multiplier Coefficient Source
* CFG Register 0x3e/0x3f for Offset Coefficient Source
*/
* GAIN = Multiplier Coefficient/16384
* CFG Register 0x40/0x41 for Multiplier Coefficient Source
* CFG Register 0x3e/0x3f for Offset Coefficient Source
*/
a_bRegs[0x42] = (u_char)((hw->wDRAMSize > 512)? 0x60: 0x20);
_UIO(sanei_lm983x_write( dev->fd, 0x3e, &a_bRegs[0x3e],

Plik diff jest za duży Load Diff

Wyświetl plik

@ -20,11 +20,11 @@
* - 0.33 - no changes
* - 0.34 - moved some definitions and typedefs from plustek.c
* - 0.35 - removed OPT_MODEL from options list
* - added max_y to struct Plustek_Scan
* - added max_y to struct Plustek_Scan
* - 0.36 - added reader_pid, pipe and bytes_read to struct Plustek_Scanner
* - removed unused variables from struct Plustek_Scanner
* - removed unused variables from struct Plustek_Scanner
* - moved fd from struct Plustek_Scanner to Plustek_Device
* - added next members to struct Plustek_Scanner and Plustek_Device
* - added next members to struct Plustek_Scanner and Plustek_Device
* - 0.37 - added max_x to struct Plustek_Device
* - 0.38 - added caps to struct Plustek_Device
* - added exit code to struct Plustek_Scanner
@ -36,7 +36,7 @@
* - 0.41 - added configuration stuff
* - 0.42 - added custom gamma tables
* - changed usbId to static array
* - added _MAX_ID_LEN
* - added _MAX_ID_LEN
* - 0.43 - no changes
* - 0.44 - added flag initialized
* - 0.45 - added readLine function
@ -191,7 +191,6 @@
#define _E_BUFFER_TOO_SMALL (_FIRST_ERR-13)
#define _E_DATAREAD (_FIRST_ERR-14)
/************************ some structures ************************************/
enum {
@ -214,6 +213,9 @@ enum {
OPT_GAMMA_VECTOR_R,
OPT_GAMMA_VECTOR_G,
OPT_GAMMA_VECTOR_B,
OPT_DEVICE_GROUP,
OPT_LAMPSWITCH,
OPT_WARMUPTIME,
NUM_OPTIONS
};
@ -237,13 +239,15 @@ typedef struct {
int skipFineWhite;
int invertNegatives;
int cacheCalData;
int altCalibrate; /* force use of the alternate canoscan
autocal; perhaps other Canon
scanners require the alternate
autocalibration as well */
int altCalibrate; /* force use of the alternate canoscan autocal;
perhaps other Canon scanners require the
alternate autocalibration as well */
int rgain;
int ggain;
int bgain;
int rlampoff; /* for red lamp off setting (CIS-scanner) */
int glampoff; /* for green lamp off setting (CIS-scanner) */
int blampoff; /* for blue lamp off setting (CIS-scanner) */
OffsDef pos; /* for adjusting normal scan area */
OffsDef tpa; /* for adjusting transparency scan area */
@ -264,9 +268,9 @@ typedef struct {
typedef struct {
unsigned short x;
unsigned short y;
unsigned short cx;
unsigned short cy;
unsigned short y;
unsigned short cx;
unsigned short cy;
} CropRect, *pCropRect;
typedef struct image {
@ -290,9 +294,9 @@ typedef struct {
} ScanInfo, *pScanInfo;
typedef struct {
unsigned long dwFlag;
unsigned short wMaxExtentX; /**< scanarea width */
unsigned short wMaxExtentY; /**< scanarea height */
unsigned long dwFlag;
unsigned short wMaxExtentX; /**< scanarea width */
unsigned short wMaxExtentY; /**< scanarea height */
} ScannerCaps, *pScannerCaps;
/** for defining the scanmodes
@ -308,43 +312,42 @@ typedef struct Plustek_Device
{
SANE_Int initialized; /* device already initialized? */
struct Plustek_Device *next; /* pointer to next dev in list */
int fd; /* device handle */
char *name; /* (to avoid compiler warnings!)*/
int fd; /* device handle */
char *name; /* (to avoid compiler warnings!)*/
char *calFile; /* for saving calibration data */
SANE_Device sane; /* info struct */
SANE_Int max_x; /* max XY-extension of the scan-*/
SANE_Int max_y; /* area */
SANE_Range dpi_range; /* resolution range */
SANE_Range x_range; /* x-range of the scan-area */
SANE_Range y_range; /* y-range of the scan-area */
SANE_Int *res_list; /* to hold the available phys. */
SANE_Int res_list_size; /* resolution values */
ScannerCaps caps; /* caps reported by the driver */
SANE_Device sane; /* info struct */
SANE_Int max_x; /* max XY-extension of the scan-*/
SANE_Int max_y; /* area */
SANE_Range dpi_range; /* resolution range */
SANE_Range x_range; /* x-range of the scan-area */
SANE_Range y_range; /* y-range of the scan-area */
SANE_Int *res_list; /* to hold the available phys. */
SANE_Int res_list_size; /* resolution values */
ScannerCaps caps; /* caps reported by the driver */
AdjDef adj; /* for driver adjustment */
/**************************** USB-stuff **********************************/
char usbId[_MAX_ID_LEN];/* to keep Vendor and product */
/* ID string (from conf) file */
struct ScanDef scanning; /* here we hold all stuff for */
/* the USB-scanner */
/**************************** USB-stuff **********************************/
char usbId[_MAX_ID_LEN];/* to keep Vendor and product */
/* ID string (from conf) file */
struct ScanDef scanning; /* here we hold all stuff for */
/* the USB-scanner */
struct DeviceDef usbDev;
#ifdef HAVE_SETITIMER
struct itimerval saveSettings; /* for lamp timer */
#endif
/*
* each device we support may need other access functions...
*/
int (*close) ( struct Plustek_Device* );
void (*shutdown) ( struct Plustek_Device* );
int (*getCaps) ( struct Plustek_Device* );
int (*getCropInfo)( struct Plustek_Device*, pCropInfo );
int (*setScanEnv) ( struct Plustek_Device*, pScanInfo );
int (*setMap) ( struct Plustek_Device*, SANE_Word*,
SANE_Word, SANE_Word );
int (*startScan) ( struct Plustek_Device* );
int (*stopScan) ( struct Plustek_Device* );
int (*prepare) ( struct Plustek_Device*, SANE_Byte* );
int (*readLine) ( struct Plustek_Device* );
/* each device we support may need other access functions...
*/
int (*close) ( struct Plustek_Device* );
void (*shutdown) ( struct Plustek_Device* );
int (*getCaps) ( struct Plustek_Device* );
int (*getCropInfo)( struct Plustek_Device*, pCropInfo );
int (*setScanEnv) ( struct Plustek_Device*, pScanInfo );
int (*setMap) ( struct Plustek_Device*, SANE_Word*,
SANE_Word, SANE_Word );
int (*startScan) ( struct Plustek_Device* );
int (*stopScan) ( struct Plustek_Device* );
int (*prepare) ( struct Plustek_Device*, SANE_Byte* );
int (*readLine) ( struct Plustek_Device* );
} Plustek_Device, *pPlustek_Device;