Added sheetfed device Q-Scan USB001 from Portable Peripherals

Fixed Mustek Bearpaw and made some speedup (bugreports #304343 and #301763)
Fixed calibration for senororders other that RGB
merge-requests/1/head
Gerhard Jaeger 2007-06-29 08:39:56 +00:00
rodzic a775aebc03
commit d7d8160b5f
13 zmienionych plików z 408 dodań i 112 usunięć

Wyświetl plik

@ -45,6 +45,7 @@
* 1200DPI CIS devices don't use GrayFromColor any longer
* - 0.51 - added Syscan to the vendor list
* - added SCANFLAG_Calibration handling
* - 0.52 - added _WAF_LOFF_ON_START handling in usbDev_startScan()
* .
* <hr>
* This file is part of the SANE package.
@ -108,6 +109,7 @@ static TabDef usbVendors[] = {
{ 0x1606, "UMAX", NULL },
{ 0x049F, "Compaq", NULL },
{ 0x0A82, "Syscan", NULL },
{ 0x0A53, "PandP Co., Ltd.", NULL },
{ 0xFFFF, NULL, NULL }
};
@ -132,7 +134,7 @@ static SANE_Bool usb_normFileName( char *fname, char* buffer, u_long max_len )
dst = buffer;
while( *src != '\0' ) {
if((*src == '/') || isspace(*src))
if((*src == '/') || isspace(*src) || ispunct(*src))
*dst = '_';
else
*dst = *src;
@ -286,17 +288,18 @@ usb_initDev( Plustek_Device *dev, int idx, int handle, int vendor )
sParam.Size.dwPixels = 0;
/* create calibration-filename */
ptr = getenv ("HOME");
if( !usb_normFileName( dev->usbDev.ModelStr, tmp_str1, PATH_MAX )) {
sprintf( tmp_str2, "%s-%s",
dev->sane.vendor, dev->usbDev.ModelStr );
if( !usb_normFileName( tmp_str2, tmp_str1, PATH_MAX )) {
strcpy( tmp_str1, "plustek-default" );
}
ptr = getenv ("HOME");
if( NULL == ptr ) {
sprintf( tmp_str2, "/tmp/%s-%s",
dev->sane.vendor, tmp_str1 );
sprintf( tmp_str2, "/tmp/%s", tmp_str1 );
} else {
sprintf( tmp_str2, "%s/.sane/%s-%s",
ptr, dev->sane.vendor, tmp_str1 );
sprintf( tmp_str2, "%s/.sane/%s", ptr, tmp_str1 );
}
dev->calFile = strdup( tmp_str2 );
DBG( _DBG_INFO, "Calibration file-names set to:\n" );
@ -1081,6 +1084,16 @@ usbDev_startScan( Plustek_Device *dev )
return _E_ALLOC;
scan->dwFlag |= SCANFLAG_StartScan;
/* some devices (esp. BearPaw) do need a lamp switch off before
* switching it on again. Otherwise it might happen that the lamp
* remains off
*/
if(dev->usbDev.Caps.workaroundFlag & _WAF_LOFF_ON_START) {
if (usb_GetLampStatus(dev))
usb_LampOn( dev, SANE_FALSE, SANE_TRUE );
}
usb_LampOn( dev, SANE_TRUE, SANE_TRUE );
m_fStart = m_fFirst = SANE_TRUE;
@ -1275,6 +1288,8 @@ usbDev_Prepare( Plustek_Device *dev, SANE_Byte *buf )
} else {
/* CIS section */
/* this might be a simple gray operation or AFE 1 channel op */
scan->dwLinesDiscard = 0;
scan->Green.pb = scan->pbScanBufBegin;
@ -1282,11 +1297,37 @@ usbDev_Prepare( Plustek_Device *dev, SANE_Byte *buf )
if(( scan->sParam.bDataType == SCANDATATYPE_Color ) &&
( hw->bReg_0x26 & _ONE_CH_COLOR )) {
u_char so;
u_long len = scan->sParam.Size.dwPhyBytes / 3;
scan->Red.pb = scan->pbScanBufBegin;
scan->Green.pb = scan->pbScanBufBegin + len;
scan->Blue.pb = scan->pbScanBufBegin + len * 2UL;
so = scaps->bSensorOrder;
if (_WAF_RESET_SO_TO_RGB & scaps->workaroundFlag) {
if (scaps->bPCB != 0) {
if (scan->sParam.PhyDpi.x > scaps->bPCB) {
so = SENSORORDER_rgb;
DBG(_DBG_INFO, "* Resetting sensororder to RGB\n");
}
}
}
switch( so ) {
case SENSORORDER_rgb:
scan->Red.pb = scan->pbScanBufBegin;
scan->Green.pb = scan->pbScanBufBegin + len;
scan->Blue.pb = scan->pbScanBufBegin + len * 2UL;
break;
case SENSORORDER_gbr:
scan->Green.pb = scan->pbScanBufBegin;
scan->Blue.pb = scan->pbScanBufBegin + len;
scan->Red.pb = scan->pbScanBufBegin + len * 2UL;
break;
default:
DBG( _DBG_ERROR, "CIS: This bSensorOrder "
"is not defined\n" );
return _E_INTERNAL;
}
}
}

Wyświetl plik

@ -7,7 +7,7 @@
* @brief Main defines for the USB devices.
*
* Based on sources acquired from Plustek Inc.<br>
* Copyright (C) 2001-2006 Gerhard Jaeger <gerhard@gjaeger.de>
* Copyright (C) 2001-2007 Gerhard Jaeger <gerhard@gjaeger.de>
*
* History:
* - 0.40 - starting version of the USB support
@ -44,6 +44,11 @@
* - added _WAF_USE_ALT_DESC
* - added DEVCAPSFLAG_SheetFed
* - added dpi_thresh and lineend to motor structure
* - 0.52 - added MODEL_QSCAN
* - changed DCapsDef, lamp -> misc_io
* - bPCB is now ushort to be "missused" by non Plustek
* devices (as threshhold for resetting sensor order)
* - added _WAF_LOFF_ON_START
* .
* <hr>
* This file is part of the SANE package.
@ -248,7 +253,9 @@ enum _WORKAROUNDS
_WAF_BIN_FROM_COLOR = 0x00000080, /* generate binary & gray images */
_WAF_GRAY_FROM_COLOR = 0x00000100, /* from color scans */
_WAF_MISC_IO_BUTTONS = 0x00000200, /* special handling for buttons */
_WAF_USE_ALT_DESC = 0x00000400 /* use alternate manufacturer */
_WAF_USE_ALT_DESC = 0x00000400, /* use alternate manufacturer */
_WAF_RESET_SO_TO_RGB = 0x00000800, /* set sensororder to RGB(CIS only)*/
_WAF_LOFF_ON_START = 0x00001000 /* switch lamp off before scanning */
};
/** for lamps connected to the misc I/O pins*/
@ -263,6 +270,8 @@ enum _LAMPS
_MIO6 = 0x0020
};
#define _PSENSE_SHIFT 24
#define _PSENSE_MASK 0xFF000000
#define _BUTTON_SHIFT 16
#define _BUTTON_MASK 0xFF0000
#define _TPA_SHIFT 8
@ -276,6 +285,18 @@ enum _BUTTONS
_PORT2 = ((_MIO5 | _MIO6) << _BUTTON_SHIFT)
};
enum _PAPER_SENSE
{
_PS_INP1 = (0x01 << _PSENSE_SHIFT),
_PS_INP2 = (0x02 << _PSENSE_SHIFT),
_PS_INP_MIO1 = (_MIO1 << (_PSENSE_SHIFT+2)),
_PS_INP_MIO2 = (_MIO2 << (_PSENSE_SHIFT+2)),
_PS_INP_MIO3 = (_MIO3 << (_PSENSE_SHIFT+2)),
_PS_INP_MIO4 = (_MIO4 << (_PSENSE_SHIFT+2)),
_PS_INP_MIO5 = (_MIO5 << (_PSENSE_SHIFT+2)),
_PS_INP_MIO6 = (_MIO6 << (_PSENSE_SHIFT+2))
};
/** for encoding a misc I/O register as TPA */
#define _TPA(register) ((u_long)(register << _TPA_SHIFT))
@ -285,6 +306,9 @@ enum _BUTTONS
/** Get the TPA misc I/O register */
#define _GET_TPALAMP(flag) ((flag >> _TPA_SHIFT) & 0xFF)
/** Get the Papersense port*/
#define _GET_PAPERSENSE_PORT(flag) ((flag >> _PSENSE_SHIFT) & 0xFF)
/** motor types */
typedef enum
{
@ -302,6 +326,7 @@ typedef enum
MODEL_UMAX, /**< for UMAX 3400/3450 */
MODEL_UMAX1200, /**< for UMAX 5400 */
MODEL_TSCAN, /**< for Syscan Travelscan */
MODEL_QSCAN, /**< for PandP Q-Scan */
MODEL_LAST
} eModelDef;
@ -382,10 +407,10 @@ typedef struct DevCaps
u_char bSensorDistance; /**< CCD Color distance */
u_char bButtons; /**< Number of buttons */
u_char bCCD; /**< CCD ID */
u_char bPCB; /**< PCB ID */
u_short bPCB; /**< PCB ID/or threshold (only CIS) */
u_long workaroundFlag; /**< Flag to allow special work arounds, see */
/* _WORKAROUNDS */
u_long lamp; /**< for lamp: loword: normal, hiword: tpa */
u_long misc_io; /**< for lamp, papersense and buttons */
} DCapsDef;

