Critical bugfix in CIS calibration, to make the devices CanoScan 650, 1220 and

1240 work again.
merge-requests/1/head
Gerhard Jaeger 2003-05-18 16:58:18 +00:00
rodzic e9568a5b52
commit 04fe542971
6 zmienionych plików z 119 dodań i 33 usunięć

Wyświetl plik

@ -1,3 +1,11 @@
2003-05-18 Gerhard Jaeger <gerhard@gjaeger.de>
* doc/sane-plustek.man: Update.
* backend/plustek-devs.c backend/plustek-usbshading.c
backend/plustek-usb.h:
Fixed critical bug in CIS device calibration and settings which causes
the CanoScan 650, 1220 and 1240 not to work anymore
* TODO: removed line "check status of Umax 3450...".
---- CODE FREEZE FOR SANE 1.0.12 ---
-- snapshot 1.0.12-pre2

1
TODO
Wyświetl plik

@ -76,7 +76,6 @@ doc
"perfectly, mostly, partially, unsupported, untested" (from linuxprinting.org).
That explains how much the scanner can do instead of the release status of
a scanner (alpha/beta...).
- plustek: check status of Umax 3450 USB scanner (same as 3400?)
- umax: genius.kye.de times out?
* manpages:

Wyświetl plik

@ -607,7 +607,7 @@ static DCapsDef Cap0x1606_0x0160_0 =
*/
static DCapsDef Cap0x04A9_0x2206_0 =
{
{{ 0, 90}, 35, 5, {2550, 3508}, {75, 75}, COLOR_GRAY16 },
{{ 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 },
@ -616,16 +616,16 @@ static DCapsDef Cap0x04A9_0x2206_0 =
SENSORORDER_rgb,
8, /* sensor distance */
1, /* number of buttons */
kNEC8861, /* use default settings during calibration */
kCIS650, /* use default settings during calibration */
0, /* not used here... */
_WAF_MISC_IO_LAMPS | _WAF_BLACKFINE, _NO_MIO
_WAF_MISC_IO_LAMPS | _WAF_BLACKFINE | _WAF_FIX_OFS, _NO_MIO
};
/* Canon N1220U
*/
static DCapsDef Cap0x04A9_0x2207_0 =
{
{{ 0, 85}, 35, 5, {2550, 3508}, {75, 75}, COLOR_BW },
{{ 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 },
@ -634,16 +634,16 @@ static DCapsDef Cap0x04A9_0x2207_0 =
SENSORORDER_rgb,
16, /* sensor distance */
1, /* number of buttons */
kNEC8861, /* use default settings during calibration */
kCIS650, /* use default settings during calibration */
0, /* not used here... */
_WAF_MISC_IO_LAMPS | _WAF_BLACKFINE, _NO_MIO
_WAF_MISC_IO_LAMPS | _WAF_BLACKFINE | _WAF_FIX_OFS, _NO_MIO
};
/* Canon N670U/N676U/LiDE20
*/
static DCapsDef Cap0x04A9_0x220D_0 =
{
{{ 0, 100}, 35, 5, {2550, 3508}, {75, 75}, COLOR_GRAY16 },
{{ 0, 110}, 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 },
@ -652,16 +652,16 @@ static DCapsDef Cap0x04A9_0x220D_0 =
SENSORORDER_rgb,
8, /* sensor distance */
3, /* number of buttons */
kNEC8861, /* use default settings during calibration */
kCIS670,
0, /* not used here... */
_WAF_MISC_IO_LAMPS | _WAF_BLACKFINE, _NO_MIO
_WAF_MISC_IO_LAMPS | _WAF_BLACKFINE | _WAF_FIX_OFS, _NO_MIO
};
/* Canon N1240U
*/
static DCapsDef Cap0x04A9_0x220E_0 =
{
{{ 0, 100}, 35, 5, {2550, 3508}, {75, 75}, COLOR_BW },
{{ 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 },
@ -670,9 +670,9 @@ static DCapsDef Cap0x04A9_0x220E_0 =
SENSORORDER_rgb,
16, /* sensor distance */
3, /* number of buttons */
kNEC8861, /* use default settings during calibration */
kCIS1240, /* use default settings during calibration */
0, /* not used here... */
_WAF_MISC_IO_LAMPS | _WAF_BLACKFINE, _NO_MIO
_WAF_MISC_IO_LAMPS | _WAF_BLACKFINE | _WAF_FIX_OFS, _NO_MIO
};
/******************* additional Hardware descriptions ************************/
@ -1921,7 +1921,7 @@ static HWDef Hw0x04A9_0x2207_0 =
0x00, /* bReg 0x27 color mode */
2, /* bReg 0x29 illumination mode */
{ 3, 0, 0, 23, 3937, 0, 0 },
{ 2, 23, 12000, 23, 5500, 23, 3900 },
{ 2, 23, 14000, 23, 7500, 23, 5900 },
1, /* StepperPhaseCorrection (reg 0x1a + 0x1b) */
0, /* bOpticBlackStart (reg 0x1c) */
@ -1988,9 +1988,7 @@ static HWDef Hw0x04A9_0x220D_0 =
2, /* bReg 0x29 illumination mode (runtime) */
{ 3, 0, 0, 23, 1800, 0, 0 },
/* { 2, 23, 3562, 23, 3315, 23, 2676 },
*/
{ 2, 23, 16383, 23, 16383, 23, 16383 },
{ 2, 23, 3800, 23, 3300, 23, 2700 },
1, /* StepperPhaseCorrection (reg 0x1a + 0x1b) */
0, /* bOpticBlackStart (reg 0x1c) */
@ -2057,8 +2055,13 @@ static HWDef Hw0x04A9_0x220E_0 =
0x00, /* bReg 0x27 color mode */
2, /* bReg 0x29 illumination mode */
{ 3, 0, 0, 23, 3937, 0, 0 },
{ 2, 23, 12000, 23, 5500, 23, 3900 },
#if 1
{ 3, 0, 0, 23, 3937, 0, 0 },
{ 2, 23, 13000, 23, 6500, 23, 4900 },
#else
{ 3, 0, 0, 23, 16383, 0, 0 },
{ 2, 23, 16383, 23, 16383, 23, 16383 },
#endif
1, /* StepperPhaseCorrection (reg 0x1a + 0x1b) */
0, /* bOpticBlackStart (reg 0x1c) */

Wyświetl plik

@ -19,10 +19,11 @@
* - added CLKDef
* - 0.44 - added vendor and product ID to struct DeviceDef
* - added _WAF_BYPASS_CALIBRATION
* - added _WAF_INV_NEGATIVE_MAP
* - added _WAF_INV_NEGATIVE_MAP
* - 0.45 - added _WAF_SKIP_FINE for skipping fine calibration
* added _WAF_SKIP_WHITEFINE for skipping fine white calibration
* added MCLK setting for 16 bit modes
* - added _WAF_SKIP_WHITEFINE for skipping fine white calibration
* - added MCLK setting for 16 bit modes
* - added _WAF_FIX_GAIN and _WAF_FIX_OFS
* .
* <hr>
* This file is part of the SANE package.
@ -74,6 +75,9 @@
#define kNEC8861 3
#define kNEC3778 4
#define kNECSLIM 5
#define kCIS650 6
#define kCIS670 7
#define kCIS1240 8
/*********************************** plustek_types.h!!! ************************/
@ -209,7 +213,9 @@ enum _WORKAROUNDS
_WAF_BYPASS_CALIBRATION = 0x00000008, /* no calibration,use linear gamma */
_WAF_INV_NEGATIVE_MAP = 0x00000010, /* the backend does the neg. stuff */
_WAF_SKIP_FINE = 0x00000020, /* skip the fine calbration */
_WAF_SKIP_WHITEFINE = 0x00000040 /* skip the fine white calbration */
_WAF_SKIP_WHITEFINE = 0x00000040, /* skip the fine white calbration */
_WAF_FIX_GAIN = 0x00000080, /* use fixed gain for coarse cal. */
_WAF_FIX_OFS = 0x00000100 /* use fixed offset for coarse cal.*/
};
/** for lamps connected to the misc I/O pins*/

Wyświetl plik

@ -19,7 +19,7 @@
* - added dump of shading data
* - 0.45 - added coarse calibration for CIS devices
* - added _WAF_SKIP_FINE to skip the results of fine calibration
* - CanoScan fixes
* - CanoScan fixes and fine-tuning
* .
* <hr>
* This file is part of the SANE package.
@ -69,8 +69,8 @@
#define _MAX_SHAD 0x4000
#define _SHADING_BUF (_MAX_SHAD*3) /**< max size of the shading buffer */
#define _CIS_GAIN 1
#define _CIS_OFFS 4
#define _CIS_GAIN 0
#define _CIS_OFFS 6
static u_short a_wWhiteShading[_SHADING_BUF] = {0};
static u_short a_wDarkShading[_SHADING_BUF] = {0};
@ -331,6 +331,55 @@ static void usb_GetSoftwareOffsetGain( pPlustek_Device dev )
DBG( _DBG_INFO2, "kNEC8861 adjustments\n" );
break;
case kCIS650:
DBG( _DBG_INFO2, "kCIS650 adjustments\n" );
pParam->swGain[0] = 1160;
pParam->swGain[1] = 1160;
pParam->swGain[2] = 1160;
break;
case kCIS670:
DBG( _DBG_INFO2, "kCIS670 adjustments\n" );
if(pParam->bDataType == SCANDATATYPE_Color) {
pParam->swOffset[0] = -2650;
pParam->swOffset[1] = -2800;
pParam->swOffset[2] = -2850;
pParam->swGain[0] = 1150;
pParam->swGain[1] = 1150;
pParam->swGain[2] = 1150;
} else {
pParam->swOffset[0] = -1500;
pParam->swOffset[1] = -1500;
pParam->swOffset[2] = -1500;
pParam->swGain[0] = 900;
pParam->swGain[1] = 900;
pParam->swGain[2] = 900;
}
break;
case kCIS1240:
DBG( _DBG_INFO2, "kCIS1240 adjustments\n" );
if(pParam->bDataType == SCANDATATYPE_Color) {
pParam->swOffset[0] = -1650;
pParam->swOffset[1] = -1500;
pParam->swOffset[2] = -1500;
pParam->swGain[0] = 1010;
pParam->swGain[1] = 1050;
pParam->swGain[2] = 1030;
} else {
pParam->swOffset[0] = -1000;
pParam->swOffset[1] = -1000;
pParam->swOffset[2] = -1000;
pParam->swGain[0] = 1100;
pParam->swGain[1] = 1100;
pParam->swGain[2] = 1100;
}
break;
case kNEC3799:
DBG( _DBG_INFO2, "kNEC3799 adjustments\n" );
if( sCaps->bPCB == 2 ) {
@ -644,7 +693,7 @@ static SANE_Bool usb_AdjustGain( pPlustek_Device dev, int fNegative )
bMaxITA = 0xff;
DBG( _DBG_INFO2, "usb_AdjustGain()\n" );
if( hw->bReg_0x26 & _ONE_CH_COLOR ) {
if( scaps->workaroundFlag & _WAF_FIX_GAIN ) {
a_bRegs[0x3b] =
a_bRegs[0x3c] =
a_bRegs[0x3d] = _CIS_GAIN;
@ -1106,13 +1155,14 @@ static SANE_Bool usb_AdjustOffset( pPlustek_Device dev )
u_long dw, dwPixels;
u_long dwDiff[3], dwSum[3];
pHWDef hw = &dev->usbDev.HwSetting;
pDCapsDef scaps = &dev->usbDev.Caps;
pHWDef hw = &dev->usbDev.HwSetting;
if( usb_IsEscPressed())
return SANE_FALSE;
DBG( _DBG_INFO2, "usb_AdjustOffset()\n" );
if( hw->bReg_0x26 & _ONE_CH_COLOR ) {
if( scaps->workaroundFlag & _WAF_FIX_OFS ) {
a_bRegs[0x38] =
a_bRegs[0x39] =
a_bRegs[0x3a] = _CIS_OFFS;
@ -1295,11 +1345,20 @@ static void usb_GetDarkShading( pPlustek_Device dev, u_short *pwDest,
if( scaps->workaroundFlag & _WAF_BLACKFINE )
{
u_short w;
int wtmp;
/* here we use the source buffer + a static offset */
for (dw = 0; dw < dwPixels; dw++, pSrce += dwAdd)
{
w = (u_short)((int)_PHILO2WORD(pSrce) + iOffset);
wtmp = ((int)_PHILO2WORD(pSrce) + iOffset);
if( wtmp < 0 )
wtmp = 0;
if( wtmp > 0xffff )
wtmp = 0xffff;
w = (u_short)wtmp;
pwDest[dw] = _LOBYTE(w) * 256 + _HIBYTE(w);
}
}
@ -2003,7 +2062,7 @@ static int usb_DoCalibration( pPlustek_Device dev )
/* Go to shading position
*/
if( !(hw->bReg_0x26 & _ONE_CH_COLOR)) {
if( !(scaps->workaroundFlag & (_WAF_FIX_GAIN & _WAF_FIX_OFS))) {
DBG( _DBG_INFO, "goto shading position\n" );

Wyświetl plik

@ -1,4 +1,4 @@
.TH sane-plustek 5 "10 January 2003" "@PACKAGEVERSION@" "SANE Scanner Access Now Easy"
.TH sane-plustek 5 "18 May 2003" "@PACKAGEVERSION@" "SANE Scanner Access Now Easy"
.IX sane-plustek
.SH NAME
sane-plustek \- SANE backend for Plustek parallel port and
@ -209,11 +209,22 @@ USB Model: ASIC: Properties: Prod-ID
.br
----------------------------------------------------------
.br
UMAX 3400/2420 LM9832 600x1200dpi 42bit 512Kb 0x0060
UMAX 3400/3450 LM9832 600x1200dpi 42bit 512Kb 0x0060
.br
UMAX 5400 LM9832 1200x2400dpi 42bit 512Kb 0x0160
.PP
Vendor COMPAQ - ID: 0x049F
.br
----------------------------------------------------------
.br
USB Model: ASIC: Properties: Prod-ID
.br
----------------------------------------------------------
.br
S4-100 LM9832 600x1200dpi 42bit 512Kb 0x001A
.PP
Vendor Epson - ID: 0x04B8
.br
----------------------------------------------------------