kopia lustrzana https://gitlab.com/sane-project/backends
Tweaked TravelScan464 settings. Added possibility to disable
dark-calibration with lamp on (touches devices like CanoScan1220 etc.) Use attribute packed for data access structsmerge-requests/1/head
rodzic
a933814615
commit
2c944f5f6f
|
@ -168,6 +168,9 @@ static void usb_CheckAndCopyAdjs( Plustek_Device *dev )
|
|||
if( dev->adj.skipFineWhite > 0 )
|
||||
dev->usbDev.Caps.workaroundFlag |= _WAF_SKIP_WHITEFINE;
|
||||
|
||||
if( dev->adj.skipDarkStrip > 0 )
|
||||
dev->usbDev.Caps.Normal.DarkShadOrgY = -1;
|
||||
|
||||
if( dev->adj.invertNegatives > 0 )
|
||||
dev->usbDev.Caps.workaroundFlag |= _WAF_INV_NEGATIVE_MAP;
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
* devices (as threshhold for resetting sensor order)
|
||||
* - added _WAF_LOFF_ON_START and _WAF_ONLY_8BIT
|
||||
* - added MODEL_TSCAN_A4
|
||||
* - added attribute packed for data access structs
|
||||
* .
|
||||
* <hr>
|
||||
* This file is part of the SANE package.
|
||||
|
@ -126,39 +127,39 @@
|
|||
#define _PHILO2WORD(x) ((u_short)x->bHi * 256U + x->bLo)
|
||||
|
||||
/* useful for RGB-values */
|
||||
typedef struct {
|
||||
typedef struct __attribute__ ((__packed__)) {
|
||||
u_char Red;
|
||||
u_char Green;
|
||||
u_char Blue;
|
||||
} RGBByteDef;
|
||||
|
||||
typedef struct {
|
||||
typedef struct __attribute__ ((__packed__)) {
|
||||
u_short Red;
|
||||
u_short Green;
|
||||
u_short Blue;
|
||||
} RGBUShortDef;
|
||||
|
||||
typedef struct {
|
||||
typedef struct __attribute__ ((__packed__)) {
|
||||
u_long Red;
|
||||
u_long Green;
|
||||
u_long Blue;
|
||||
} RGBULongDef;
|
||||
|
||||
typedef struct {
|
||||
typedef struct __attribute__ ((__packed__)) {
|
||||
u_char a_bColor[3];
|
||||
} ColorByteDef;
|
||||
|
||||
typedef struct {
|
||||
typedef struct __attribute__ ((__packed__)) {
|
||||
u_char bHi;
|
||||
u_char bLo;
|
||||
} HiLoDef;
|
||||
|
||||
typedef union {
|
||||
typedef union __attribute__ ((__packed__)) {
|
||||
HiLoDef HiLo[3];
|
||||
u_short Colors[3];
|
||||
} ColorWordDef;
|
||||
|
||||
typedef union {
|
||||
typedef union __attribute__ ((__packed__)) {
|
||||
HiLoDef HiLo;
|
||||
u_short Mono;
|
||||
} MonoWordDef;
|
||||
|
|
|
@ -164,7 +164,6 @@ cano_PrepareToReadBlackCal( Plustek_Device *dev )
|
|||
strip_state = 0;
|
||||
|
||||
} else {
|
||||
|
||||
/* switch lamp off to read dark data... */
|
||||
dev->usbDev.a_bRegs[0x29] = 0;
|
||||
usb_switchLamp( dev, SANE_FALSE );
|
||||
|
@ -845,14 +844,15 @@ cano_AdjustOffset( Plustek_Device *dev )
|
|||
_UIO(sanei_lm983x_write(dev->fd, 0x38, &dev->usbDev.a_bRegs[0x38], 3, SANE_TRUE));
|
||||
}
|
||||
|
||||
/* is that really needed?! */
|
||||
if( m_ScanParam.bDataType == SCANDATATYPE_Color ) {
|
||||
dev->usbDev.a_bRegs[0x38] = now[0];
|
||||
dev->usbDev.a_bRegs[0x39] = now[1];
|
||||
dev->usbDev.a_bRegs[0x3a] = now[2];
|
||||
dev->usbDev.a_bRegs[0x38] = now[0] & 0x3f;
|
||||
dev->usbDev.a_bRegs[0x39] = now[1] & 0x3f;
|
||||
dev->usbDev.a_bRegs[0x3a] = now[2] & 0x3f;
|
||||
} else {
|
||||
dev->usbDev.a_bRegs[0x38] =
|
||||
dev->usbDev.a_bRegs[0x39] =
|
||||
dev->usbDev.a_bRegs[0x3a] = now[0];
|
||||
dev->usbDev.a_bRegs[0x3a] = now[0] & 0x3f;
|
||||
}
|
||||
|
||||
DBG( _DBG_INFO, "cano_AdjustOffset() done.\n" );
|
||||
|
@ -969,7 +969,7 @@ cano_AdjustDarkShading( Plustek_Device *dev, u_short cal_dpi )
|
|||
}
|
||||
a_wDarkShading[i]= gray/j + param->swOffset[0];
|
||||
}
|
||||
|
||||
|
||||
memcpy( a_wDarkShading + m_ScanParam.Size.dwPhyPixels,
|
||||
a_wDarkShading, m_ScanParam.Size.dwPhyPixels * 2);
|
||||
memcpy( a_wDarkShading + m_ScanParam.Size.dwPhyPixels * 2,
|
||||
|
@ -977,7 +977,7 @@ cano_AdjustDarkShading( Plustek_Device *dev, u_short cal_dpi )
|
|||
}
|
||||
|
||||
if(usb_HostSwap())
|
||||
usb_Swap(a_wDarkShading, m_ScanParam.Size.dwPhyPixels * 2 * 3 );
|
||||
usb_Swap(a_wDarkShading, m_ScanParam.Size.dwPhyPixels * 2 * 3);
|
||||
|
||||
usb_line_statistics( "Dark", a_wDarkShading, m_ScanParam.Size.dwPhyPixels,
|
||||
scan->sParam.bDataType == SCANDATATYPE_Color?1:0);
|
||||
|
|
|
@ -2514,6 +2514,32 @@ static HWDef Hw0x0A82_0x6620 =
|
|||
1.8
|
||||
};
|
||||
|
||||
#if 0
|
||||
// COLOR
|
||||
0x00 0x0a 0x1f 0x00 0x0d 0x00 0x25 0x00 0x18
|
||||
0x10 0x01 0x00 0x04 0x00 0x00 0x00 0x00 0x03 0x07 0x00 0x00 0x01 0x01 0x02 0x00 0x17
|
||||
0x20 0x20 0xd0 0x00 0x17 0x14 0x27 0x15 0x00 0x00 0x02 0x0b 0xb8 0x01 0xf4 0x07 0x32
|
||||
0x30 0x01 0xf4 0x06 0x62 0x01 0xf4 0x06 0x72 0x2f 0x2f 0x31 0x01 0x01 0x01 0x00 0x00
|
||||
0x40 0x40 0x00 0x26 0x00 0x00 0x13 0x01 0xaa 0x01 0xaa 0x00 0x00 0x00 0x00 0x90 0x01
|
||||
0x50 0x00 0x00 0x0b 0xd0 0x00 0x09 0x02 0x16 0x01 0xee 0x96 0x09 0x00 0x00 0x00 0x00
|
||||
|
||||
// GRAY
|
||||
0x00 0x0a 0x1f 0x00 0x0d 0x00 0x25 0x00 0x18
|
||||
0x10 0x01 0x00 0x04 0x00 0x00 0x00 0x00 0x03 0x07 0x00 0x00 0x01 0x01 0x02 0x00 0x17
|
||||
0x20 0x31 0x38 0x00 0x17 0x14 0x27 0x14 0x00 0x00 0x03 0x0b 0xb8 0x01 0xfe 0x03 0xbd
|
||||
0x30 0x03 0xc1 0x05 0x3b 0x05 0x3f 0x06 0xbe 0x2f 0x2f 0x31 0x01 0x01 0x01 0x00 0x00
|
||||
0x40 0x40 0x00 0x26 0xff 0x02 0x13 0x01 0xaa 0x01 0xaa 0x00 0x00 0x00 0x00 0x90 0x01
|
||||
0x50 0x00 0x00 0x0b 0xd0 0x00 0x09 0x02 0x16 0x01 0xee 0x96 0x09 0x00 0x00 0x00 0x00
|
||||
|
||||
// BINARY
|
||||
0x00 0x0a 0x07 0x00 0x0d 0x00 0x25 0x00 0x18
|
||||
0x10 0x01 0x00 0x04 0x00 0x00 0x00 0x00 0x03 0x07 0x00 0x00 0x01 0x01 0x02 0x00 0x17
|
||||
0x20 0x31 0x38 0x00 0x17 0x13 0x9d 0x14 0x00 0x00 0x03 0x0b 0xb8 0x01 0xfe 0x03 0xbd
|
||||
0x30 0x03 0xc1 0x05 0x3b 0x05 0x3f 0x06 0xbe 0x2f 0x2f 0x31 0x01 0x01 0x01 0x00 0x00
|
||||
0x40 0x40 0x00 0x26 0xff 0x02 0x13 0x01 0xaa 0x01 0xaa 0x00 0x00 0x00 0x00 0x90 0x01
|
||||
0x50 0x00 0x00 0x0b 0xd0 0x00 0x09 0x02 0x16 0x01 0xee 0x96 0x09 0x00 0x00 0x00 0x00
|
||||
#endif
|
||||
|
||||
/** TravelScan 464 */
|
||||
static HWDef Hw0x0A82_0x4600 =
|
||||
{
|
||||
|
@ -2545,21 +2571,21 @@ static HWDef Hw0x0A82_0x4600 =
|
|||
0x00, /* bReg 0x27 color mode */
|
||||
2, /* bReg 0x29 illumination mode */
|
||||
|
||||
{ 3, 0, 0, 10, 450, 0, 0 },
|
||||
{ 2, 10, 1000, 10, 880, 10, 630 },
|
||||
{ 3, 510, 957, 961, 1339, 1343, 16134 },
|
||||
{ 2, 500, 1842, 500, 1634, 500, 1650 },
|
||||
|
||||
1, /* StepperPhaseCorrection (reg 0x1a + 0x1b) */
|
||||
0, /* StepperPhaseCorrection (reg 0x1a + 0x1b) */
|
||||
1, /* bOpticBlackStart (reg 0x1c) */
|
||||
2, /* bOpticBlackEnd (reg 0x1d) */
|
||||
0x15, /* wActivePixelsStart (reg 0x1e + 0x1f) */
|
||||
0x17, /* wActivePixelsStart (reg 0x1e + 0x1f) */
|
||||
5300, /* wLineEnd (reg 0x20 + 0x21) */
|
||||
|
||||
500, /* red lamp on (reg 0x2c + 0x2d) */
|
||||
1000, /* red lamp off (reg 0x2e + 0x2f) */
|
||||
1840, /* red lamp off (reg 0x2e + 0x2f) */
|
||||
500, /* green lamp on (reg 0x30 + 0x31) */
|
||||
1000, /* green lamp off (reg 0x32 + 0x33) */
|
||||
1630, /* green lamp off (reg 0x32 + 0x33) */
|
||||
500, /* blue lamp on (reg 0x34 + 0x35) */
|
||||
100, /* blue lamp off (reg 0x36 + 0x37) */
|
||||
1650, /* blue lamp off (reg 0x36 + 0x37) */
|
||||
|
||||
3, /* stepper motor control (reg 0x45) */
|
||||
0, /* wStepsAfterPaperSensor2 (reg 0x4c + 0x4d) */
|
||||
|
@ -2616,11 +2642,7 @@ static HWDef Hw0x0A53_0x1000 =
|
|||
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) */
|
||||
|
@ -2628,21 +2650,12 @@ static HWDef Hw0x0A53_0x1000 =
|
|||
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) */
|
||||
|
@ -2964,7 +2977,7 @@ static ClkMotorDef Motors[] = {
|
|||
{ 16.0, 16.0, 16.0, 16.0, 16.0, 16.0, 16.0, 16.0, 16.0, 16.0 },
|
||||
},
|
||||
|
||||
{ MODEL_TSCAN_A4, 2, 22, 6, 0, 0,
|
||||
{ MODEL_TSCAN_A4, 2, 22, 6, 75, 8400,
|
||||
/* Motor settings (PWM and PWM_Duty) */
|
||||
/* <=75dpi <=100dpi <=150dpi <=200dpi <=300dpi */
|
||||
{{ 2, 22, 1 }, { 2, 22, 1 }, { 2, 22, 1 }, { 2, 22, 1 }, { 2, 22, 1 },
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
* If you do not wish that, delete this exception notice.
|
||||
* <hr>
|
||||
*/
|
||||
|
||||
|
||||
/************** global stuff - I hate it, but we need it... ******************/
|
||||
|
||||
#define _MAX_AUTO_WARMUP 60 /**< number of loops */
|
||||
|
@ -3160,7 +3160,6 @@ usb_DownloadShadingData( Plustek_Device *dev, u_char what )
|
|||
a_wDarkShading + m_dwPixels,
|
||||
(u_short)m_ScanParam.Size.dwPhyPixels * 2);
|
||||
}
|
||||
|
||||
if( param->bDataType == SCANDATATYPE_Color ) {
|
||||
|
||||
get_ptrs(dev, a_wWhiteShading,
|
||||
|
|
|
@ -82,7 +82,7 @@
|
|||
* - fixed constraint_type for OPT_BUTTON
|
||||
* - 0.51 - added fine calibration caching
|
||||
* - removed #define _PLUSTEK_USB
|
||||
* - 0.52 - no changes
|
||||
* - 0.52 - added skipDarkStrip and OPT_LOFF4DARK to frontend options
|
||||
*.
|
||||
* <hr>
|
||||
* This file is part of the SANE package.
|
||||
|
@ -158,7 +158,7 @@
|
|||
#include "../include/sane/sanei.h"
|
||||
#include "../include/sane/saneopts.h"
|
||||
|
||||
#define BACKEND_VERSION "0.52-4"
|
||||
#define BACKEND_VERSION "0.52-5"
|
||||
|
||||
#define BACKEND_NAME plustek
|
||||
#include "../include/sane/sanei_access.h"
|
||||
|
@ -276,6 +276,7 @@ static void show_cnf( CnfDef *cnf )
|
|||
DBG( _DBG_SANE_INIT,"skipCalibr. : %s\n", _YN(cnf->adj.skipCalibration));
|
||||
DBG( _DBG_SANE_INIT,"skipFine : %s\n", _YN(cnf->adj.skipFine ));
|
||||
DBG( _DBG_SANE_INIT,"skipFineWhite: %s\n", _YN(cnf->adj.skipFineWhite ));
|
||||
DBG( _DBG_SANE_INIT,"skipDarkStrip: %s\n", _YN(cnf->adj.skipDarkStrip ));
|
||||
DBG( _DBG_SANE_INIT,"invertNegs. : %s\n", _YN(cnf->adj.invertNegatives));
|
||||
DBG( _DBG_SANE_INIT,"dis.Speedup : %s\n", _YN(cnf->adj.disableSpeedup ));
|
||||
DBG( _DBG_SANE_INIT,"pos_x : %d\n", cnf->adj.pos.x );
|
||||
|
@ -919,6 +920,15 @@ init_options( Plustek_Scanner *s )
|
|||
s->opt[OPT_LAMPSWITCH].type = SANE_TYPE_BOOL;
|
||||
s->val[OPT_LAMPSWITCH].w = SANE_FALSE;
|
||||
|
||||
s->opt[OPT_LOFF4DARK].name = "lamp-off-during-dcal";
|
||||
s->opt[OPT_LOFF4DARK].title = SANE_I18N("Lamp off during dark calibration");;
|
||||
s->opt[OPT_LOFF4DARK].desc = SANE_I18N("Always switches lamp off when doing dark calibration.");
|
||||
s->opt[OPT_LOFF4DARK].type = SANE_TYPE_BOOL;
|
||||
s->val[OPT_LOFF4DARK].w = adj->skipDarkStrip;
|
||||
|
||||
if (dev->usbDev.Caps.Normal.DarkShadOrgY < 0)
|
||||
_DISABLE(OPT_LOFF4DARK);
|
||||
|
||||
s->opt[OPT_CACHECAL].name = "calibration-cache";
|
||||
s->opt[OPT_CACHECAL].title = SANE_I18N("Calibration data cache");;
|
||||
s->opt[OPT_CACHECAL].desc = SANE_I18N("Enables or disables calibration data cache.");
|
||||
|
@ -1507,6 +1517,8 @@ sane_init( SANE_Int *version_code, SANE_Auth_Callback authorize )
|
|||
_INT, &config.adj.skipFine,&ival);
|
||||
decodeVal( str, "skipFineWhite",
|
||||
_INT, &config.adj.skipFineWhite,&ival);
|
||||
decodeVal( str, "skipDarkStrip",
|
||||
_INT, &config.adj.skipDarkStrip,&ival);
|
||||
decodeVal( str, "invertNegatives",
|
||||
_INT, &config.adj.invertNegatives,&ival);
|
||||
decodeVal( str, "disableSpeedup",
|
||||
|
@ -1878,6 +1890,7 @@ sane_control_option( SANE_Handle handle, SANE_Int option,
|
|||
case OPT_LAMPSWITCH:
|
||||
case OPT_CUSTOM_GAMMA:
|
||||
case OPT_LAMPOFF_ONEND:
|
||||
case OPT_LOFF4DARK:
|
||||
case OPT_CACHECAL:
|
||||
case OPT_SPEEDUP:
|
||||
case OPT_OVR_REDGAIN:
|
||||
|
@ -2033,6 +2046,11 @@ sane_control_option( SANE_Handle handle, SANE_Int option,
|
|||
dev->adj.disableSpeedup = !(s->val[option].w);
|
||||
break;
|
||||
|
||||
case OPT_LOFF4DARK:
|
||||
s->val[option].w = *(SANE_Word *)value;
|
||||
dev->adj.skipDarkStrip = !(s->val[option].w);
|
||||
break;
|
||||
|
||||
case OPT_LAMPSWITCH:
|
||||
s->val[option].w = *(SANE_Word *)value;
|
||||
usb_LampSwitch( dev, s->val[option].w );
|
||||
|
|
|
@ -115,6 +115,15 @@ option skipFine 0
|
|||
#
|
||||
option skipFineWhite 0
|
||||
|
||||
#
|
||||
# some scanners have a dark calibration strip, in
|
||||
# general this one should be used for calibration.
|
||||
# As this could cause some trouble, this option
|
||||
# overrides that and the dark calibration will be
|
||||
# done by switching the lamp off
|
||||
#
|
||||
option skipDarkStrip 0
|
||||
|
||||
# for replacing the gain values found during coarse
|
||||
# calibration
|
||||
# (can also be set via frontend)
|
||||
|
|
|
@ -58,7 +58,8 @@
|
|||
* - 0.50 - cleanup
|
||||
* - added OPT_SPEEDUP
|
||||
* - 0.51 - added OPT_CALIBRATE
|
||||
* - 0.52 -
|
||||
* - 0.52 - added skipDarkStrip to struct AdjDef
|
||||
* - added OPT_LOFF4DARK
|
||||
* .
|
||||
* <hr>
|
||||
* This file is part of the SANE package.
|
||||
|
@ -226,6 +227,7 @@ enum {
|
|||
OPT_LAMPOFF_TIMER,
|
||||
OPT_LAMPOFF_ONEND,
|
||||
OPT_WARMUPTIME,
|
||||
OPT_LOFF4DARK,
|
||||
OPT_CACHECAL,
|
||||
OPT_SPEEDUP,
|
||||
OPT_CALIBRATE,
|
||||
|
@ -264,9 +266,10 @@ typedef struct {
|
|||
int lampOffOnEnd;
|
||||
int warmup;
|
||||
int enableTpa;
|
||||
int skipCalibration;
|
||||
int skipCalibration; /**< skip entire calibration */
|
||||
int skipFine;
|
||||
int skipFineWhite;
|
||||
int skipDarkStrip;
|
||||
int disableSpeedup;
|
||||
int invertNegatives;
|
||||
int cacheCalData;
|
||||
|
|
Ładowanie…
Reference in New Issue