Wyświetl plik

@ -7,7 +7,7 @@
* @brief Calibration routines for CanoScan CIS devices.
*
* Based on sources acquired from Plustek Inc.<br>
* Copyright (C) 2001-2006 Gerhard Jaeger <gerhard@gjaeger.de><br>
* Copyright (C) 2001-2007 Gerhard Jaeger <gerhard@gjaeger.de><br>
* Large parts Copyright (C) 2003 Christopher Montgomery <monty@xiph.org>
*
* Montys' comment:
@ -47,6 +47,7 @@
* - fixed segfault in fine calibration
* - 0.51 - added fine calibration cache
* - usb_SwitchLamp() now really switches off the sensor
* - 0.52 - fixed setting for frontend values (gain/offset)
*
* This file is part of the SANE package.
*
@ -523,13 +524,15 @@ cano_AdjustGain( Plustek_Device *dev )
min[0] = min[1] = min[2] = 1;
DBG( _DBG_INFO, "cano_AdjustGain()\n" );
if((dev->adj.rgain != -1) &&
(dev->adj.ggain != -1) && (dev->adj.bgain != -1)) {
setAdjGain( dev->adj.rgain, &dev->usbDev.a_bRegs[0x3b] );
setAdjGain( dev->adj.ggain, &dev->usbDev.a_bRegs[0x3c] );
setAdjGain( dev->adj.bgain, &dev->usbDev.a_bRegs[0x3d] );
DBG( _DBG_INFO, "- function skipped, using frontend values!\n" );
return SANE_TRUE;
if( !usb_InCalibrationMode(dev)) {
if((dev->adj.rgain != -1) &&
(dev->adj.ggain != -1) && (dev->adj.bgain != -1)) {
setAdjGain( dev->adj.rgain, &dev->usbDev.a_bRegs[0x3b] );
setAdjGain( dev->adj.ggain, &dev->usbDev.a_bRegs[0x3c] );
setAdjGain( dev->adj.bgain, &dev->usbDev.a_bRegs[0x3d] );
DBG( _DBG_INFO, "- function skipped, using frontend values!\n" );
return SANE_TRUE;
}
}
/* define the strip to scan for coarse calibration
@ -714,13 +717,15 @@ cano_AdjustOffset( Plustek_Device *dev )
return SANE_FALSE;
DBG( _DBG_INFO, "cano_AdjustOffset()\n" );
if((dev->adj.rofs != -1) &&
(dev->adj.gofs != -1) && (dev->adj.bofs != -1)) {
dev->usbDev.a_bRegs[0x38] = (dev->adj.rofs & 0x3f);
dev->usbDev.a_bRegs[0x39] = (dev->adj.gofs & 0x3f);
dev->usbDev.a_bRegs[0x3a] = (dev->adj.bofs & 0x3f);
DBG( _DBG_INFO, "- function skipped, using frontend values!\n" );
return SANE_TRUE;
if( !usb_InCalibrationMode(dev)) {
if((dev->adj.rofs != -1) &&
(dev->adj.gofs != -1) && (dev->adj.bofs != -1)) {
dev->usbDev.a_bRegs[0x38] = (dev->adj.rofs & 0x3f);
dev->usbDev.a_bRegs[0x39] = (dev->adj.gofs & 0x3f);
dev->usbDev.a_bRegs[0x3a] = (dev->adj.bofs & 0x3f);
DBG( _DBG_INFO, "- function skipped, using frontend values!\n" );
return SANE_TRUE;
}
}
m_ScanParam.Size.dwLines = 1;
@ -1114,6 +1119,7 @@ static int
cano_DoCalibration( Plustek_Device *dev )
{
u_short dpi, idx, idx_end;
u_long save_waf;
SANE_Bool skip_fine;
ScanDef *scan = &dev->scanning;
HWDef *hw = &dev->usbDev.HwSetting;
@ -1130,9 +1136,10 @@ cano_DoCalibration( Plustek_Device *dev )
return SANE_FALSE; /* can't cal this */
}
/* Don't allow calibration settings from the other driver to confuse our use of
* a few of its functions.
/* Don't allow calibration settings from the other driver to confuse our
* use of a few of its functions.
*/
save_waf = scaps->workaroundFlag;
scaps->workaroundFlag &= ~_WAF_SKIP_WHITEFINE;
scaps->workaroundFlag &= ~_WAF_SKIP_FINE;
scaps->workaroundFlag &= ~_WAF_BYPASS_CALIBRATION;
@ -1206,7 +1213,7 @@ cano_DoCalibration( Plustek_Device *dev )
} else if( usb_IsSheetFedDevice(dev)) {
/* we only to the calibration upon request !*/
/* we only do the calibration upon request !*/
if( !skip_fine ) {
DBG( _DBG_INFO2, "SHEET-FED device, skip fine calibration!\n" );
skip_fine = SANE_TRUE;
@ -1220,9 +1227,14 @@ cano_DoCalibration( Plustek_Device *dev )
for( idx = 1; idx < idx_end; idx++ ) {
dpi = 0;
if( usb_InCalibrationMode(dev))
if( usb_InCalibrationMode(dev)) {
dpi = usb_get_res( scaps->OpticDpi.x, idx );
/* we might should check against device specific limit */
if(dpi < 50)
continue;
}
DBG( _DBG_INFO2, "###### ADJUST DARK (FINE) ########\n" );
if(cano_PrepareToReadBlackCal(dev))
return SANE_FALSE;
@ -1291,6 +1303,8 @@ cano_DoCalibration( Plustek_Device *dev )
DBG( _DBG_INFO, "REG[0x3a] = %i\n", dev->usbDev.a_bRegs[0x3a] );
DBG( _DBG_INFO, "-------------------------\n" );
scaps->workaroundFlag |= save_waf;
return SANE_TRUE;
}

Wyświetl plik

@ -6,7 +6,7 @@
/** @file plustek-usbcalfile.c
* @brief Functions for saving/restoring calibration settings
*
* Copyright (C) 2001-2006 Gerhard Jaeger <gerhard@gjaeger.de>
* Copyright (C) 2001-2007 Gerhard Jaeger <gerhard@gjaeger.de>
*
* History:
* - 0.46 - first version
@ -16,6 +16,7 @@
* - 0.50 - cleanup
* - 0.51 - added functions for saving, reading and restoring
* fine calibration data
* - 0.52 - no changes
* .
* <hr>
* This file is part of the SANE package.

Wyświetl plik

@ -7,7 +7,7 @@
* @brief Here we have our USB device definitions.
*
* Based on sources acquired from Plustek Inc.<br>
* Copyright (C) 2001-2006 Gerhard Jaeger <gerhard@gjaeger.de>
* Copyright (C) 2001-2007 Gerhard Jaeger <gerhard@gjaeger.de>
*
* History:
* - 0.40 - starting version of the USB support
@ -68,6 +68,8 @@
* - fixed CanoScan LiDE20 settings, cause of various reports, seems
* Canon has built-in different motortypes
* - also fixed Motorsettings for LiDE30
* - 0.52 - added Q-Scan USB001 settings
* - tweaked motor settings for Bearpaw 1200
*
* <hr>
* This file is part of the SANE package.
@ -539,8 +541,8 @@ static DCapsDef Cap0x0400_0x1000_0 =
SENSORORDER_rgb,
8,
5, kNEC8861, 0x00,
_WAF_MISC_IO_LAMPS | _WAF_USE_ALT_DESC,
_MIO5
_WAF_MISC_IO_LAMPS | _WAF_LOFF_ON_START | _WAF_USE_ALT_DESC,
_NO_MIO
};
/* Mustek BearPaw 2400
@ -712,7 +714,7 @@ static DCapsDef Cap0x04A9_0x220E =
SENSORORDER_rgb,
16, /* sensor distance */
3, /* number of buttons */
kCIS1240, /* use default settings during calibration */
kCIS1240,
0, /* not used here... */
_WAF_MISC_IO_LAMPS, _NO_MIO
};
@ -730,7 +732,7 @@ static DCapsDef Cap0x04A9_0x2220 =
SENSORORDER_rgb,
16, /* sensor distance */
3, /* number of buttons */
kCIS1240, /* use default settings during calibration */
kCIS1240,
0, /* not used here... */
_WAF_MISC_IO_LAMPS, _NO_MIO
};
@ -739,7 +741,7 @@ static DCapsDef Cap0x04A9_0x2220 =
*/
static DCapsDef Cap0x0A82_0x6620 =
{
{{ 0, 0}, 100, -1, {1226, 3508}, { 75, 75 }},
{{ 0, 0}, 100, -1, {1226, 3508}, {75, 75}},
{{ 0, 0}, 0, 0, {0, 0}, { 0, 0 }},
{{ 0, 0}, 0, 0, {0, 0}, { 0, 0 }},
{{ 0, 0}, 0, 0, {0, 0}, { 0, 0 }},
@ -752,7 +754,26 @@ static DCapsDef Cap0x0A82_0x6620 =
0, /* not used here... */
(_WAF_MISC_IO_LAMPS | _WAF_MISC_IO_BUTTONS |
_WAF_BIN_FROM_COLOR | _WAF_GRAY_FROM_COLOR),
_MIO5 + _PORT1
_MIO5 + _PORT1 + _PS_INP_MIO2
};
/* IRIScan/Q-Scan USB001 A4 sheet-fed scanner
*/
static DCapsDef Cap0x0A53_0x1000 =
{
{{ 0, 0}, 150, -1, {2550, 3508}, {150, 150}},
{{ 0, 0}, 0, 0, {0, 0}, { 0, 0 }},
{{ 0, 0}, 0, 0, {0, 0}, { 0, 0 }},
{{ 0, 0}, 0, 0, {0, 0}, { 0, 0 }},
{300, 300},
DEVCAPSFLAG_SheetFed,
SENSORORDER_gbr,
2, /* sensor distance */
0, /* number of buttons */
kNEC8861, /* use default settings during calibration */
200, /* threshold for resetting sensor-order */
(_WAF_MISC_IO_LAMPS | _WAF_RESET_SO_TO_RGB),
_PS_INP1
};
/******************* additional Hardware descriptions ************************/
@ -2285,10 +2306,10 @@ static HWDef Hw0x04A9_0x220E =
0x00, /* sensor control settings (reg 0x0e) */
{0x00, 0x00, 0x04, 0x05, 0x06, 0x07, 0x00, 0x00, 0x00, 0x05},
/* mono (reg 0x0f to 0x18) */
/* mono (reg 0x0f to 0x18) */
{0x00, 0x00, 0x04, 0x05, 0x06, 0x07, 0x00, 0x00, 0x00, 0x05},
/* color (reg 0x0f to 0x18) */
/* color (reg 0x0f to 0x18) */
(_BLUE_CH | _ONE_CH_COLOR), /* bReg_0x26 color mode */
@ -2354,10 +2375,10 @@ static HWDef Hw0x04A9_0x2220 =
0x00, /* sensor control settings (reg 0x0e) */
{0x00, 0x00, 0x04, 0x05, 0x06, 0x07, 0x00, 0x00, 0x00, 0x07},
/* mono (reg 0x0f to 0x18) */
/* mono (reg 0x0f to 0x18) */
{0x00, 0x00, 0x04, 0x05, 0x06, 0x07, 0x00, 0x00, 0x00, 0x07},
/* color (reg 0x0f to 0x18) */
/* color (reg 0x0f to 0x18) */
(_BLUE_CH | _ONE_CH_COLOR), /* bReg_0x26 color mode */
@ -2423,10 +2444,10 @@ static HWDef Hw0x0A82_0x6620 =
0x00, /* sensor control settings (reg 0x0e) */
{0x18, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x03, 0x07},
/* mono (reg 0x0f to 0x18) */
/* mono (reg 0x0f to 0x18) */
{0x18, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x03, 0x07},
/* color (reg 0x0f to 0x18) */
/* color (reg 0x0f to 0x18) */
(_BLUE_CH | _ONE_CH_COLOR), /* bReg_0x26 color mode */
@ -2472,6 +2493,89 @@ static HWDef Hw0x0A82_0x6620 =
1.8
};
/** IRIScan/Q-Scan USB001 - Portable Peripheral Co., Ltd. */
static HWDef Hw0x0A53_0x1000 =
{
0.50, /* dMaxMotorSpeed */
0.40, /* dMaxMoveSpeed */
0.0, /* dHighSpeed */
100, /* wIntegrationTimeLowLamp */
100, /* wIntegrationTimeHighLamp */
300, /* wMotorDpi (Full step DPI) */
512, /* wRAMSize (KB) */
3.75, /* dMinIntegrationTimeLowres (ms) */
5.75, /* dMinIntegrationTimeHighres (ms) */
4095, /* wGreenPWMDutyCycleLow (reg 0x2a + 0x2b) */
4095, /* wGreenPWMDutyCycleHigh (reg 0x2a + 0x2b) */
0x09, /* bSensorConfiguration (0x0b) */
0x00, /* sensor control settings (reg 0x0c) */
0x65, /* sensor control settings (reg 0x0d) */
0x13, /* sensor control settings (reg 0x0e) */
{0x02, 0x07, 0x05, 0x07, 0x00, 0x00, 0x00, 0x00, 0x06, 0x02},
/* mono (reg 0x0f to 0x18) */
{0x02, 0x07, 0x05, 0x07, 0x00, 0x00, 0x00, 0x00, 0x06, 0x02},
/* color (reg 0x0f to 0x18) */
(_BLUE_CH | _ONE_CH_COLOR), /* bReg_0x26 color mode */
0x00, /* bReg 0x27 color mode */
2, /* bReg 0x29 illumination mode */
{ 3, 0, 0, 2593, 4600, 0, 0 },
#if 0
{ 2, 2593, 4600, 2593, 4100, 2593, 4100 },
#else
{ 2, 2593, 7100, 2593, 4600, 2593, 4480 },
#endif
256, /* StepperPhaseCorrection (reg 0x1a + 0x1b) */
0, /* bOpticBlackStart (reg 0x1c) */
0x15, /* bOpticBlackEnd (reg 0x1d) */
0x15, /* wActivePixelsStart (reg 0x1e + 0x1f) */
5500, /* wLineEnd (reg 0x20 + 0x21) */
#if 0
2593, /* red lamp on (reg 0x2c + 0x2d) */
4600, /* red lamp off (reg 0x2e + 0x2f) */
2593, /* green lamp on (reg 0x30 + 0x31) */
4100, /* green lamp off (reg 0x32 + 0x33) */
2593, /* blue lamp on (reg 0x34 + 0x35) */
4100, /* blue lamp off (reg 0x36 + 0x37) */
#else
2593, /* red lamp on (reg 0x2c + 0x2d) */
7100, /* red lamp off (reg 0x2e + 0x2f) */
2593, /* green lamp on (reg 0x30 + 0x31) */
4600, /* green lamp off (reg 0x32 + 0x33) */
2593, /* blue lamp on (reg 0x34 + 0x35) */
4480, /* blue lamp off (reg 0x36 + 0x37) */
#endif
3, /* stepper motor control (reg 0x45) */
0, /* wStepsAfterPaperSensor2 (reg 0x4c + 0x4d) */
0, /* steps to reverse when buffer is full reg 0x50) */
0, /* acceleration profile (reg 0x51) */
0, /* lines to process (reg 0x54) */
0x1b, /* kickstart (reg 0x55) */
0x08, /* pwm freq (reg 0x56) */
0x15, /* pwm duty cycle (reg 0x57) */
0x00, /* Paper sense (reg 0x58) */
0x00, /* misc io12 (reg 0x59) */
0x00, /* misc io34 (reg 0x5a) */
0x00, /* 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_QSCAN,
1.1
};
/******************** all available combinations *****************************/
/** here we have all supported devices and their settings...
@ -2546,6 +2650,9 @@ static SetDef Settings[] =
/* SYSCAN... */
{"0x0A82-0x6620", &Cap0x0A82_0x6620, &Hw0x0A82_0x6620, "TravelScan 662" },
/* Portable Peripheral Co., Ltd. */
{"0x0A53-0x1000", &Cap0x0A53_0x1000, &Hw0x0A53_0x1000, "Q-Scan USB001" },
/* 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
@ -2621,16 +2728,11 @@ static ClkMotorDef Motors[] = {
{{ 16, 4, 1 }, { 16, 4, 1 }, { 16, 4, 1 }, { 16, 4, 1 }, { 16, 4, 1 },
{ 16, 4, 1 }, { 16, 4, 1 }, { 16, 4, 1 }, { 16, 4, 1 }, { 16, 4, 1 }},
/* Color mode MCLK settings */
#if 0
{ 3.5, 3.5, 3.5, 4.0, 6.0, 8.0, 11.5, 11.5, 11.5, 11.5 },
{ 3.5, 3.5, 3.5, 4.0, 6.0, 8.0, 11.5, 11.5, 11.5, 11.5 },
#else
{ 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0 },
{ 8.0, 8.0, 8.0, 8.0, 8.0, 8.0, 11.5, 11.5, 11.5, 11.5 },
#endif
{ 4.0, 3.5, 3.5, 4.0, 4.0, 5.0, 5.0, 7.5, 7.5, 7.5 },
{ 4.0, 3.5, 3.5, 4.0, 4.0, 5.0, 5.0, 7.5, 7.5, 7.5 },
/* Gray mode MCLK settings */
{ 10.5, 10.5, 10.5, 10.5, 10.5, 10.5, 11.5, 11.5, 11.5, 11.5 },
{ 10.5, 10.5, 10.5, 10.5, 10.5, 10.5, 11.5, 11.5, 11.5, 11.5 }
{ 7.5, 7.0, 6.5, 5.5, 5.5, 5.5, 7.0, 7.0, 7.0, 7.0 },
{ 7.5, 7.0, 6.5, 5.5, 5.5, 5.5, 7.0, 7.0, 7.0, 7.0 }
},
{ MODEL_MUSTEK1200, 2, 32, 3, 0, 0,
@ -2763,12 +2865,25 @@ static ClkMotorDef Motors[] = {
/* <=400dpi <=600dpi <=800dpi <=1200dpi <=2400dpi */
{ 2, 22, 1 }, { 2, 22, 1 }, { 2, 22, 1 }, { 2, 22, 1 }, { 2, 22, 1 }},
/* Color mode MCLK settings */
/* Color mode MCLK settings */
{ 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0 },
{ 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0 },
/* Gray mode MCLK settings */
{ 16.0, 16.0, 16.0, 16.0, 16.0, 16.0, 16.0, 16.0, 16.0, 16.0 },
{ 16.0, 16.0, 16.0, 16.0, 16.0, 16.0, 16.0, 16.0, 16.0, 16.0 },
},
{ MODEL_QSCAN, 8, 21, 6, 300, 4600,
/* Motor settings (PWM and PWM_Duty) */
/* <=75dpi <=100dpi <=150dpi <=200dpi <=300dpi */
{{ 8, 21, 1 }, { 8, 21, 1 }, { 8, 21, 1 }, { 8, 21, 1 }, { 8, 21, 1 },
/* <=400dpi <=600dpi <=800dpi <=1200dpi <=2400dpi */
{ 8, 21, 1 }, { 8, 21, 1 }, { 8, 21, 1 }, { 8, 21, 1 }, { 8, 21, 1 }},
/* Color mode MCLK settings */
{ 6.5, 6.5, 6.5, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0 },
{ 6.5, 6.5, 6.5, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0 },
/* Gray mode MCLK settings */
{ 6.5, 6.5, 6.5, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0 },
{ 6.5, 6.5, 6.5, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0 },
}
};

Wyświetl plik

@ -7,7 +7,7 @@
* @brief Functions to control the scanner hardware.
*
* Based on sources acquired from Plustek Inc.<br>
* Copyright (C) 2001-2006 Gerhard Jaeger <gerhard@gjaeger.de>
* Copyright (C) 2001-2007 Gerhard Jaeger <gerhard@gjaeger.de>
*
* History:
* - 0.40 - starting version of the USB support
@ -52,6 +52,7 @@
* devices
* - fixed button handling for Plustek/Genius devices and added
* some more debug output to that code path
* - 0.52 - changed DCapsDef, lamp -> misc_io
* .
* <hr>
* This file is part of the SANE package.
@ -270,11 +271,14 @@ usb_IsScannerReady( Plustek_Device *dev )
/**
*/
static SANE_Bool
usb_SensorAdf( int handle )
usb_SensorAdf( Plustek_Device *dev )
{
u_char value;
usbio_ReadReg( handle, 0x02, &value );
if( usb_IsSheetFedDevice(dev))
return SANE_FALSE;
usbio_ReadReg( dev->fd, 0x02, &value );
return (value & 0x20);
}
@ -284,12 +288,13 @@ usb_SensorAdf( int handle )
static SANE_Bool
usb_SensorPaper( Plustek_Device *dev )
{
DCapsDef *sc = &dev->usbDev.Caps;
u_char val, mask = 0x02;
usbio_ReadReg( dev->fd, 0x02, &val );
if( usb_IsSheetFedDevice(dev))
mask = 0x08;
mask = _GET_PAPERSENSE_PORT(sc->misc_io);
return (val & mask);
}
@ -481,7 +486,7 @@ usb_ModuleMove( Plustek_Device *dev, u_char action, u_long dwStep )
ejected = SANE_TRUE;
}
if( usb_SensorAdf(dev->fd) &&
if( usb_SensorAdf(dev) &&
!usb_ModuleMove(dev,MOVE_ToPaperSensor, 0 )) {
hw->dMaxMoveSpeed = d;
return SANE_FALSE;
@ -498,6 +503,7 @@ usb_ModuleMove( Plustek_Device *dev, u_char action, u_long dwStep )
* BUT: not at startup
*/
if (dev->initialized >= 0 || ejected) {
DBG(_DBG_INFO2, "... MORE EJECT...\n");
if(!usb_ModuleMove( dev, MOVE_Forward, 300 /* *3 */)) {
hw->dMaxMoveSpeed = d;
return SANE_FALSE;
@ -1056,7 +1062,7 @@ usb_GetLampStatus( Plustek_Device *dev )
/* do we use the misc I/O pins for switching the lamp ? */
if( _WAF_MISC_IO_LAMPS & sc->workaroundFlag ) {
usb_GetLampRegAndMask( sc->lamp, &reg, &msk );
usb_GetLampRegAndMask( sc->misc_io, &reg, &msk );
if( 0 == reg ) {
usbio_ReadReg( dev->fd, 0x29, &reg );
@ -1068,19 +1074,22 @@ usb_GetLampStatus( Plustek_Device *dev )
/* check if the lamp is on */
usbio_ReadReg( dev->fd, reg, &val );
DBG( _DBG_INFO2, "REG[0x%02x] = 0x%02x (msk=0x%02x)\n",reg,val,msk);
DBG( _DBG_INFO2, "LAMP-REG[0x%02x] = 0x%02x (msk=0x%02x)\n",
reg,val,msk);
if( val & msk )
iLampStatus |= DEV_LampReflection;
/* if the device supports a TPA, we check this here */
if( sc->wFlags & DEVCAPSFLAG_TPA ) {
usb_GetLampRegAndMask( _GET_TPALAMP(sc->lamp), &reg, &msk );
usbio_ReadReg( dev->fd, reg, &val );
DBG( _DBG_INFO2, "REG[0x%02x] = 0x%02x (msk=0x%02x)\n",
reg,val,msk);
if( val & msk )
iLampStatus |= DEV_LampTPA;
usb_GetLampRegAndMask( _GET_TPALAMP(sc->misc_io), &reg, &msk );
if (reg) {
usbio_ReadReg( dev->fd, reg, &val );
DBG( _DBG_INFO2, "TPA-REG[0x%02x] = 0x%02x (msk=0x%02x)\n",
reg,val,msk);
if( val & msk )
iLampStatus |= DEV_LampTPA;
}
}
/* CanoScan D660U extra vaganza... */
@ -1111,7 +1120,8 @@ usb_GetLampStatus( Plustek_Device *dev )
}
}
DBG( _DBG_INFO, "LAMP-STATUS: 0x%08x\n", iLampStatus );
DBG( _DBG_INFO, "LAMP-STATUS: 0x%08x (%s)\n",
iLampStatus, iLampStatus?"on":"off" );
return iLampStatus;
}
@ -1126,9 +1136,9 @@ usb_switchLampX( Plustek_Device *dev, SANE_Bool on, SANE_Bool tpa )
u_char *regs = dev->usbDev.a_bRegs;
if( tpa )
usb_GetLampRegAndMask( _GET_TPALAMP(sc->lamp), &reg, &msk );
usb_GetLampRegAndMask( _GET_TPALAMP(sc->misc_io), &reg, &msk );
else
usb_GetLampRegAndMask( sc->lamp, &reg, &msk );
usb_GetLampRegAndMask( sc->misc_io, &reg, &msk );
if( 0 == reg )
return SANE_FALSE; /* no need to switch something */
@ -1369,6 +1379,7 @@ usb_ResetRegisters( Plustek_Device *dev )
regs[0x1a] = _HIBYTE( hw->StepperPhaseCorrection );
regs[0x1b] = _LOBYTE( hw->StepperPhaseCorrection );
/* HEINER: CHECK WHY THIS has been disabled*/
#if 0
regs[0x1c] = hw->bOpticBlackStart;
regs[0x1d] = hw->bOpticBlackEnd;
@ -1409,6 +1420,7 @@ usb_ResetRegisters( Plustek_Device *dev )
regs[0x5d] = hw->bReg_0x5d;
regs[0x5e] = hw->bReg_0x5e;
sanei_lm983x_read( dev->fd, 0x59, &regs[0x59], 3, SANE_TRUE );
} else {
DBG( _DBG_INFO2, "SETTING THE MISC I/Os\n" );
@ -1774,11 +1786,11 @@ usb_UpdateButtonStatus( Plustek_Scanner *s )
/* only use the "valid" ports, that reflect a button */
if( _WAF_MISC_IO_BUTTONS & caps->workaroundFlag ) {
if((caps->lamp & _PORT0) == 0)
if((caps->misc_io & _PORT0) == 0)
mio[0] = 0xff;
if((caps->lamp & _PORT1) == 0)
if((caps->misc_io & _PORT1) == 0)
mio[1] = 0xff;
if((caps->lamp & _PORT2) == 0)
if((caps->misc_io & _PORT2) == 0)
mio[2] = 0xff;
}

Wyświetl plik

@ -32,6 +32,7 @@
* - 0.50 - cleanup
* - 0.51 - added usb_ColorDuplicateGray16_2(), usb_ColorScaleGray16_2()
* usb_BWScaleFromColor_2() and usb_BWDuplicateFromColor_2()
* - 0.52 - cleanup
* .
* <hr>
* This file is part of the SANE package.
@ -82,26 +83,42 @@ static u_short wSum, Mask;
/*
*/
static u_char BitTable[8] = {
0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01
0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01
};
static u_char BitsReverseTable[256] = {
0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff
0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff
};
/************************ some helper functions ******************************/

Wyświetl plik

@ -7,7 +7,7 @@
* @brief Some I/O stuff.
*
* Based on sources acquired from Plustek Inc.<br>
* Copyright (C) 2001-2006 Gerhard Jaeger <gerhard@gjaeger.de>
* Copyright (C) 2001-2007 Gerhard Jaeger <gerhard@gjaeger.de>
*
* History:
* History:
@ -27,6 +27,7 @@
* could not be red
* - usbio_ResetLM983x() checks for reg7 value before writing
* - 0.51 - allow dumpRegs to be called without valid fd
* - 0.52 - no changes
* .
* <hr>
* This file is part of the SANE package.

Wyświetl plik

@ -22,6 +22,7 @@
* - 0.49 - changed usb_MapDownload
* - 0.50 - cleanup
* - 0.51 - no changes
* - 0.52 - no changes
* .
* <hr>
* This file is part of the SANE package.

Wyświetl plik

@ -29,6 +29,7 @@
* - changed usb_MapDownload prototype
* - 0.50 - cleanup
* - 0.51 - added usb_get_res() and usb_GetPhyPixels()
* - 0.52 - no changes
* .
* <hr>
* This file is part of the SANE package.
@ -1314,7 +1315,7 @@ usb_SetScanParameters( Plustek_Device *dev, ScanParam *pParam )
_UIO(sanei_lm983x_write( dev->fd, 0x03, &regs[0x03], 3, SANE_TRUE));
_UIO(sanei_lm983x_write( dev->fd, 0x08, &regs[0x08], 0x7f - 0x08+1, SANE_TRUE));
usleep( 100 );
usleep(100);
if( !usbio_WriteReg( dev->fd, 0x07, 0 ))
return SANE_FALSE;

Wyświetl plik

@ -31,6 +31,8 @@
* - 0.50 - readded kCIS670 to add 5% extra to LiDE20 fine calibration
* - fixed line statistics and added data output
* - 0.51 - added fine calibration cache
* - 0.52 - added get_ptrs to let various sensororders work
* correctly
* .
* <hr>
* This file is part of the SANE package.
@ -2280,7 +2282,14 @@ usb_PrepareCalibration( Plustek_Device *dev )
regs[0x3d] = 0x0a;
/* use frontend values... */
if((dev->adj.rgain != -1) &&
if((dev->adj.rofs != -1) &&
(dev->adj.gofs != -1) && (dev->adj.bofs != -1)) {
regs[0x38] = (dev->adj.rofs & 0x3f);
regs[0x39] = (dev->adj.gofs & 0x3f);
regs[0x3a] = (dev->adj.bofs & 0x3f);
}
if((dev->adj.rgain != -1) &&
(dev->adj.ggain != -1) && (dev->adj.bgain != -1)) {
setAdjGain( dev->adj.rgain, &regs[0x3b] );
setAdjGain( dev->adj.ggain, &regs[0x3c] );
@ -2992,14 +3001,57 @@ usb_DoCalibration( Plustek_Device *dev )
return SANE_TRUE;
}
/* on different sensor orders, we need to adjust the shading buffer
* pointer, otherwise we correct the wrong channels
*/
static void
get_ptrs(Plustek_Device *dev, u_short *buf, u_long offs,
u_short **r, u_short **g, u_short **b)
{
ScanDef *scan = &dev->scanning;
DCapsDef *scaps = &dev->usbDev.Caps;
u_char so = scaps->bSensorOrder;
if (_WAF_RESET_SO_TO_RGB & scaps->workaroundFlag) {
if (scaps->bPCB != 0) {
if (scan->sParam.PhyDpi.x > scaps->bPCB)
so = SENSORORDER_rgb;
}
}
switch( so ) {
case SENSORORDER_gbr:
*g = buf;
*b = buf + offs;
*r = buf + offs * 2;
break;
case SENSORORDER_bgr:
*b = buf;
*g = buf + offs;
*r = buf + offs * 2;
break;
case SENSORORDER_rgb:
default:
*r = buf;
*g = buf + offs;
*b = buf + offs * 2;
break;
}
}
/** usb_DownloadShadingData
* according to the job id, different registers or DRAM areas are set
* in preparation for calibration or scanning
*/
static SANE_Bool usb_DownloadShadingData( Plustek_Device *dev, u_char what )
static SANE_Bool
usb_DownloadShadingData( Plustek_Device *dev, u_char what )
{
u_char channel;
u_short *r, *g, *b;
DCapsDef *scaps = &dev->usbDev.Caps;
ScanDef *scan = &dev->scanning;
HWDef *hw = &dev->usbDev.HwSetting;
ScanParam *param = &dev->scanning.sParam;
u_char *regs = dev->usbDev.a_bRegs;
@ -3073,23 +3125,35 @@ static SANE_Bool usb_DownloadShadingData( Plustek_Device *dev, u_char what )
if( scaps->workaroundFlag & _WAF_SKIP_FINE ) {
DBG( _DBG_INFO, "Skipping fine calibration\n" );
regs[0x42] = (u_char)(( hw->wDRAMSize > 512)? 0x60: 0x20);
if (scan->skipCoarseCalib) {
if( !usbio_WriteReg( dev->fd, 0x42, regs[0x42]))
return SANE_FALSE;
DBG( _DBG_INFO, "...cleaning shading buffer\n" );
memset( a_wWhiteShading, 0, _SHADING_BUF );
memset( a_wDarkShading, 0, _SHADING_BUF );
regs[0x40] = 0x3f;
regs[0x41] = 0xff;
_UIO(sanei_lm983x_write( dev->fd, 0x40,
&regs[0x40], 3, SANE_TRUE));
} else {
if( !usbio_WriteReg( dev->fd, 0x42, regs[0x42]))
return SANE_FALSE;
}
break;
}
DBG( _DBG_INFO, "Downloading %lu pixels\n", m_dwPixels );
/* Download the dark & white shadings to LM983x */
if( param->bDataType == SCANDATATYPE_Color ) {
usb_SetDarkShading( dev, CHANNEL_red, a_wDarkShading,
get_ptrs(dev, a_wDarkShading, m_dwPixels, &r, &g, &b);
usb_SetDarkShading( dev, CHANNEL_red, r,
(u_short)m_ScanParam.Size.dwPhyPixels * 2);
usb_SetDarkShading( dev, CHANNEL_green,
a_wDarkShading + m_dwPixels,
usb_SetDarkShading( dev, CHANNEL_green, g,
(u_short)m_ScanParam.Size.dwPhyPixels * 2);
usb_SetDarkShading( dev, CHANNEL_blue,
a_wDarkShading + m_dwPixels * 2,
usb_SetDarkShading( dev, CHANNEL_blue, b,
(u_short)m_ScanParam.Size.dwPhyPixels * 2);
} else {
usb_SetDarkShading( dev, channel,
@ -3098,19 +3162,21 @@ static SANE_Bool usb_DownloadShadingData( Plustek_Device *dev, u_char what )
}
if( param->bDataType == SCANDATATYPE_Color ) {
usb_SetWhiteShading( dev, CHANNEL_red, a_wWhiteShading,
get_ptrs(dev, a_wWhiteShading,
m_ScanParam.Size.dwPhyPixels, &r, &g, &b);
usb_SetWhiteShading( dev, CHANNEL_red, r,
(u_short)m_ScanParam.Size.dwPhyPixels * 2);
usb_SetWhiteShading( dev, CHANNEL_green, a_wWhiteShading +
m_ScanParam.Size.dwPhyPixels,
usb_SetWhiteShading( dev, CHANNEL_green, g,
(u_short)m_ScanParam.Size.dwPhyPixels * 2);
usb_SetWhiteShading( dev, CHANNEL_blue, a_wWhiteShading +
m_ScanParam.Size.dwPhyPixels * 2,
usb_SetWhiteShading( dev, CHANNEL_blue, b,
(u_short)m_ScanParam.Size.dwPhyPixels * 2);
} else {
usb_SetWhiteShading( dev, channel, a_wWhiteShading,
(u_short)m_ScanParam.Size.dwPhyPixels * 2);
}
/* set RAM configuration AND
* Gain = Multiplier Coefficient/16384
* External DRAM for Multiplier Coefficient Source

Wyświetl plik

@ -82,6 +82,7 @@
* - fixed constraint_type for OPT_BUTTON
* - 0.51 - added fine calibration caching
* - removed #define _PLUSTEK_USB
* - 0.52 - no changes
*.
* <hr>
* This file is part of the SANE package.
@ -157,7 +158,7 @@
#include "../include/sane/sanei.h"
#include "../include/sane/saneopts.h"
#define BACKEND_VERSION "0.51-16"
#define BACKEND_VERSION "0.52-1"
#define BACKEND_NAME plustek
#include "../include/sane/sanei_access.h"

Wyświetl plik

@ -11,7 +11,7 @@
*
* original code taken from sane-0.71<br>
* Copyright (C) 1997 Hypercore Software Design, Ltd.<br>
* Copyright (C) 2001-2005 Gerhard Jaeger <gerhard@gjaeger.de>
* Copyright (C) 2001-2007 Gerhard Jaeger <gerhard@gjaeger.de>
*
* History:
* - 0.30 - initial version
@ -58,6 +58,7 @@
* - 0.50 - cleanup
* - added OPT_SPEEDUP
* - 0.51 - added OPT_CALIBRATE
* - 0.52 -
* .
* <hr>
* This file is part of the SANE package.