kopia lustrzana https://gitlab.com/sane-project/backends
Minor fixes + using now the sanei_lm983x library
rodzic
5d71d97a6b
commit
317dfa3539
|
@ -295,6 +295,7 @@ libsane-pint.la: ../sanei/sanei_constrain_value.lo
|
|||
libsane-plustek.la: ../sanei/sanei_config2.lo
|
||||
libsane-plustek.la: ../sanei/sanei_constrain_value.lo
|
||||
libsane-plustek.la: ../sanei/sanei_usb.lo
|
||||
libsane-plustek.la: ../sanei/sanei_lm983x.lo
|
||||
libsane-pnm.la: ../sanei/sanei_constrain_value.lo
|
||||
libsane-qcam.la: ../sanei/sanei_constrain_value.lo
|
||||
libsane-ricoh.la: ../sanei/sanei_config2.lo
|
||||
|
@ -347,6 +348,7 @@ libsane-dll.la libsane.la: ../sanei/sanei_pio.lo
|
|||
libsane-dll.la libsane.la: ../sanei/sanei_pa4s2.lo
|
||||
libsane-dll.la libsane.la: ../sanei/sanei_usb.lo
|
||||
libsane-dll.la libsane.la: ../sanei/sanei_pv8630.lo
|
||||
libsane-dll.la libsane.la: ../sanei/sanei_lm983x.lo
|
||||
endif
|
||||
|
||||
depend:
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
*.............................................................................
|
||||
* History:
|
||||
* 0.40 - starting version of the USB support
|
||||
* 0.41 - added EPSON1250 entries
|
||||
*
|
||||
*.............................................................................
|
||||
*
|
||||
|
@ -98,7 +99,8 @@ static DCapsDef Cap0x07B3_0x0017_0 =
|
|||
4, /* bSensorDistance */
|
||||
4, /* bButtons */
|
||||
0, /* bCCD */
|
||||
0x07 /* bPCB */
|
||||
0x07, /* bPCB */
|
||||
_WAF_NONE /* no workarounds or other special stuff needed */
|
||||
};
|
||||
|
||||
/* Plustek Model: ???
|
||||
|
@ -113,7 +115,7 @@ static DCapsDef Cap0x07B3_0x0015_0 =
|
|||
{600, 600},
|
||||
0,
|
||||
SENSORORDER_rgb,
|
||||
4, 4, 0, 0x05
|
||||
4, 4, 0, 0x05, _WAF_NONE
|
||||
};
|
||||
|
||||
/* Plustek Model: ???
|
||||
|
@ -128,7 +130,7 @@ static DCapsDef Cap0x07B3_0x0014_0 =
|
|||
{600, 600},
|
||||
0,
|
||||
SENSORORDER_rgb,
|
||||
4, 0, 0, 0x04
|
||||
4, 0, 0, 0x04, _WAF_NONE
|
||||
};
|
||||
|
||||
/* Plustek Model: ???
|
||||
|
@ -143,7 +145,7 @@ static DCapsDef Cap0x07B3_0x0007_0 =
|
|||
{600, 600},
|
||||
DEVCAPSFLAG_Positive + DEVCAPSFLAG_Negative,
|
||||
SENSORORDER_rgb,
|
||||
4, 5, 0, 0x07
|
||||
4, 5, 0, 0x07, _WAF_NONE
|
||||
};
|
||||
|
||||
/* Plustek Model: ???
|
||||
|
@ -158,7 +160,7 @@ static DCapsDef Cap0x07B3_0x0005_2 =
|
|||
{600, 600},
|
||||
0,
|
||||
SENSORORDER_bgr,
|
||||
8, 2, 2, 0x05
|
||||
8, 2, 2, 0x05, _WAF_NONE
|
||||
};
|
||||
|
||||
/* Plustek Model: ???
|
||||
|
@ -173,7 +175,7 @@ static DCapsDef Cap0x07B3_0x0007_4 =
|
|||
{1200, 1200},
|
||||
DEVCAPSFLAG_Positive + DEVCAPSFLAG_Negative,
|
||||
SENSORORDER_rgb,
|
||||
12, 5, 4, 0x07
|
||||
12, 5, 4, 0x07, _WAF_NONE
|
||||
};
|
||||
|
||||
/* Plustek Model: ???
|
||||
|
@ -188,7 +190,7 @@ static DCapsDef Cap0x07B3_0x0005_4 =
|
|||
{1200, 1200},
|
||||
0,
|
||||
SENSORORDER_rgb,
|
||||
12, 5, 4, 0x05
|
||||
12, 5, 4, 0x05, _WAF_NONE
|
||||
};
|
||||
|
||||
/* Plustek Model: ???
|
||||
|
@ -203,7 +205,7 @@ static DCapsDef Cap0x07B3_0x000F_0 =
|
|||
{600, 600},
|
||||
DEVCAPSFLAG_Normal + DEVCAPSFLAG_Adf,
|
||||
SENSORORDER_rgb,
|
||||
4, 5, 0, 0x0F
|
||||
4, 5, 0, 0x0F, _WAF_NONE
|
||||
};
|
||||
|
||||
|
||||
|
@ -219,7 +221,7 @@ static DCapsDef Cap0x07B3_0x0013_0 =
|
|||
{600, 600},
|
||||
DEVCAPSFLAG_Positive + DEVCAPSFLAG_Negative,
|
||||
SENSORORDER_rgb,
|
||||
4, 4, 0, 0x03
|
||||
4, 4, 0, 0x03, _WAF_NONE
|
||||
};
|
||||
|
||||
/* Plustek Model: U24
|
||||
|
@ -234,7 +236,7 @@ static DCapsDef Cap0x07B3_0x0011_0 =
|
|||
{600, 600},
|
||||
0,
|
||||
SENSORORDER_rgb,
|
||||
4, 4, 0, 0x01
|
||||
4, 4, 0, 0x01, _WAF_NONE
|
||||
};
|
||||
|
||||
/* Plustek Model: U12
|
||||
|
@ -249,7 +251,7 @@ static DCapsDef Cap0x07B3_0x0010_0 =
|
|||
{600, 600},
|
||||
0,
|
||||
SENSORORDER_rgb,
|
||||
4, 0, 0, 0x00
|
||||
4, 0, 0, 0x00, _WAF_BSHIFT7_BUG
|
||||
};
|
||||
|
||||
/* Plustek Model: ???
|
||||
|
@ -264,7 +266,7 @@ static DCapsDef Cap0x07B3_0x0013_4 =
|
|||
{1200, 1200},
|
||||
DEVCAPSFLAG_Positive + DEVCAPSFLAG_Negative,
|
||||
SENSORORDER_rgb,
|
||||
12, 4, 4, 0x03
|
||||
12, 4, 4, 0x03, _WAF_NONE
|
||||
};
|
||||
|
||||
/* Plustek Model: ???
|
||||
|
@ -279,7 +281,7 @@ static DCapsDef Cap0x07B3_0x0011_4 =
|
|||
{1200, 1200},
|
||||
0,
|
||||
SENSORORDER_rgb,
|
||||
12, 4, 4, 0x01
|
||||
12, 4, 4, 0x01, _WAF_NONE
|
||||
};
|
||||
|
||||
/* Plustek Model: ???
|
||||
|
@ -294,7 +296,7 @@ static DCapsDef Cap0x07B3_0x0010_4 =
|
|||
{1200, 1200},
|
||||
0,
|
||||
SENSORORDER_rgb,
|
||||
12, 0, 4, 0x00
|
||||
12, 0, 4, 0x00, _WAF_NONE
|
||||
};
|
||||
|
||||
/* Plustek Model: ???
|
||||
|
@ -309,7 +311,7 @@ static DCapsDef Cap0x07B3_0x000F_4 =
|
|||
{1200, 1200},
|
||||
DEVCAPSFLAG_Normal + DEVCAPSFLAG_Adf,
|
||||
SENSORORDER_rgb,
|
||||
12, 5, 4, 0x0F
|
||||
12, 5, 4, 0x0F, _WAF_NONE
|
||||
};
|
||||
|
||||
/* Plustek Model: ???
|
||||
|
@ -324,7 +326,7 @@ static DCapsDef Cap0x07B3_0x0016_4 =
|
|||
{1200, 1200},
|
||||
DEVCAPSFLAG_Positive + DEVCAPSFLAG_Negative,
|
||||
SENSORORDER_rgb,
|
||||
12, 4, 4, 0x06
|
||||
12, 4, 4, 0x06, _WAF_NONE
|
||||
};
|
||||
|
||||
/* Plustek Model: UT24
|
||||
|
@ -339,7 +341,7 @@ static DCapsDef Cap0x07B3_0x0017_4 =
|
|||
{1200, 1200},
|
||||
DEVCAPSFLAG_Positive + DEVCAPSFLAG_Negative,
|
||||
SENSORORDER_rgb,
|
||||
12, 4, 4, 0x07
|
||||
12, 4, 4, 0x07, _WAF_NONE
|
||||
};
|
||||
|
||||
/* Plustek Model: ???
|
||||
|
@ -354,7 +356,7 @@ static DCapsDef Cap0x07B3_0x0015_4 =
|
|||
{1200, 1200},
|
||||
0,
|
||||
SENSORORDER_rgb,
|
||||
12, 4, 4, 0x05
|
||||
12, 4, 4, 0x05, _WAF_NONE
|
||||
};
|
||||
|
||||
/* Plustek Model: ???
|
||||
|
@ -369,7 +371,7 @@ static DCapsDef Cap0x07B3_0x0014_4 =
|
|||
{1200, 1200},
|
||||
0,
|
||||
SENSORORDER_rgb,
|
||||
12, 0, 4, 0x04
|
||||
12, 0, 4, 0x04, _WAF_NONE
|
||||
};
|
||||
|
||||
/* Plustek Model: ???
|
||||
|
@ -384,7 +386,7 @@ static DCapsDef Cap0x07B3_0x0014_1 =
|
|||
{400, 400},
|
||||
0,
|
||||
SENSORORDER_rgb,
|
||||
8, 0, 1, 0x04
|
||||
8, 0, 1, 0x04, _WAF_NONE
|
||||
};
|
||||
|
||||
/* Model: ???
|
||||
|
@ -399,7 +401,7 @@ static DCapsDef Cap0x07B3_0x0012_0 =
|
|||
{600, 600},
|
||||
0,
|
||||
SENSORORDER_rgb,
|
||||
4, 0, 0, 0x02
|
||||
4, 0, 0, 0x02, _WAF_NONE
|
||||
};
|
||||
|
||||
/* Plustek Model: ???
|
||||
|
@ -414,7 +416,7 @@ static DCapsDef Cap0x07B3_0x0017_2 =
|
|||
{600, 600},
|
||||
DEVCAPSFLAG_Positive + DEVCAPSFLAG_Negative,
|
||||
SENSORORDER_bgr,
|
||||
8, 4, 2, 0x07
|
||||
8, 4, 2, 0x07, _WAF_NONE
|
||||
};
|
||||
|
||||
/* Plustek Model: ???
|
||||
|
@ -429,7 +431,7 @@ static DCapsDef Cap0x07B3_0x0017_3 =
|
|||
{600, 600},
|
||||
DEVCAPSFLAG_Positive + DEVCAPSFLAG_Negative,
|
||||
SENSORORDER_rgb,
|
||||
8, 4, kNEC8861, 0x07
|
||||
8, 4, kNEC8861, 0x07, _WAF_NONE
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -448,7 +450,7 @@ static DCapsDef Cap0x07B3_0x0017_1 =
|
|||
{600, 600},
|
||||
DEVCAPSFLAG_Positive + DEVCAPSFLAG_Negative,
|
||||
SENSORORDER_rgb,
|
||||
8, 4, 1, 0x07
|
||||
8, 4, 1, 0x07, _WAF_NONE
|
||||
};
|
||||
|
||||
static DCapsDef Cap0x07B3_0x0015_1 =
|
||||
|
@ -460,7 +462,7 @@ static DCapsDef Cap0x07B3_0x0015_1 =
|
|||
{600, 200},
|
||||
0,
|
||||
SENSORORDER_rgb,
|
||||
8, 4, 1, 0x05
|
||||
8, 4, 1, 0x05, _WAF_NONE
|
||||
};
|
||||
|
||||
static DCapsDef Cap0x07B3_0x0015_2 =
|
||||
|
@ -472,7 +474,7 @@ static DCapsDef Cap0x07B3_0x0015_2 =
|
|||
{600, 600},
|
||||
0,
|
||||
SENSORORDER_bgr,
|
||||
8, 4, 2, 0x05
|
||||
8, 4, 2, 0x05, _WAF_NONE
|
||||
};
|
||||
|
||||
/* Plustek Model: ???
|
||||
|
@ -487,7 +489,7 @@ static DCapsDef Cap0x07B3_0x0014_2 =
|
|||
{600, 600},
|
||||
0,
|
||||
SENSORORDER_bgr,
|
||||
8, 0, 2, 0x04
|
||||
8, 0, 2, 0x04, _WAF_NONE
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -504,7 +506,7 @@ static DCapsDef Cap0x03F0_0x0605 =
|
|||
{600, 600},
|
||||
0,
|
||||
SENSORORDER_rgb,
|
||||
4, 0, 0, 0x02
|
||||
4, 0, 0, 0x02, _WAF_NONE
|
||||
};
|
||||
|
||||
/* Mustek BearPaw 1200 (thanks to Henning Meier-Geinitz)
|
||||
|
@ -519,7 +521,7 @@ static DCapsDef Cap0x0400_0x1000_0 =
|
|||
{600, 600},/*1200*/
|
||||
0,
|
||||
SENSORORDER_bgr,
|
||||
4, 5, 3, 0x00
|
||||
4, 5, 3, 0x00, _WAF_NONE
|
||||
};
|
||||
|
||||
/* Mustek BearPaw 2400
|
||||
|
@ -534,7 +536,26 @@ static DCapsDef Cap0x0400_0x1001_0 =
|
|||
{600, 600},
|
||||
0,
|
||||
SENSORORDER_bgr,
|
||||
6, 5, 2, 0x05
|
||||
6, 5, 2, 0x05, _WAF_NONE
|
||||
};
|
||||
|
||||
/* Epson Perfection/Photo1250
|
||||
* NS9832 + Button + CCD????
|
||||
*/
|
||||
static DCapsDef Cap0x04B8_0x010F_0 =
|
||||
{
|
||||
{{ 0, 168}, 0, {2550, 3508}, { 100, 100 }, 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 },
|
||||
{1200, 1200},
|
||||
0,
|
||||
SENSORORDER_bgr,
|
||||
4, /* sensor distance */
|
||||
2, /* number of buttons */
|
||||
kNEC8861, /* use default settings during calibration */
|
||||
0, /* not used here... */
|
||||
_WAF_MISC_IO6_LAMP /* use miscio 6 for lamp switching */
|
||||
};
|
||||
|
||||
/******************* additional Hardware descriptions ************************/
|
||||
|
@ -988,10 +1009,10 @@ static HWDef Hw0x03F0_0x0605 =
|
|||
{5, 23, 1, 3, 0, 0, 0, 12, 10, 22},
|
||||
|
||||
1, /* StepperPhaseCorrection (0x1a & 0x1b) */
|
||||
14, /* 15,=09bOpticBlackStart (0x1c) */
|
||||
62, /* 60,=09bOpticBlackEnd (0x1d) */
|
||||
110, /* 65,=09wActivePixelsStart (0x1e & 0x1f) */
|
||||
5400, /* 5384 ,wLineEnd=09(0x20 & 0x21) */
|
||||
14, /* 15,= bOpticBlackStart (0x1c) */
|
||||
62, /* 60,= bOpticBlackEnd (0x1d) */
|
||||
110, /* 65,= wActivePixelsStart (0x1e & 0x1f) */
|
||||
5400, /* 5384 ,wLineEnd=(0x20 & 0x21) */
|
||||
|
||||
/* Misc */
|
||||
3, /* bReg_0x45 */
|
||||
|
@ -1059,31 +1080,82 @@ static HWDef Hw0x0400_0x1000_0 =
|
|||
/* BearPaw 2400 */
|
||||
static HWDef Hw0x0400_0x1001_0 =
|
||||
{
|
||||
1.0, 0.9,
|
||||
9, 9,
|
||||
1200,
|
||||
2048,
|
||||
4, 5,
|
||||
3000, 4095,
|
||||
0x02, 0x3f, 0x2f, 0x36,
|
||||
{2, 7, 0, 1, 0, 0, 0, 0, 4, 0},
|
||||
{7, 20, 1, 4, 7, 10, 0, 6, 12, 0},
|
||||
1,
|
||||
16,
|
||||
64,
|
||||
152,
|
||||
5416,
|
||||
3,
|
||||
0,
|
||||
0xfc,
|
||||
0,
|
||||
0xff,
|
||||
64,
|
||||
20,
|
||||
0x0d, 0x88, 0x28, 0x3b,
|
||||
0, 0, 0,
|
||||
SANE_FALSE,
|
||||
MODEL_Tokyo600
|
||||
1.0, 0.9,
|
||||
9, 9,
|
||||
1200,
|
||||
2048,
|
||||
4, 5,
|
||||
3000, 4095,
|
||||
0x02, 0x3f, 0x2f, 0x36,
|
||||
{2, 7, 0, 1, 0, 0, 0, 0, 4, 0},
|
||||
{7, 20, 1, 4, 7, 10, 0, 6, 12, 0},
|
||||
1,
|
||||
16,
|
||||
64,
|
||||
152,
|
||||
5416,
|
||||
3,
|
||||
0,
|
||||
0xfc,
|
||||
0,
|
||||
0xff,
|
||||
64,
|
||||
20,
|
||||
0x0d, 0x88, 0x28, 0x3b,
|
||||
0, 0, 0,
|
||||
SANE_FALSE,
|
||||
MODEL_Tokyo600
|
||||
};
|
||||
|
||||
/* EPSON Perfection/Photo 1250 */
|
||||
static HWDef Hw0x04B8_0x010F_0 =
|
||||
{
|
||||
1.0, /* dMaxMotorSpeed (Max_Speed) */
|
||||
0.9, /* dMaxMoveSpeed (Max_Speed) */
|
||||
12, /* wIntegrationTimeLowLamp */
|
||||
12, /* wIntegrationTimeHighLamp */
|
||||
600, /* wMotorDpi (Full step DPI) */
|
||||
2048, /* wRAMSize (KB) */
|
||||
4, /* wMinIntegrationTimeLowres (ms) */
|
||||
5, /* wMinIntegrationTimeHighres (ms) */
|
||||
3000, /* ok wGreenPWMDutyCycleLow (reg 0x2a + 0x2b) */
|
||||
4095, /* ok wGreenPWMDutyCycleHigh (reg 0x2a + 0x2b) */
|
||||
|
||||
0x02, /* ok bSensorConfiguration (0x0b) */
|
||||
0x04, /* ok sensor control settings (reg 0x0c) */
|
||||
0x7f, /* ok sensor control settings (reg 0x0d) */
|
||||
0x13, /* ok sensor control settings (reg 0x0e) */
|
||||
|
||||
{0x02, 0x07, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00},
|
||||
/* ?? mono (reg 0x0f to 0x18) */
|
||||
|
||||
{0x06, 0x16, 0x00, 0x05, 0x0c, 0x17, 0x00, 0x00, 0x08, 0x14},
|
||||
/* ok color (reg 0x0f to 0x18) */
|
||||
|
||||
1, /* ok StepperPhaseCorrection (reg 0x1a + 0x1b) */
|
||||
0x00, /* ok bOpticBlackStart (reg 0x1c) */
|
||||
0x42, /* ok bOpticBlackEnd (reg 0x1d) */
|
||||
69, /* ok wActivePixelsStart (reg 0x1e + 0x1f) */
|
||||
10766, /* ok wLineEnd (reg 0x20 + 0x21) */
|
||||
|
||||
3, /* ok stepper motor control (reg 0x45) */
|
||||
0, /* ok wStepsAfterPaperSensor2 (reg 0x4c + 0x4d) */
|
||||
0x0c, /* ok acceleration profile (reg 0x51) */
|
||||
0, /* ok lines to process (reg 0x54) */
|
||||
0x0f, /* ok kickstart (reg 0x55) */
|
||||
0x02, /* ok pwm freq (reg 0x56) */
|
||||
1, /* ok pwm duty cycle (reg 0x57) */
|
||||
|
||||
0x09, /* ok Paper sense (reg 0x58) */
|
||||
|
||||
0x41, /* ok misc io12 (reg 0x59) */
|
||||
0x44, /* ok misc io34 (reg 0x5a) */
|
||||
0x49, /* ok 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) */
|
||||
SANE_FALSE, /* has a lm9831? */
|
||||
MODEL_Tokyo600
|
||||
};
|
||||
|
||||
/******************** all available combinations *****************************/
|
||||
|
@ -1134,7 +1206,7 @@ static SetDef Settings[] =
|
|||
{"0x03F0-0x0605", &Cap0x03F0_0x0605, &Hw0x03F0_0x0605, "Scanjet 2200c" },
|
||||
|
||||
/* EPSON... */
|
||||
{"0x04B8-0x010F", &Cap0x07B3_0x0005_2, &Hw0x07B3_0x0007_2, "Perfection 1250/Photo" },
|
||||
{"0x04B8-0x010F", &Cap0x04B8_0x010F_0, &Hw0x04B8_0x010F_0, "Perfection 1250/Photo" },
|
||||
|
||||
/* UMAX... */
|
||||
/* {"0x1606-0x0060", &Cap..., &HW..., "UMAX 3400" }, */
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
*.............................................................................
|
||||
* History:
|
||||
* 0.40 - initial version
|
||||
* 0.41 - added _PTDRV_ADJUST call
|
||||
*
|
||||
*.............................................................................
|
||||
*
|
||||
|
@ -62,11 +63,11 @@
|
|||
*/
|
||||
static int ppDev_open( const char *dev_name, void *misc )
|
||||
{
|
||||
int result;
|
||||
int handle;
|
||||
unsigned short version = _PTDRV_IOCTL_VERSION;
|
||||
int result;
|
||||
int handle;
|
||||
unsigned short version = _PTDRV_IOCTL_VERSION;
|
||||
Plustek_Device *dev = (Plustek_Device *)misc;
|
||||
|
||||
_VAR_NOT_USED( misc );
|
||||
_INIT(0x378,190,15);
|
||||
|
||||
if ((handle = _OPEN(dev_name)) < 0) {
|
||||
|
@ -83,6 +84,8 @@ static int ppDev_open( const char *dev_name, void *misc )
|
|||
return result;
|
||||
}
|
||||
|
||||
_IOCTL( handle, _PTDRV_ADJUST, &dev->adj );
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
||||
|
@ -123,21 +126,7 @@ static int ppDev_getCropInfo( Plustek_Device *dev, pCropInfo crop )
|
|||
*/
|
||||
static int ppDev_putImgInfo( Plustek_Device *dev, pImgDef img )
|
||||
{
|
||||
CmdBlk cb;
|
||||
|
||||
int tmpcx = (short)img->crArea.cx;
|
||||
int tmpcy = (short)img->crArea.cy;
|
||||
|
||||
DBG( _DBG_INFO, "cx = %u, cy =%u\n", tmpcy, tmpcy );
|
||||
|
||||
cb.ucmd.cInf.ImgDef = *img;
|
||||
|
||||
tmpcx = (short)cb.ucmd.cInf.ImgDef.crArea.cx;
|
||||
tmpcy = (short)cb.ucmd.cInf.ImgDef.crArea.cy;
|
||||
|
||||
DBG( _DBG_INFO, "cx = %u, cy =%u\n", tmpcy, tmpcy );
|
||||
|
||||
return _IOCTL( dev->fd, _PTDRV_PUT_IMAGEINFO, &cb );
|
||||
return _IOCTL( dev->fd, _PTDRV_PUT_IMAGEINFO, img );
|
||||
}
|
||||
|
||||
/*.............................................................................
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
* 0.39 - added user-space stuff
|
||||
* added Genius Colorpage Vivid III V2 stuff
|
||||
* 0.40 - added stuff to share with USB and Parport
|
||||
* 0.41 - changed the IOCTL version number
|
||||
* added adjustment stuff
|
||||
*
|
||||
*.............................................................................
|
||||
*
|
||||
|
@ -96,20 +98,21 @@
|
|||
#define _PTDRV_OPEN_DEVICE _IOW('x', 1, unsigned short)/* open */
|
||||
#define _PTDRV_GET_CAPABILITIES _IOR('x', 2, ScannerCaps) /* get caps */
|
||||
#define _PTDRV_GET_LENSINFO _IOR('x', 3, LensInfo) /* get lenscaps */
|
||||
#define _PTDRV_PUT_IMAGEINFO _IOW('x', 4, CmdBlk) /* put image info*/
|
||||
#define _PTDRV_PUT_IMAGEINFO _IOW('x', 4, ImgDef) /* put image info*/
|
||||
#define _PTDRV_GET_CROPINFO _IOR('x', 5, CropInfo) /* get crop */
|
||||
#define _PTDRV_SET_ENV _IOWR('x',6, ScanInfo) /* set env. */
|
||||
#define _PTDRV_START_SCAN _IOR('x', 7, StartScan) /* start scan */
|
||||
#define _PTDRV_STOP_SCAN _IOWR('x', 8, int) /* stop scan */
|
||||
#define _PTDRV_CLOSE_DEVICE _IO('x', 9) /* close */
|
||||
#define _PTDRV_ACTION_BUTTON _IOR('x', 10, int) /* rd act. button*/
|
||||
#define _PTDRV_ADJUST _IOR('x', 11, AdjDef) /* adjust driver */
|
||||
|
||||
/*
|
||||
* this version MUST match the one inside the driver to make sure, that
|
||||
* both sides use the same structures. This version changes each time
|
||||
* the ioctl interface changes
|
||||
*/
|
||||
#define _PTDRV_IOCTL_VERSION 0x0101
|
||||
#define _PTDRV_IOCTL_VERSION 0x0102
|
||||
|
||||
/*.............................................................................
|
||||
* the structures for driver communication
|
||||
|
@ -145,8 +148,6 @@ typedef struct {
|
|||
unsigned long dwPixelsPerLine;
|
||||
unsigned long dwBytesPerLine;
|
||||
unsigned long dwLinesPerArea;
|
||||
unsigned long dwOffsetX;
|
||||
unsigned long dwOffsetY;
|
||||
ImgDef ImgDef;
|
||||
} CropInfo, *pCropInfo;
|
||||
|
||||
|
@ -189,20 +190,24 @@ typedef struct {
|
|||
unsigned short wBeginY; /* offset from top */
|
||||
} LensInfo, *pLensInfo;
|
||||
|
||||
/* TODO: move it out the way...*/
|
||||
typedef struct {
|
||||
union {
|
||||
unsigned short wShadingBufSize; /* output */
|
||||
unsigned short wMapType; /* input */
|
||||
unsigned short wIDOwner; /* output */
|
||||
unsigned short wLensNumber; /* input/output */
|
||||
unsigned short wCmd; /* GetScannerStatus */
|
||||
unsigned long wError; /* Get last error */
|
||||
ScanInfo sInf; /* input */
|
||||
CropInfo cInf; /* input */
|
||||
unsigned long dwSize; /* prefer size */
|
||||
} ucmd;
|
||||
} CmdBlk, *pCmdBlk;
|
||||
int x;
|
||||
int y;
|
||||
} OffsDef, *pOffsDef;
|
||||
|
||||
/*
|
||||
* for adjusting the drivers
|
||||
*/
|
||||
typedef struct {
|
||||
int lampOff;
|
||||
int lampOffOnEnd;
|
||||
int warmup;
|
||||
|
||||
OffsDef pos; /* for adjusting normal scan area */
|
||||
OffsDef tpa; /* for adjusting transparency scan area */
|
||||
OffsDef neg; /* for adjusting negative scan area */
|
||||
|
||||
} AdjDef, *pAdjDef;
|
||||
|
||||
/*
|
||||
* useful for description tables
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
*.............................................................................
|
||||
* History:
|
||||
* 0.40 - starting version of the USB support
|
||||
* 0.41 - no changes
|
||||
*
|
||||
*.............................................................................
|
||||
*
|
||||
|
@ -51,9 +52,6 @@
|
|||
* If you do not wish that, delete this exception notice.
|
||||
*/
|
||||
|
||||
/* the other stuff is included by plustek.c ...*/
|
||||
#include "sane/sanei_usb.h"
|
||||
|
||||
#define CHECK(func) \
|
||||
{ \
|
||||
SANE_Status status; \
|
||||
|
@ -96,7 +94,7 @@ static void usb_initDev( pPlustek_Device dev, int idx, int handle, int vendor )
|
|||
|
||||
/*
|
||||
* the following you normally get from the registry...
|
||||
*usbVendors[i].desc 30 and 8 are for a UT12
|
||||
* 30 and 8 are for a UT12
|
||||
*/
|
||||
dev->usbDev.bStepsToReverse = 30;
|
||||
dev->usbDev.dwBufferSize = 8 * 1024 * 1024; /*min val is 4MB!!!*/
|
||||
|
@ -161,7 +159,7 @@ static int usb_CheckForPlustekDevice( int handle, pPlustek_Device dev )
|
|||
/*
|
||||
* get the PCB-ID
|
||||
*/
|
||||
result = sanei_lm9831_read( handle, 0x59, reg59s, 3, SANE_TRUE );
|
||||
result = sanei_lm983x_read( handle, 0x59, reg59s, 3, SANE_TRUE );
|
||||
if( SANE_STATUS_GOOD != result ) {
|
||||
sanei_usb_close( handle );
|
||||
return -1;
|
||||
|
@ -171,20 +169,20 @@ static int usb_CheckForPlustekDevice( int handle, pPlustek_Device dev )
|
|||
reg59[1] = 0x02; /* PIO3: Input, PIO4: Output as low */
|
||||
reg59[2] = 0x03;
|
||||
|
||||
result = sanei_lm9831_write( handle, 0x59, reg59, 3, SANE_TRUE );
|
||||
result = sanei_lm983x_write( handle, 0x59, reg59, 3, SANE_TRUE );
|
||||
if( SANE_STATUS_GOOD != result ) {
|
||||
sanei_usb_close( handle );
|
||||
return -1;
|
||||
}
|
||||
|
||||
result = sanei_lm9831_read ( handle, 0x02, &pcbID, 1, SANE_TRUE );
|
||||
result = sanei_lm983x_read ( handle, 0x02, &pcbID, 1, SANE_TRUE );
|
||||
if( SANE_STATUS_GOOD != result ) {
|
||||
sanei_usb_close( handle );
|
||||
return -1;
|
||||
}
|
||||
|
||||
pcbID = (u_char)((pcbID >> 2) & 0x07);
|
||||
result = sanei_lm9831_read( handle, 0x59, reg59s, 3, SANE_TRUE );
|
||||
result = sanei_lm983x_read( handle, 0x59, reg59s, 3, SANE_TRUE );
|
||||
if( SANE_STATUS_GOOD != result ) {
|
||||
sanei_usb_close( handle );
|
||||
return -1;
|
||||
|
@ -222,15 +220,26 @@ static void usbDev_shutdown( Plustek_Device *dev )
|
|||
|
||||
DBG( _DBG_INFO, "Shutdown called (dev->fd=%d, %s)\n",
|
||||
dev->fd, dev->sane.name );
|
||||
if( SANE_STATUS_GOOD == sanei_usb_open( dev->sane.name, &handle )) {
|
||||
|
||||
dev->fd = handle;
|
||||
if( NULL == dev->usbDev.ModelStr ) {
|
||||
|
||||
DBG( _DBG_INFO, "Function ignored!\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
if( 0 != dev->usbDev.bLampOffOnEnd ) {
|
||||
|
||||
usb_LampOn( dev, SANE_FALSE, -1, SANE_FALSE );
|
||||
DBG( _DBG_INFO, "Switching lamp of...\n" );
|
||||
|
||||
if( SANE_STATUS_GOOD == sanei_usb_open( dev->sane.name, &handle )) {
|
||||
|
||||
dev->fd = -1;
|
||||
dev->fd = handle;
|
||||
|
||||
usb_LampOn( dev, SANE_FALSE, -1, SANE_FALSE );
|
||||
|
||||
sanei_usb_close( handle );
|
||||
dev->fd = -1;
|
||||
|
||||
sanei_usb_close( handle );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -249,6 +258,9 @@ static int usbDev_open( const char *dev_name, void *misc )
|
|||
|
||||
DBG( _DBG_INFO, "usbDev_open(%s,%s)\n", dev_name, dev->usbId );
|
||||
|
||||
/* preset our internal usb device structure */
|
||||
memset( &dev->usbDev, 0, sizeof(DeviceDef));
|
||||
|
||||
if( SANE_STATUS_GOOD != sanei_usb_open( dev_name, &handle )) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -307,7 +319,7 @@ static int usbDev_open( const char *dev_name, void *misc )
|
|||
usbio_ResetLM983x( dev );
|
||||
dev->fd = -1;
|
||||
#endif
|
||||
sanei_lm9831_reset( handle );
|
||||
sanei_lm983x_reset( handle );
|
||||
|
||||
/*
|
||||
* Plustek uses the misc IO 1/2 to get the PCB ID
|
||||
|
@ -464,9 +476,6 @@ static int usbDev_getCropInfo( Plustek_Device *dev, pCropInfo ci )
|
|||
if( ci->ImgDef.dwFlag & SCANDEF_BoundaryDWORD )
|
||||
ci->dwBytesPerLine = (ci->dwBytesPerLine + 3UL) & 0xfffffffcUL;
|
||||
|
||||
ci->dwOffsetX = (u_long)ci->ImgDef.crArea.x * ci->ImgDef.xyDpi.x / 300UL;
|
||||
ci->dwOffsetY = (u_long)ci->ImgDef.crArea.y * ci->ImgDef.xyDpi.y / 300UL;
|
||||
|
||||
DBG( _DBG_INFO, "PPL = %u\n", ci->dwPixelsPerLine );
|
||||
DBG( _DBG_INFO, "LPA = %u\n", ci->dwLinesPerArea );
|
||||
DBG( _DBG_INFO, "BPL = %u\n", ci->dwBytesPerLine );
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*.............................................................................
|
||||
* History:
|
||||
* 0.40 - starting version of the USB support
|
||||
* 0.41 - added workaround flag to struct DevCaps
|
||||
*
|
||||
*.............................................................................
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
@ -154,6 +156,13 @@ enum _DEVCAPSFLAG
|
|||
DEVCAPSFLAG_Adf = 0x0008
|
||||
};
|
||||
|
||||
enum _WORKAROUNDS
|
||||
{
|
||||
_WAF_NONE = 0x00000000, /* no fix anywhere needed */
|
||||
_WAF_BSHIFT7_BUG = 0x00000001, /* to fix U12 bug in 14bit mode */
|
||||
_WAF_MISC_IO6_LAMP = 0x00000002 /* to make EPSON1250 lamp work */
|
||||
};
|
||||
|
||||
/* Generic usage */
|
||||
enum _CHANNEL
|
||||
{
|
||||
|
@ -225,6 +234,8 @@ typedef struct DevCaps
|
|||
u_char bButtons; /* Number of buttons */
|
||||
u_char bCCD; /* CCD ID */
|
||||
u_char bPCB; /* PCB ID */
|
||||
u_long workaroundFlag; /* Flag to allow special work arounds, see */
|
||||
/* _WORKAROUNDS */
|
||||
|
||||
} DCapsDef, *pDCapsDef;
|
||||
|
||||
|
@ -312,10 +323,10 @@ typedef struct DeviceDef
|
|||
OrgDef Positive; /* Pos film - Pix to adjust scanning orgs */
|
||||
OrgDef Negative; /* Neg film - Pix to adjust scanning orgs */
|
||||
OrgDef Adf; /* Adf - Pixels to adjust scanning origins */
|
||||
u_long dwWarmUp; /* Ticks to wait for lamp stable, in ms. */
|
||||
u_long dwWarmup; /* Ticks to wait for lamp stable, in ms. */
|
||||
u_long dwTicksLampOn; /* The ticks when lamp turns on */
|
||||
u_long dwSecondsLampOn; /* secs for counting when to turn off lamp */
|
||||
u_char bLampOnPeriod; /* How many minutes to keep lamp on */
|
||||
u_long dwLampOnPeriod; /* How many seconds to keep lamp on */
|
||||
SANE_Bool bLampOffOnEnd; /* switch lamp off on end or keep cur. state*/
|
||||
u_char bCurrentLamp; /* The lamp ID */
|
||||
u_char bLastColor; /* The last color channel comes from CCD */
|
||||
u_char bStepsToReverse; /* reg 0x50, this value is from registry */
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
*.............................................................................
|
||||
* History:
|
||||
* 0.40 - starting version of the USB support
|
||||
* 0.41 - added EPSON1250 specific stuff
|
||||
*
|
||||
*.............................................................................
|
||||
*
|
||||
|
@ -237,8 +238,8 @@ static Bool usb_ModuleMove(pPlustek_Device dev, u_char bAction, u_long dwStep)
|
|||
if( !usbio_WriteReg(dev->fd, 0x26, 0x0C))
|
||||
return SANE_FALSE;
|
||||
|
||||
_UIO(sanei_lm9831_write(dev->fd, 0x48, &a_bRegs[0x48], 2, SANE_TRUE));
|
||||
_UIO(sanei_lm9831_write(dev->fd, 0x4A, &a_bRegs[0x4A], 2, SANE_TRUE));
|
||||
_UIO(sanei_lm983x_write(dev->fd, 0x48, &a_bRegs[0x48], 2, SANE_TRUE));
|
||||
_UIO(sanei_lm983x_write(dev->fd, 0x4A, &a_bRegs[0x4A], 2, SANE_TRUE));
|
||||
|
||||
/* disable home */
|
||||
if( !usbio_WriteReg(dev->fd, 0x58, a_bRegs[0x58] & ~7))
|
||||
|
@ -433,8 +434,8 @@ static Bool usb_ModuleToHome( pPlustek_Device dev, Bool fWait )
|
|||
if( !usbio_WriteReg(dev->fd, 0x26, 0x8C))
|
||||
return SANE_FALSE;
|
||||
|
||||
_UIO(sanei_lm9831_write(dev->fd, 0x48, &a_bRegs[0x48], 4, SANE_TRUE));
|
||||
_UIO(sanei_lm9831_write(dev->fd, 0x56, &a_bRegs[0x56], 3, SANE_TRUE));
|
||||
_UIO(sanei_lm983x_write(dev->fd, 0x48, &a_bRegs[0x48], 4, SANE_TRUE));
|
||||
_UIO(sanei_lm983x_write(dev->fd, 0x56, &a_bRegs[0x56], 3, SANE_TRUE));
|
||||
|
||||
if( !usbio_WriteReg(dev->fd, 0x45, a_bRegs[0x45]))
|
||||
return SANE_FALSE;
|
||||
|
@ -539,21 +540,30 @@ static int usb_GetLampStatus( pPlustek_Device dev )
|
|||
{
|
||||
int iLampStatus = 0;
|
||||
pHWDef hw = &dev->usbDev.HwSetting;
|
||||
pDCapsDef sc = &dev->usbDev.Caps;
|
||||
|
||||
|
||||
if( NULL == hw ) {
|
||||
DBG( _DBG_ERROR, "NULL-Pointer detected: usb_GetLampStatus()\n" );
|
||||
return -1;
|
||||
}
|
||||
|
||||
sanei_lm9831_read( dev->fd, 0x29, &a_bRegs[0x29], 0x37-0x29+1, SANE_TRUE );
|
||||
if( _WAF_MISC_IO6_LAMP == (_WAF_MISC_IO6_LAMP & sc->workaroundFlag)) {
|
||||
|
||||
iLampStatus |= DEV_LampReflection;
|
||||
|
||||
} else {
|
||||
|
||||
sanei_lm983x_read(dev->fd, 0x29,&a_bRegs[0x29],0x37-0x29+1,SANE_TRUE);
|
||||
|
||||
if((a_bRegs[0x29] & 3) == 1) {
|
||||
if((a_bRegs[0x29] & 3) == 1) {
|
||||
|
||||
if((a_bRegs[0x2e] * 256 + a_bRegs[0x2f]) > hw->wLineEnd )
|
||||
iLampStatus |= DEV_LampReflection;
|
||||
if((a_bRegs[0x2e] * 256 + a_bRegs[0x2f]) > hw->wLineEnd )
|
||||
iLampStatus |= DEV_LampReflection;
|
||||
|
||||
if((a_bRegs[0x36] * 256 + a_bRegs[0x37]) > hw->wLineEnd )
|
||||
iLampStatus |= DEV_LampTPA;
|
||||
if((a_bRegs[0x36] * 256 + a_bRegs[0x37]) > hw->wLineEnd )
|
||||
iLampStatus |= DEV_LampTPA;
|
||||
}
|
||||
}
|
||||
|
||||
return iLampStatus;
|
||||
|
@ -590,6 +600,7 @@ static Bool usb_LampOn( pPlustek_Device dev,
|
|||
Bool fOn, int iLampID, Bool fResetTimer )
|
||||
{
|
||||
pScanDef scanning = &dev->scanning;
|
||||
pDCapsDef sc = &dev->usbDev.Caps;
|
||||
int iLampStatus = usb_GetLampStatus( dev );
|
||||
|
||||
if( NULL == scanning ) {
|
||||
|
@ -614,23 +625,35 @@ static Bool usb_LampOn( pPlustek_Device dev,
|
|||
}
|
||||
|
||||
if( fOn ) {
|
||||
|
||||
|
||||
if(iLampStatus != iLampID) {
|
||||
|
||||
memset( &a_bRegs[0x29], 0, (0x37-0x29+1));
|
||||
a_bRegs[0x29] = 1; /* mode 1 */
|
||||
|
||||
if( iLampID == DEV_LampReflection ) {
|
||||
a_bRegs[0x2e] = 16383 / 256;
|
||||
a_bRegs[0x2f] = 16383 % 256;
|
||||
}
|
||||
|
||||
if( iLampID == DEV_LampTPA ) {
|
||||
a_bRegs[0x36] = 16383 / 256;
|
||||
a_bRegs[0x37] = 16383 % 256;
|
||||
}
|
||||
|
||||
sanei_lm9831_write( dev->fd, 0x29,
|
||||
/*
|
||||
* EPSON specific stuff
|
||||
*/
|
||||
if(_WAF_MISC_IO6_LAMP==(_WAF_MISC_IO6_LAMP & sc->workaroundFlag)) {
|
||||
|
||||
a_bRegs[0x29] = 3; /* mode 3 */
|
||||
usbio_WriteReg( dev->fd, 0x5b, 0x94 );
|
||||
|
||||
} else {
|
||||
|
||||
a_bRegs[0x29] = 1; /* mode 1 */
|
||||
|
||||
if( iLampID == DEV_LampReflection ) {
|
||||
a_bRegs[0x2e] = 16383 / 256;
|
||||
a_bRegs[0x2f] = 16383 % 256;
|
||||
}
|
||||
|
||||
if( iLampID == DEV_LampTPA ) {
|
||||
a_bRegs[0x36] = 16383 / 256;
|
||||
a_bRegs[0x37] = 16383 % 256;
|
||||
}
|
||||
}
|
||||
|
||||
sanei_lm983x_write( dev->fd, 0x29,
|
||||
&a_bRegs[0x29], 0x37-0x29+1, SANE_TRUE );
|
||||
#if 0
|
||||
if(!(iLampStatus & iLampID) && fResetTimer)
|
||||
|
@ -646,19 +669,31 @@ static Bool usb_LampOn( pPlustek_Device dev,
|
|||
if( iStatusChange != iLampStatus ) {
|
||||
|
||||
memset( &a_bRegs[0x29], 0, 0x37-0x29+1 );
|
||||
a_bRegs[0x29] = 1; /* mode 1 */
|
||||
|
||||
if( iStatusChange & DEV_LampReflection ) {
|
||||
a_bRegs[0x2e] = 16383 / 256;
|
||||
a_bRegs[0x2f] = 16383 % 256;
|
||||
}
|
||||
/*
|
||||
* EPSON specific stuff
|
||||
*/
|
||||
if(_WAF_MISC_IO6_LAMP==(_WAF_MISC_IO6_LAMP & sc->workaroundFlag)) {
|
||||
|
||||
if( iStatusChange & DEV_LampTPA ) {
|
||||
a_bRegs[0x36] = 16383 / 256;
|
||||
a_bRegs[0x37] = 16383 % 256;
|
||||
a_bRegs[0x29] = 3; /* mode 3 */
|
||||
usbio_WriteReg( dev->fd, 0x5b, 0x14 );
|
||||
|
||||
} else {
|
||||
|
||||
a_bRegs[0x29] = 1; /* mode 1 */
|
||||
|
||||
if( iStatusChange & DEV_LampReflection ) {
|
||||
a_bRegs[0x2e] = 16383 / 256;
|
||||
a_bRegs[0x2f] = 16383 % 256;
|
||||
}
|
||||
|
||||
if( iStatusChange & DEV_LampTPA ) {
|
||||
a_bRegs[0x36] = 16383 / 256;
|
||||
a_bRegs[0x37] = 16383 % 256;
|
||||
}
|
||||
}
|
||||
|
||||
sanei_lm9831_write( dev->fd, 0x29,
|
||||
sanei_lm983x_write( dev->fd, 0x29,
|
||||
&a_bRegs[0x29], 0x37-0x29+1, SANE_TRUE );
|
||||
}
|
||||
}
|
||||
|
@ -719,7 +754,7 @@ static SANE_Bool usb_ModuleStatus( pPlustek_Device dev )
|
|||
usbio_WriteReg( dev->fd, 0x07, 0x20 );
|
||||
usbio_WriteReg( dev->fd, 0x07, 0 );
|
||||
|
||||
sanei_lm9831_write( dev->fd, 0x58,
|
||||
sanei_lm983x_write( dev->fd, 0x58,
|
||||
&hw->bReg_0x58, 0x5b-0x58+1, SANE_TRUE );
|
||||
usbio_ReadReg( dev->fd, 2, &value );
|
||||
usbio_ReadReg( dev->fd, 2, &value );
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
*.............................................................................
|
||||
* History:
|
||||
* 0.40 - starting version of the USB support
|
||||
* 0.41 - fixed the 14bit problem for LM9831 devices
|
||||
*
|
||||
*.............................................................................
|
||||
*
|
||||
|
@ -993,7 +994,8 @@ static void usb_GrayDuplicatePseudo16( struct Plustek_Device *dev )
|
|||
*/
|
||||
static void usb_GetImageProc( struct Plustek_Device *dev )
|
||||
{
|
||||
pScanDef scanning = &dev->scanning;
|
||||
pScanDef scanning = &dev->scanning;
|
||||
pDCapsDef sc = &dev->usbDev.Caps;
|
||||
|
||||
bShift = 0;
|
||||
|
||||
|
@ -1086,12 +1088,22 @@ static void usb_GetImageProc( struct Plustek_Device *dev )
|
|||
}
|
||||
}
|
||||
|
||||
if (scanning->sParam.bBitDepth == 8) {
|
||||
if (scanning->dwFlag & SCANFLAG_Pseudo48) {
|
||||
if (scanning->dwFlag & SCANFLAG_RightAlign) {
|
||||
if( scanning->sParam.bBitDepth == 8 ) {
|
||||
|
||||
if( scanning->dwFlag & SCANFLAG_Pseudo48 ) {
|
||||
if( scanning->dwFlag & SCANFLAG_RightAlign ) {
|
||||
bShift = 5;
|
||||
} else {
|
||||
bShift = 0; /*7; Holger Bischof 16.12.2001 */
|
||||
|
||||
/*
|
||||
* this should fix the Bearpaw/U12 discrepancy
|
||||
* in general the fix is needed, but not for the U12
|
||||
* why? - no idea!
|
||||
*/
|
||||
if(_WAF_BSHIFT7_BUG == (_WAF_BSHIFT7_BUG & sc->workaroundFlag))
|
||||
bShift = 0; /* Holger Bischof 16.12.2001 */
|
||||
else
|
||||
bShift = 7;
|
||||
}
|
||||
DBG( _DBG_INFO, "bShift adjusted: %u\n", bShift );
|
||||
}
|
||||
|
@ -1131,7 +1143,7 @@ static SANE_Int usb_ReadData( struct Plustek_Device *dev )
|
|||
|
||||
a_bRegs[0x4F] = 0;
|
||||
|
||||
sanei_lm9831_write( dev->fd, 0x4e, &a_bRegs[0x4e], 2, SANE_TRUE );
|
||||
sanei_lm983x_write( dev->fd, 0x4e, &a_bRegs[0x4e], 2, SANE_TRUE );
|
||||
}
|
||||
|
||||
while( scanning->bLinesToSkip ) {
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
*.............................................................................
|
||||
* History:
|
||||
* 0.40 - starting version of the USB support
|
||||
* 0.41 - moved some functions to a sane library (sanei_lm983x.c)
|
||||
*
|
||||
*.............................................................................
|
||||
*
|
||||
|
@ -51,6 +52,9 @@
|
|||
* If you do not wish that, delete this exception notice.
|
||||
*/
|
||||
|
||||
#include "sane/sanei_usb.h"
|
||||
#include "sane/sanei_lm983x.h"
|
||||
|
||||
#define _UIO(func) \
|
||||
{ \
|
||||
SANE_Status status; \
|
||||
|
@ -61,233 +65,8 @@
|
|||
} \
|
||||
}
|
||||
|
||||
/******************** sanei_lm983x functions... will be moved to lib *********/
|
||||
|
||||
#define _MIN(a,b) ((a) < (b) ? (a) : (b))
|
||||
#define _MAX(a,b) ((a) > (b) ? (a) : (b))
|
||||
|
||||
#define _CMD_BYTE_CNT 4
|
||||
#define _MAX_RETRY 20
|
||||
#define _LM9831_MAX_REG 0x7f
|
||||
#define _MAX_TRANSFER_SIZE 60
|
||||
|
||||
|
||||
/*.............................................................................
|
||||
*
|
||||
*/
|
||||
static SANE_Bool sanei_lm9831_reset( SANE_Int fd )
|
||||
{
|
||||
SANE_Byte cmd_buffer[_CMD_BYTE_CNT];
|
||||
SANE_Byte tmp;
|
||||
SANE_Int i;
|
||||
|
||||
DBG( 7, "sanei_lm9831_reset()\n" );
|
||||
|
||||
for( i = 0; i < _MAX_RETRY; i++ ) {
|
||||
|
||||
/* Read the command register and check that the reset bit is not set
|
||||
* If it is set clear it and return false to indicate that
|
||||
* the bit has only now been cleared
|
||||
*
|
||||
* Write the command bytes for a register read
|
||||
* without increment
|
||||
*/
|
||||
cmd_buffer[0] = 0x01;
|
||||
cmd_buffer[1] = 7;
|
||||
cmd_buffer[2] = 0;
|
||||
cmd_buffer[3] = 1;
|
||||
|
||||
if( _CMD_BYTE_CNT == write( fd, cmd_buffer, _CMD_BYTE_CNT )) {
|
||||
|
||||
/* Then read the register in question */
|
||||
u_long cbBytes = 1;
|
||||
|
||||
if( read( fd, &tmp, cbBytes )) {
|
||||
|
||||
if( tmp & 0x20 ) {
|
||||
|
||||
SANE_Byte wrt_buffer[_CMD_BYTE_CNT + 1];
|
||||
|
||||
/* Write the command bytes for a register read
|
||||
* without increment
|
||||
*/
|
||||
wrt_buffer[0] = 0x00;
|
||||
wrt_buffer[1] = 7;
|
||||
wrt_buffer[2] = 0;
|
||||
wrt_buffer[3] = 1;
|
||||
wrt_buffer[4] = 0; /* <--- The data for the register */
|
||||
|
||||
/* We will attempt to reset it but we really don't do
|
||||
* anything if this fails
|
||||
*/
|
||||
if( write( fd, wrt_buffer, _CMD_BYTE_CNT + 1)) {
|
||||
DBG( 7, "Resetting the LM983x done\n" );
|
||||
return SANE_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return SANE_FALSE;
|
||||
}
|
||||
|
||||
/*.............................................................................
|
||||
*
|
||||
*/
|
||||
static SANE_Status
|
||||
sanei_lm9831_write( SANE_Int fd, SANE_Byte reg, SANE_Byte *buffer,
|
||||
SANE_Word len, SANE_Bool increment)
|
||||
{
|
||||
SANE_Byte command_buffer[_MAX_TRANSFER_SIZE + _CMD_BYTE_CNT];
|
||||
SANE_Int result;
|
||||
SANE_Word bytes, max_len;
|
||||
|
||||
DBG( 15, "sanei_lm9831_write: fd=%d, reg=%d, len=%d, increment=%d\n", fd,
|
||||
reg, len, increment);
|
||||
|
||||
for( bytes = 0; len > 0; ) {
|
||||
|
||||
max_len = _MIN( len, _MAX_TRANSFER_SIZE );
|
||||
|
||||
command_buffer[0] = 0; /* write */
|
||||
command_buffer[1] = reg; /* LM9831 register */
|
||||
|
||||
if( increment == SANE_TRUE ) {
|
||||
command_buffer[0] += 0x02; /* increase reg? */
|
||||
command_buffer[1] += bytes;
|
||||
}
|
||||
|
||||
command_buffer[2] = (max_len >> 8) & 0xff; /* bytes to write MSB */
|
||||
command_buffer[3] = max_len & 0xff; /* bytes to write LSB */
|
||||
|
||||
memcpy( command_buffer + _CMD_BYTE_CNT, buffer + bytes, max_len );
|
||||
|
||||
result = write (fd, command_buffer, max_len + _CMD_BYTE_CNT);
|
||||
if( result < 0 ) {
|
||||
DBG( 1, "sanei_lm9831_write: write failed (%s)\n",strerror(errno));
|
||||
return SANE_STATUS_IO_ERROR;
|
||||
}
|
||||
|
||||
if( result != (max_len + _CMD_BYTE_CNT)) {
|
||||
DBG( 2, "sanei_lm9831_write: short write (%d/%d)\n",
|
||||
result, max_len + _CMD_BYTE_CNT);
|
||||
|
||||
if( result < _CMD_BYTE_CNT ) {
|
||||
DBG( 2, "sanei_lm9831_write: couldn't even send command\n" );
|
||||
return SANE_STATUS_IO_ERROR;
|
||||
}
|
||||
DBG( 2, "sanei_lm9831_write: trying again\n" );
|
||||
}
|
||||
len -= (result - _CMD_BYTE_CNT);
|
||||
bytes += (result - _CMD_BYTE_CNT);
|
||||
}
|
||||
|
||||
DBG(15, "sanei_lm9831_write: succeeded\n");
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
/*.............................................................................
|
||||
*
|
||||
*/
|
||||
static SANE_Status
|
||||
sanei_lm9831_write_byte (SANE_Int fd, SANE_Byte reg, SANE_Byte value)
|
||||
{
|
||||
return sanei_lm9831_write (fd, reg, &value, 1, 0);
|
||||
}
|
||||
|
||||
/*.............................................................................
|
||||
*
|
||||
*/
|
||||
static SANE_Status
|
||||
sanei_lm9831_read (SANE_Int fd, SANE_Byte reg, SANE_Byte *buffer,
|
||||
SANE_Word len, SANE_Bool increment)
|
||||
{
|
||||
SANE_Byte command_buffer[_CMD_BYTE_CNT];
|
||||
SANE_Int result;
|
||||
SANE_Word bytes, max_len, read_bytes;
|
||||
|
||||
DBG (15, "sanei_lm9831_read: fd=%d, reg=%d, len=%d, increment=%d\n", fd,
|
||||
reg, len, increment);
|
||||
|
||||
if (!buffer)
|
||||
{
|
||||
DBG (1, "sanei_lm9831_read: error: buffer == NULL\n");
|
||||
return SANE_STATUS_NO_MEM;
|
||||
}
|
||||
|
||||
for (bytes = 0; len > 0; ) {
|
||||
|
||||
max_len = _MIN(len, 0xFFFF );
|
||||
command_buffer[0] = 1; /* read */
|
||||
command_buffer[1] = reg; /* LM9831 register */
|
||||
|
||||
if (increment) {
|
||||
command_buffer [0] += 0x02;
|
||||
command_buffer [1] += bytes;
|
||||
}
|
||||
|
||||
command_buffer[2] = (max_len >> 8) & 0xff; /* bytes to read MSB */
|
||||
command_buffer[3] = max_len & 0xff; /* bytes to read LSB */
|
||||
|
||||
DBG (15, "sanei_lm9831_read: writing command: "
|
||||
"%02x %02x %02x %02x\n", command_buffer[0], command_buffer[1],
|
||||
command_buffer[2], command_buffer[3]);
|
||||
|
||||
result = write (fd, command_buffer, _CMD_BYTE_CNT);
|
||||
if (result < 0) {
|
||||
DBG (1, "sanei_lm9831_read: failed while writing command (%s)\n",
|
||||
strerror(errno));
|
||||
return SANE_STATUS_IO_ERROR;
|
||||
}
|
||||
|
||||
if (result != _CMD_BYTE_CNT) {
|
||||
DBG (2, "sanei_lm9831_read: short write while writing command "
|
||||
"(%d/_CMD_BYTE_CNT)\n", result);
|
||||
return SANE_STATUS_IO_ERROR;
|
||||
}
|
||||
|
||||
read_bytes = 0;
|
||||
|
||||
do {
|
||||
result = read (fd, buffer + bytes + read_bytes, max_len - read_bytes);
|
||||
if (result < 0 ) {
|
||||
|
||||
/* if we get killed by SIGTERM or so,
|
||||
* we flush the reading stuff
|
||||
*/
|
||||
if( EINTR == errno ) {
|
||||
|
||||
sanei_lm9831_reset( fd );
|
||||
return SANE_STATUS_EOF;
|
||||
}
|
||||
|
||||
DBG (1, "sanei_lm9831_read: failed while reading (%s)\n",
|
||||
strerror(errno));
|
||||
return SANE_STATUS_IO_ERROR;
|
||||
}
|
||||
if (result == 0) {
|
||||
DBG (4, "sanei_lm9831_read: got eof\n");
|
||||
return SANE_STATUS_EOF;
|
||||
}
|
||||
read_bytes += result;
|
||||
DBG (15, "sanei_lm9831_read: read %d bytes\n", result);
|
||||
|
||||
if (read_bytes != max_len) {
|
||||
DBG (2, "sanei_lm9831_read: short read (%d/%d)\n", result,
|
||||
max_len);
|
||||
usleep (10000);
|
||||
DBG (2, "sanei_lm9831_read: trying again\n");
|
||||
}
|
||||
} while (read_bytes < max_len);
|
||||
bytes += (max_len);
|
||||
len -= (max_len);
|
||||
}
|
||||
DBG(15, "sanei_lm9831_read: succeeded\n");
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
#define usbio_ReadReg(fd, reg, value) \
|
||||
sanei_lm9831_read (fd, reg, value, 1, 0)
|
||||
sanei_lm983x_read (fd, reg, value, 1, 0)
|
||||
|
||||
/*.............................................................................
|
||||
*
|
||||
|
@ -296,7 +75,7 @@ static Bool usbio_WriteReg( SANE_Int handle, SANE_Byte reg, SANE_Byte value )
|
|||
{
|
||||
SANE_Byte data;
|
||||
|
||||
_UIO( sanei_lm9831_write_byte( handle, reg, value));
|
||||
_UIO( sanei_lm983x_write_byte( handle, reg, value));
|
||||
|
||||
/* Flush register 0x02 when register 0x58 is written */
|
||||
if( 0x58 == reg ) {
|
||||
|
@ -318,8 +97,8 @@ static SANE_Status usbio_DetectLM983x( SANE_Int fd, SANE_Byte *version )
|
|||
|
||||
DBG( _DBG_INFO, "usbio_DetectLM983x\n");
|
||||
|
||||
_UIO( sanei_lm9831_write_byte(fd, 0x07, 0x00));
|
||||
_UIO( sanei_lm9831_write_byte(fd, 0x08, 0x02));
|
||||
_UIO( sanei_lm983x_write_byte(fd, 0x07, 0x00));
|
||||
_UIO( sanei_lm983x_write_byte(fd, 0x08, 0x02));
|
||||
_UIO( usbio_ReadReg(fd, 0x07, &value));
|
||||
_UIO( usbio_ReadReg(fd, 0x08, &value));
|
||||
_UIO( usbio_ReadReg(fd, 0x69, &value));
|
||||
|
@ -355,9 +134,9 @@ static SANE_Status usbio_ResetLM983x( pPlustek_Device dev )
|
|||
|
||||
if( hw->fLM9831 ) {
|
||||
|
||||
_UIO( sanei_lm9831_write_byte( dev->fd, 0x07, 0));
|
||||
_UIO( sanei_lm9831_write_byte( dev->fd, 0x07,0x20));
|
||||
_UIO( sanei_lm9831_write_byte( dev->fd, 0x07, 0));
|
||||
_UIO( sanei_lm983x_write_byte( dev->fd, 0x07, 0));
|
||||
_UIO( sanei_lm983x_write_byte( dev->fd, 0x07,0x20));
|
||||
_UIO( sanei_lm983x_write_byte( dev->fd, 0x07, 0));
|
||||
_UIO( usbio_ReadReg( dev->fd, 0x07, &value));
|
||||
if (value != 0) {
|
||||
DBG( _DBG_ERROR, "usbio_ResetLM983x: "
|
||||
|
@ -365,7 +144,7 @@ static SANE_Status usbio_ResetLM983x( pPlustek_Device dev )
|
|||
return SANE_STATUS_INVAL;
|
||||
}
|
||||
} else {
|
||||
_UIO( sanei_lm9831_write_byte( dev->fd, 0x07, 0));
|
||||
_UIO( sanei_lm983x_write_byte( dev->fd, 0x07, 0));
|
||||
}
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
*.............................................................................
|
||||
* History:
|
||||
* 0.40 - starting version of the USB support
|
||||
* 0.41 - fixed brightness problem for lineart mode
|
||||
*
|
||||
*.............................................................................
|
||||
*
|
||||
|
@ -81,7 +82,7 @@ static SANE_Bool usb_LinearMapDownload( pPlustek_Device dev )
|
|||
usbio_WriteReg( dev->fd, 0x05, 0 );
|
||||
|
||||
/* write the gamma table entry to merlin */
|
||||
sanei_lm9831_write( dev->fd, 0x06,
|
||||
sanei_lm983x_write( dev->fd, 0x06,
|
||||
a_bMap+i*_MAP_SIZE, _MAP_SIZE, SANE_FALSE );
|
||||
}
|
||||
|
||||
|
@ -249,10 +250,10 @@ static SANE_Bool usb_MapDownload( pPlustek_Device dev, u_char bDataType )
|
|||
for( i = 0; i < (int)_MAP_SIZE; i++, pMap++ )
|
||||
map[i] = ~*pMap;
|
||||
|
||||
sanei_lm9831_write( dev->fd, 0x06, map, _MAP_SIZE, SANE_FALSE );
|
||||
sanei_lm983x_write( dev->fd, 0x06, map, _MAP_SIZE, SANE_FALSE );
|
||||
|
||||
} else {
|
||||
sanei_lm9831_write( dev->fd, 0x06, a_bMap+color*_MAP_SIZE,
|
||||
sanei_lm983x_write( dev->fd, 0x06, a_bMap+color*_MAP_SIZE,
|
||||
_MAP_SIZE, SANE_FALSE );
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
*.............................................................................
|
||||
* History:
|
||||
* 0.40 - starting version of the USB support
|
||||
* 0.41 - minor fixes
|
||||
*
|
||||
*.............................................................................
|
||||
*
|
||||
|
@ -904,12 +905,12 @@ static Bool usb_SetScanParameters( pPlustek_Device dev, pScanParam pParam )
|
|||
memset( &a_bRegs[0x5C], 0, 0x7F-0x5C+1 );
|
||||
|
||||
/* 0x08 - 0x5E */
|
||||
_UIO(sanei_lm9831_write( dev->fd, 0x08, &a_bRegs[0x08], 0x5E - 0x08+1, SANE_TRUE));
|
||||
_UIO(sanei_lm983x_write( dev->fd, 0x08, &a_bRegs[0x08], 0x5E - 0x08+1, SANE_TRUE));
|
||||
|
||||
/* 0x03 - 0x05 */
|
||||
_UIO(sanei_lm9831_write( dev->fd, 0x03, &a_bRegs[0x03], 3, SANE_TRUE));
|
||||
_UIO(sanei_lm983x_write( dev->fd, 0x03, &a_bRegs[0x03], 3, SANE_TRUE));
|
||||
/* 0x5C - 0x7F */
|
||||
_UIO(sanei_lm9831_write( dev->fd, 0x5C, &a_bRegs[0x5C], 0x7F - 0x5C +1, SANE_TRUE));
|
||||
_UIO(sanei_lm983x_write( dev->fd, 0x5C, &a_bRegs[0x5C], 0x7F - 0x5C +1, SANE_TRUE));
|
||||
|
||||
if( !usbio_WriteReg( dev->fd, 0x07, 0 ))
|
||||
return SANE_FALSE;
|
||||
|
@ -959,7 +960,7 @@ static Bool usb_ScanBegin( pPlustek_Device dev, Bool fAutoPark )
|
|||
u_long dwBytesToRead = m_bOldScanData * hw->wDRAMSize * 4;
|
||||
u_char *pBuffer = malloc( sizeof(u_char) * dwBytesToRead );
|
||||
|
||||
_UIO(sanei_lm9831_read( dev->fd, 0x00, pBuffer, dwBytesToRead, SANE_FALSE ));
|
||||
_UIO(sanei_lm983x_read( dev->fd, 0x00, pBuffer, dwBytesToRead, SANE_FALSE ));
|
||||
|
||||
free( pBuffer );
|
||||
|
||||
|
@ -1039,7 +1040,7 @@ static Bool usb_IsDataAvailableInDRAM( pPlustek_Device dev )
|
|||
|
||||
for(;;) {
|
||||
|
||||
_UIO( sanei_lm9831_read( dev->fd, 0x01, a_bBand, 3, SANE_FALSE ));
|
||||
_UIO( sanei_lm983x_read( dev->fd, 0x01, a_bBand, 3, SANE_FALSE ));
|
||||
|
||||
/* It is not stable for read */
|
||||
if((a_bBand[0] != a_bBand[1]) && (a_bBand[1] != a_bBand[2]))
|
||||
|
@ -1167,7 +1168,7 @@ static Bool usb_ScanReadImage( pPlustek_Device dev, void *pBuf, u_long dwSize )
|
|||
}
|
||||
#endif
|
||||
|
||||
res = sanei_lm9831_read(dev->fd, 0x00, (u_char *)pBuf, dwSize, SANE_FALSE);
|
||||
res = sanei_lm983x_read(dev->fd, 0x00, (u_char *)pBuf, dwSize, SANE_FALSE);
|
||||
|
||||
DBG( _DBG_READ, "usb_ScanReadImage() done, result: %d\n", res );
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
*.............................................................................
|
||||
* History:
|
||||
* 0.40 - starting version of the USB support
|
||||
* 0.41 - minor fixes
|
||||
*
|
||||
*.............................................................................
|
||||
*
|
||||
|
@ -103,12 +104,12 @@ static Bool usb_SetDarkShading( int fd, u_char channel,
|
|||
a_bRegs[0x04] = 0;
|
||||
a_bRegs[0x05] = 0;
|
||||
|
||||
res = sanei_lm9831_write( fd, 0x04, &a_bRegs[0x04], 2, SANE_TRUE );
|
||||
res = sanei_lm983x_write( fd, 0x04, &a_bRegs[0x04], 2, SANE_TRUE );
|
||||
|
||||
/* Download offset coefficients */
|
||||
if( SANE_STATUS_GOOD == res ) {
|
||||
|
||||
res = sanei_lm9831_write(fd, 0x06,
|
||||
res = sanei_lm983x_write(fd, 0x06,
|
||||
(u_char*)lpCoeff, wCount, SANE_FALSE );
|
||||
if( SANE_STATUS_GOOD == res )
|
||||
return SANE_TRUE;
|
||||
|
@ -140,11 +141,11 @@ static Bool usb_SetWhiteShading( int fd, u_char channel,
|
|||
a_bRegs[0x04] = 0;
|
||||
a_bRegs[0x05] = 0;
|
||||
|
||||
res = sanei_lm9831_write( fd, 0x04, &a_bRegs[0x04], 2, SANE_TRUE );
|
||||
res = sanei_lm983x_write( fd, 0x04, &a_bRegs[0x04], 2, SANE_TRUE );
|
||||
|
||||
/* Download offset coefficients */
|
||||
if( SANE_STATUS_GOOD == res ) {
|
||||
res = sanei_lm9831_write(fd, 0x06,
|
||||
res = sanei_lm983x_write(fd, 0x06,
|
||||
(u_char*)lpData, wCount, SANE_FALSE );
|
||||
if( SANE_STATUS_GOOD == res )
|
||||
return SANE_TRUE;
|
||||
|
@ -692,7 +693,7 @@ static Bool usb_AdjustOffset( pPlustek_Device dev )
|
|||
a_bRegs[0x3a] = a_bRegs[0x39] = a_bRegs[0x38];
|
||||
}
|
||||
|
||||
_UIO(sanei_lm9831_write(dev->fd, 0x38, &a_bRegs[0x38], 3, SANE_TRUE));
|
||||
_UIO(sanei_lm983x_write(dev->fd, 0x38, &a_bRegs[0x38], 3, SANE_TRUE));
|
||||
cAdjust >>= 1;
|
||||
}
|
||||
|
||||
|
@ -834,15 +835,27 @@ static Bool usb_AdjustDarkShading( pPlustek_Device dev )
|
|||
(!usb_ScanReadImage(dev,pScanBuffer,m_ScanParam.Size.dwPhyBytes)) ||
|
||||
(!usb_ScanEnd( dev ))) {
|
||||
|
||||
a_bRegs[0x29] = 1;
|
||||
if(_WAF_MISC_IO6_LAMP==(_WAF_MISC_IO6_LAMP & scaps->workaroundFlag)) {
|
||||
a_bRegs[0x29] = 3;
|
||||
usbio_WriteReg( dev->fd, 0x5b, 0x94);
|
||||
} else {
|
||||
a_bRegs[0x29] = 1;
|
||||
}
|
||||
usbio_WriteReg( dev->fd, 0x29, a_bRegs[0x29]);
|
||||
|
||||
DBG( _DBG_ERROR, "usb_AdjustDarkShading() failed\n" );
|
||||
return SANE_FALSE;
|
||||
}
|
||||
|
||||
/* set illumination mode to 1 */
|
||||
a_bRegs[0x29] = 1;
|
||||
/*
|
||||
* set illumination mode to 1 or 3 on EPSON
|
||||
*/
|
||||
if(_WAF_MISC_IO6_LAMP==(_WAF_MISC_IO6_LAMP & scaps->workaroundFlag)) {
|
||||
a_bRegs[0x29] = 3;
|
||||
usbio_WriteReg( dev->fd, 0x5b, 0x94 );
|
||||
} else {
|
||||
a_bRegs[0x29] = 1;
|
||||
}
|
||||
|
||||
if( !usbio_WriteReg( dev->fd, 0x29, a_bRegs[0x29])) {
|
||||
DBG( _DBG_ERROR, "usb_AdjustDarkShading() failed\n" );
|
||||
|
@ -1614,7 +1627,7 @@ static Bool usb_DownloadShadingData( pPlustek_Device dev, u_char bJobID )
|
|||
a_bRegs[0x41] = 0x00;
|
||||
a_bRegs[0x42] = (u_char)(( hw->wDRAMSize > 512)? 0x64: 0x24);
|
||||
|
||||
_UIO(sanei_lm9831_write( dev->fd, 0x40,
|
||||
_UIO(sanei_lm983x_write( dev->fd, 0x40,
|
||||
&a_bRegs[0x40], 0x42-0x40+1, SANE_TRUE ));
|
||||
break;
|
||||
|
||||
|
@ -1669,7 +1682,7 @@ static Bool usb_DownloadShadingData( pPlustek_Device dev, u_char bJobID )
|
|||
a_bRegs[0x41] = 0x00;
|
||||
a_bRegs[0x42] = (u_char)((hw->wDRAMSize > 512)? 0x60: 0x20);
|
||||
|
||||
_UIO(sanei_lm9831_write( dev->fd, 0x3e, &a_bRegs[0x3e],
|
||||
_UIO(sanei_lm983x_write( dev->fd, 0x3e, &a_bRegs[0x3e],
|
||||
0x42 - 0x3e + 1, SANE_TRUE ));
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
* removed function attach_one()
|
||||
* added USB interface stuff
|
||||
* 0.40 - USB scanning works now
|
||||
* 0.41 - added some configuration stuff and also changed .conf file
|
||||
*
|
||||
*.............................................................................
|
||||
*
|
||||
|
@ -111,6 +112,7 @@
|
|||
#include "sane/sanei_backend.h"
|
||||
#include "sane/sanei_config.h"
|
||||
|
||||
/* might be used to disable all USB stuff */
|
||||
#define _PLUSTEK_USB
|
||||
|
||||
#include "plustek-share.h"
|
||||
|
@ -129,6 +131,10 @@
|
|||
#define _DBG_SANE_INIT 10
|
||||
#define _DBG_READ 15
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define _DEFAULT_DEVICE "/dev/pt_drv"
|
||||
|
||||
/* declare it here, as it's used in plustek-usbscan.c too :-( */
|
||||
static SANE_Bool cancelRead;
|
||||
|
||||
|
@ -249,8 +255,34 @@ static SANE_Auth_Callback auth = NULL;
|
|||
|
||||
/****************************** the backend... *******************************/
|
||||
|
||||
/*.............................................................................
|
||||
* open the driver
|
||||
/**
|
||||
* function to display the configuration options for the current device
|
||||
* @param cnf - pointer to the configuration structure whose content should be
|
||||
* displayed
|
||||
*/
|
||||
static void show_cnf( pCnfDef cnf )
|
||||
{
|
||||
DBG( _DBG_SANE_INIT, "Device configuration:\n" );
|
||||
DBG( _DBG_SANE_INIT, "device name : >%s<\n", cnf->devName );
|
||||
DBG( _DBG_SANE_INIT, "porttype : %d\n", cnf->porttype );
|
||||
DBG( _DBG_SANE_INIT, "USB-ID : >%s<\n", cnf->usbId );
|
||||
DBG( _DBG_SANE_INIT, "warmup : %ds\n", cnf->adj.warmup );
|
||||
DBG( _DBG_SANE_INIT, "lampOff : %d\n", cnf->adj.lampOff );
|
||||
DBG( _DBG_SANE_INIT, "lampOffOnEnd : %d\n", cnf->adj.lampOffOnEnd );
|
||||
DBG( _DBG_SANE_INIT, "pos_x : %d\n", cnf->adj.pos.x );
|
||||
DBG( _DBG_SANE_INIT, "pos_y : %d\n", cnf->adj.pos.y );
|
||||
DBG( _DBG_SANE_INIT, "neg_x : %d\n", cnf->adj.neg.x );
|
||||
DBG( _DBG_SANE_INIT, "neg_y : %d\n", cnf->adj.neg.y );
|
||||
DBG( _DBG_SANE_INIT, "tpa_x : %d\n", cnf->adj.tpa.x );
|
||||
DBG( _DBG_SANE_INIT, "tpa_y : %d\n", cnf->adj.tpa.y );
|
||||
DBG( _DBG_SANE_INIT, "---------------------\n" );
|
||||
}
|
||||
|
||||
/**
|
||||
* open the device specific driver and reset the internal timing stuff
|
||||
* @param dev - pointer to the device specific structure
|
||||
* @return the function returns the result of the open call, on success
|
||||
* of course the handle
|
||||
*/
|
||||
static int drvopen( Plustek_Device *dev )
|
||||
{
|
||||
|
@ -265,8 +297,10 @@ static int drvopen( Plustek_Device *dev )
|
|||
return handle;
|
||||
}
|
||||
|
||||
/*.............................................................................
|
||||
* close the driver
|
||||
/*
|
||||
* Calls the devic specific stop and close functions.
|
||||
* @param dev - pointer to the device specific structure
|
||||
* @return The function always returns SANE_STATUS_GOOD
|
||||
*/
|
||||
static SANE_Status drvclose( Plustek_Device *dev )
|
||||
{
|
||||
|
@ -535,8 +569,12 @@ static SANE_Status do_cancel( Plustek_Scanner *scanner, SANE_Bool closepipe )
|
|||
return SANE_STATUS_CANCELLED;
|
||||
}
|
||||
|
||||
/*.............................................................................
|
||||
*
|
||||
/**
|
||||
* because of some internal problems (inside the parport driver, we have to
|
||||
* limit the max resolution to optical resolution. This is done by this
|
||||
* function
|
||||
* @param dev - pointer to the device specific structure
|
||||
* @return The function always returns SANE_STATUS_GOOD
|
||||
*/
|
||||
static SANE_Status limitResolution( Plustek_Device *dev )
|
||||
{
|
||||
|
@ -723,28 +761,30 @@ static SANE_Status init_options( Plustek_Scanner *s )
|
|||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
/*.............................................................................
|
||||
* retrieve the vendor and product id from the cfg file...
|
||||
/**
|
||||
* Function to retrieve the vendor and product id from a given string
|
||||
* @param src - string, that should be investigated
|
||||
* @param dest - pointer to a string to receive the USB ID
|
||||
*/
|
||||
static void getUsbIDs( char **dest, char *src )
|
||||
static void decodeUsbIDs( char *src, char **dest )
|
||||
{
|
||||
char *tmp = *dest;
|
||||
const char *name;
|
||||
char *tmp = *dest;
|
||||
|
||||
if( isspace(src[3])) {
|
||||
strncpy( tmp, &src[4], 13 );
|
||||
tmp[13] = '\0';
|
||||
if( isspace(src[5])) {
|
||||
strncpy( tmp, &src[6], (strlen(src)-6));
|
||||
tmp[(strlen(src)-6)] = '\0';
|
||||
}
|
||||
|
||||
if( '\0' == tmp[0] ) {
|
||||
name = tmp;
|
||||
name = sanei_config_skip_whitespace( name );
|
||||
|
||||
if( '\0' == name[0] ) {
|
||||
DBG( _DBG_SANE_INIT, "next device is a USB device (autodetection)\n" );
|
||||
} else {
|
||||
|
||||
u_short pi = 0, vi = 0;
|
||||
const char *name;
|
||||
u_short pi = 0, vi = 0;
|
||||
|
||||
name = *dest;
|
||||
name = sanei_config_skip_whitespace( name );
|
||||
|
||||
if( *name ) {
|
||||
|
||||
name = sanei_config_get_string( name, &tmp );
|
||||
|
@ -770,11 +810,93 @@ static void getUsbIDs( char **dest, char *src )
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* function to decode an integer value and give it back to the caller.
|
||||
* @param src - pointer to the source string to check
|
||||
* @param opt - string that keeps the option name to check src for
|
||||
* @param result - pointer to the var that should receive our result
|
||||
* @param def - default value that result should be in case of any error
|
||||
* @return The function returns SANE_TRUE if the option has been found,
|
||||
* if not, it returns SANE_FALSE
|
||||
*/
|
||||
static SANE_Bool decodeInt( char *src, char *opt, int *result, int def )
|
||||
{
|
||||
char *tmp, *tmp2;
|
||||
const char *name;
|
||||
|
||||
/* skip the option string */
|
||||
name = (const char*)&src[strlen("option")];
|
||||
|
||||
/* get the name of the option */
|
||||
name = sanei_config_get_string( name, &tmp );
|
||||
|
||||
if( tmp ) {
|
||||
|
||||
/* on success, compare wiht the given one */
|
||||
if( 0 == strcmp( tmp, opt )) {
|
||||
|
||||
DBG( _DBG_SANE_INIT, "Decoding option >%s<\n", opt );
|
||||
|
||||
/* assign the default value for this option... */
|
||||
*result = def;
|
||||
|
||||
if( *name ) {
|
||||
|
||||
/* get the configuration value and decode it */
|
||||
name = sanei_config_get_string( name, &tmp2 );
|
||||
|
||||
if( tmp2 ) {
|
||||
*result = strtol( tmp2, 0, 0 );
|
||||
free( tmp2 );
|
||||
}
|
||||
}
|
||||
return SANE_TRUE;
|
||||
}
|
||||
free( tmp );
|
||||
}
|
||||
|
||||
return SANE_FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* function to retrive the device name of a given string
|
||||
* @param src - string that keeps the option name to check src for
|
||||
* @param dest - pointer to the string, that should receive the detected
|
||||
* devicename
|
||||
* @return The function returns SANE_TRUE if the devicename has been found,
|
||||
* if not, it returns SANE_FALSE
|
||||
*/
|
||||
static SANE_Bool decodeDevName( char *src, char *dest )
|
||||
{
|
||||
char *tmp;
|
||||
const char *name;
|
||||
|
||||
if( 0 == strncmp( "device", src, 6 )) {
|
||||
|
||||
name = (const char*)&src[strlen("device")];
|
||||
name = sanei_config_skip_whitespace( name );
|
||||
|
||||
DBG( _DBG_SANE_INIT, "Decoding device name >%s<\n", name );
|
||||
|
||||
if( *name ) {
|
||||
name = sanei_config_get_string( name, &tmp );
|
||||
if( tmp ) {
|
||||
|
||||
strcpy( dest, tmp );
|
||||
free( tmp );
|
||||
return SANE_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return SANE_FALSE;
|
||||
}
|
||||
|
||||
/*.............................................................................
|
||||
* attach a device to the backend
|
||||
*/
|
||||
static SANE_Status attach( const char *dev_name, char *usbId,
|
||||
PORTTYPE pt, Plustek_Device **devp )
|
||||
static SANE_Status attach( const char *dev_name, pCnfDef cnf,
|
||||
Plustek_Device **devp )
|
||||
{
|
||||
int cntr;
|
||||
int result;
|
||||
|
@ -782,8 +904,7 @@ static SANE_Status attach( const char *dev_name, char *usbId,
|
|||
SANE_Status status;
|
||||
Plustek_Device *dev;
|
||||
|
||||
DBG(_DBG_SANE_INIT, "attach (%s, %s, %u, %p)\n",
|
||||
dev_name, usbId, pt, (void *)devp);
|
||||
DBG(_DBG_SANE_INIT, "attach (%s, %p, %p)\n", dev_name, cnf, (void *)devp);
|
||||
|
||||
/* already attached ?*/
|
||||
for( dev = first_dev; dev; dev = dev->next ) {
|
||||
|
@ -804,14 +925,18 @@ static SANE_Status attach( const char *dev_name, char *usbId,
|
|||
/* assing all the stuff we need fo this device... */
|
||||
|
||||
memset(dev, 0, sizeof (*dev));
|
||||
|
||||
|
||||
dev->fd = -1;
|
||||
dev->name = strdup(dev_name); /* hold it double to avoid */
|
||||
dev->sane.name = dev->name; /* compiler warnings */
|
||||
dev->sane.vendor = "Plustek";
|
||||
dev->usbId = NULL;
|
||||
|
||||
if( PARPORT == pt ) {
|
||||
memcpy( &dev->adj, &cnf->adj, sizeof(AdjDef));
|
||||
|
||||
show_cnf( cnf );
|
||||
|
||||
if( PARPORT == cnf->porttype ) {
|
||||
|
||||
dev->sane.type = "parallel port flatbed scanner";
|
||||
|
||||
|
@ -844,7 +969,16 @@ static SANE_Status attach( const char *dev_name, char *usbId,
|
|||
dev->readImage = usbDev_readImage;
|
||||
dev->shutdown = usbDev_shutdown;
|
||||
|
||||
dev->usbId = strdup( usbId );
|
||||
dev->usbId = strdup( cnf->usbId );
|
||||
|
||||
if( cnf->adj.warmup >= 0 )
|
||||
dev->usbDev.dwWarmup = cnf->adj.warmup;
|
||||
|
||||
if( cnf->adj.lampOff >= 0 )
|
||||
dev->usbDev.dwLampOnPeriod = cnf->adj.lampOff;
|
||||
|
||||
if( cnf->adj.lampOffOnEnd >= 0 )
|
||||
dev->usbDev.bLampOffOnEnd = cnf->adj.lampOffOnEnd;
|
||||
#else
|
||||
free( dev->name );
|
||||
free( dev );
|
||||
|
@ -945,14 +1079,26 @@ static SANE_Status attach( const char *dev_name, char *usbId,
|
|||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
/**
|
||||
* function to preset a configuration structure
|
||||
* @param cnf - pointer to the structure that should be initialized
|
||||
*/
|
||||
static void init_config_struct( pCnfDef cnf )
|
||||
{
|
||||
memset( cnf, 0, sizeof(CnfDef));
|
||||
|
||||
cnf->adj.warmup = -1;
|
||||
cnf->adj.lampOff = -1;
|
||||
cnf->adj.lampOffOnEnd = -1;
|
||||
}
|
||||
|
||||
/*.............................................................................
|
||||
* intialize the backend
|
||||
*/
|
||||
SANE_Status sane_init( SANE_Int *version_code, SANE_Auth_Callback authorize )
|
||||
{
|
||||
char dev_name[PATH_MAX] = "/dev/pt_drv";
|
||||
char usbId[20] = "";
|
||||
PORTTYPE pt;
|
||||
char str[PATH_MAX] = _DEFAULT_DEVICE;
|
||||
CnfDef config;
|
||||
size_t len;
|
||||
FILE *fp;
|
||||
|
||||
|
@ -967,65 +1113,90 @@ SANE_Status sane_init( SANE_Int *version_code, SANE_Auth_Callback authorize )
|
|||
first_dev = NULL;
|
||||
first_handle = NULL;
|
||||
num_devices = 0;
|
||||
pt = PARPORT;
|
||||
|
||||
/* initialize the configuration structure */
|
||||
init_config_struct( &config );
|
||||
|
||||
if( version_code != NULL )
|
||||
*version_code = SANE_VERSION_CODE(V_MAJOR, V_MINOR, 0);
|
||||
|
||||
fp = sanei_config_open( PLUSTEK_CONFIG_FILE );
|
||||
|
||||
/* default to /dev/pt_drv instead of insisting on config file */
|
||||
/* default to _DEFAULT_DEVICE instead of insisting on config file */
|
||||
if( NULL == fp ) {
|
||||
return attach("/dev/pt_drv", NULL, PARPORT, 0);
|
||||
return attach(_DEFAULT_DEVICE, &config, 0);
|
||||
}
|
||||
|
||||
while (sanei_config_read( dev_name, sizeof(dev_name), fp)) {
|
||||
while( sanei_config_read( str, sizeof(str), fp)) {
|
||||
|
||||
DBG( _DBG_SANE_INIT, "sane_init, >%s<\n", dev_name );
|
||||
if( dev_name[0] == '#') /* ignore line comments */
|
||||
DBG( _DBG_SANE_INIT, "sane_init, >%s<\n", str );
|
||||
if( str[0] == '#') /* ignore line comments */
|
||||
continue;
|
||||
|
||||
len = strlen(dev_name);
|
||||
len = strlen(str);
|
||||
if( 0 == len )
|
||||
continue; /* ignore empty lines */
|
||||
|
||||
#if ( V_REV == 1 )||( V_REV == 2 )
|
||||
if( dev_name[len - 1] == '\n' )
|
||||
dev_name[--len] = '\0';
|
||||
|
||||
len = strlen(dev_name);
|
||||
if( 0 == len )
|
||||
continue;
|
||||
#endif
|
||||
|
||||
/* check for port-type: */
|
||||
if( 0 == strncmp(dev_name, "usb", 3)) {
|
||||
/* check for options */
|
||||
if( 0 == strncmp(str, "option", 6)) {
|
||||
|
||||
char *xx = usbId;
|
||||
decodeInt( str, "warmup", &config.adj.warmup, -1 );
|
||||
decodeInt( str, "lampOff", &config.adj.lampOff, -1 );
|
||||
decodeInt( str, "lOffOnEnd", &config.adj.lampOffOnEnd, -1 );
|
||||
|
||||
getUsbIDs( &xx, dev_name );
|
||||
decodeInt( str, "posOffX", &config.adj.pos.x, 0 );
|
||||
decodeInt( str, "posOffY", &config.adj.pos.y, 0 );
|
||||
|
||||
decodeInt( str, "negOffX", &config.adj.neg.x, 0 );
|
||||
decodeInt( str, "negOffY", &config.adj.neg.y, 0 );
|
||||
|
||||
decodeInt( str, "tpaOffX", &config.adj.tpa.x, 0 );
|
||||
decodeInt( str, "tpaOffY", &config.adj.tpa.y, 0 );
|
||||
continue;
|
||||
|
||||
/* check for sections: */
|
||||
} else if( 0 == strncmp( str, "[usb]", 5)) {
|
||||
|
||||
pt = USB;
|
||||
char *tmp;
|
||||
|
||||
/* new section, try and attach previous device */
|
||||
if( config.devName[0] != '\0' )
|
||||
attach( config.devName, &config, 0 );
|
||||
|
||||
/* re-initialize the configuration structure */
|
||||
init_config_struct( &config );
|
||||
|
||||
tmp = config.usbId;
|
||||
decodeUsbIDs( str, &tmp );
|
||||
|
||||
config.porttype = USB;
|
||||
DBG( _DBG_SANE_INIT, "next device is an USB device\n" );
|
||||
continue;
|
||||
|
||||
} else if(( 0 == strncmp(dev_name, "parport", 8))
|
||||
&& ( '\0' == dev_name[8])) {
|
||||
usbId[0] = '\0';
|
||||
pt = PARPORT;
|
||||
} else if(( 0 == strncmp( str, "[parport]", 10))&&( '\0' == str[10])) {
|
||||
|
||||
/* new section, try and attach previous device */
|
||||
if( config.devName[0] != '\0' )
|
||||
attach( config.devName, &config, 0 );
|
||||
|
||||
/* re-initialize the configuration structure */
|
||||
init_config_struct( &config );
|
||||
DBG( _DBG_SANE_INIT, "next device is a PARPORT device\n" );
|
||||
continue;
|
||||
|
||||
} else if( SANE_TRUE == decodeDevName( str, config.devName )) {
|
||||
continue;
|
||||
}
|
||||
|
||||
DBG( _DBG_SANE_INIT, "sane_init, >%s<\n", dev_name );
|
||||
|
||||
attach( dev_name, usbId, pt, 0 );
|
||||
|
||||
/* after attaching the device, reset to PARPORT */
|
||||
pt = PARPORT;
|
||||
usbId[0] = '\0';
|
||||
|
||||
/* ignore other stuff... */
|
||||
DBG( _DBG_SANE_INIT, "ignoring >%s<\n", str );
|
||||
}
|
||||
fclose (fp);
|
||||
|
||||
/* try to attach the last device in the config file... */
|
||||
if( config.devName[0] != '\0' )
|
||||
attach( config.devName, &config, 0 );
|
||||
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
|
@ -1111,7 +1282,7 @@ SANE_Status sane_open( SANE_String_Const devicename, SANE_Handle* handle )
|
|||
SANE_Status status;
|
||||
Plustek_Device *dev;
|
||||
Plustek_Scanner *s;
|
||||
char usbId[20] = "";
|
||||
CnfDef config;
|
||||
|
||||
DBG( _DBG_SANE_INIT, "sane_open - %s\n", devicename );
|
||||
|
||||
|
@ -1123,12 +1294,15 @@ SANE_Status sane_open( SANE_String_Const devicename, SANE_Handle* handle )
|
|||
|
||||
if( !dev ) {
|
||||
|
||||
memset( &config, 0, sizeof(CnfDef));
|
||||
|
||||
/* check if a valid parport-device is meant... */
|
||||
status = attach( devicename, NULL, PARPORT, &dev );
|
||||
status = attach( devicename, &config, &dev );
|
||||
if( SANE_STATUS_GOOD != status ) {
|
||||
|
||||
/* check if a valid usb-device is meant... */
|
||||
status = attach( devicename, usbId, USB, &dev );
|
||||
config.porttype = USB;
|
||||
status = attach( devicename, &config, &dev );
|
||||
if( SANE_STATUS_GOOD != status )
|
||||
return status;
|
||||
}
|
||||
|
@ -1519,10 +1693,6 @@ SANE_Status sane_start( SANE_Handle handle )
|
|||
int scanmode;
|
||||
int fds[2];
|
||||
StartScan start;
|
||||
/* HEINER: Remove!!! */
|
||||
#if 0
|
||||
ImgDef img;
|
||||
#endif
|
||||
CropInfo crop;
|
||||
ScanInfo sinfo;
|
||||
SANE_Status status;
|
||||
|
@ -1665,40 +1835,8 @@ SANE_Status sane_start( SANE_Handle handle )
|
|||
s->params.lines = crop.dwLinesPerArea;
|
||||
|
||||
/* build a SCANINFO block and get ready to scan it */
|
||||
/* HEINER: Remove!!! */
|
||||
#if 0
|
||||
img.xyDpi.x = ndpi;
|
||||
img.xyDpi.y = ndpi;
|
||||
img.crArea.x = left;
|
||||
img.crArea.y = top;
|
||||
img.crArea.cx = width;
|
||||
img.crArea.cy = height;
|
||||
img.wDataType = scanmode;
|
||||
|
||||
if( COLOR_TRUE48 == scanmode )
|
||||
img.wBits = OUTPUT_12Bits;
|
||||
else if( COLOR_TRUE32 == scanmode )
|
||||
img.wBits = OUTPUT_10Bits;
|
||||
else
|
||||
img.wBits = OUTPUT_8Bits;
|
||||
#endif
|
||||
|
||||
sinfo.ImgDef.dwFlag |= (SCANDEF_BuildBwMap | SCANDEF_QualityScan);
|
||||
|
||||
/*
|
||||
* cb.ucmd.sInf.ImgDef.dwFlag |= SCANDEF_Inverse;
|
||||
*/
|
||||
/* HEINER: Remove!!! */
|
||||
#if 0
|
||||
switch( s->val[OPT_EXT_MODE].w ) {
|
||||
case 1: img.dwFlag |= SCANDEF_Transparency; break;
|
||||
case 2: img.dwFlag |= SCANDEF_Negative; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
img.wLens = 1;
|
||||
#endif
|
||||
|
||||
/* set adjustments for brightness and contrast */
|
||||
sinfo.siBrightness = s->val[OPT_BRIGHTNESS].w;
|
||||
sinfo.siContrast = s->val[OPT_CONTRAST].w;
|
||||
|
|
|
@ -2,29 +2,57 @@
|
|||
# For use with Plustek parallel-port scanners and
|
||||
# LM9831/2 based USB scanners
|
||||
#
|
||||
# for multiple devices use
|
||||
# /dev/pt_drv0
|
||||
# /dev/pt_drv1
|
||||
# /dev/pt_drv2
|
||||
# For parport devices use the parport section
|
||||
#
|
||||
# For parport devices enable the parport section
|
||||
# by uncommenting the lines below
|
||||
[parport]
|
||||
device /dev/pt_drv
|
||||
|
||||
#
|
||||
# parport
|
||||
# /dev/pt_drv
|
||||
# leave the default values as specified in /etc/modules.conf
|
||||
#
|
||||
warmup -1
|
||||
lOffOnEnd -1
|
||||
lampOff -1
|
||||
|
||||
|
||||
#
|
||||
# The USB section
|
||||
# each device needs at least two lines:
|
||||
# - usb vendor-ID and product-ID
|
||||
# - devicename
|
||||
# - [usb] vendor-ID and product-ID
|
||||
# - device devicename
|
||||
# i.e. for Plustek (0x07B3) UT12/16/24 (0x0017)
|
||||
# usb 0x07B3 0x0017
|
||||
# /dev/usbscanner
|
||||
# [usb] 0x07B3 0x0017
|
||||
# device /dev/usbscanner
|
||||
#
|
||||
# additionally you can specify some options
|
||||
# warmup, lOffOnEnd, lampOff
|
||||
#
|
||||
# For autodetection
|
||||
# usb
|
||||
# /dev/usbscanner
|
||||
# [usb]
|
||||
# device /dev/usbscanner
|
||||
#
|
||||
|
||||
usb 0x07B3 0x0017
|
||||
/dev/usbscanner
|
||||
[usb] 0x07B3 0x0017
|
||||
|
||||
#
|
||||
# options for the previous USB entry
|
||||
#
|
||||
# switch lamp off after xxx secs, 0 disables the feature
|
||||
option lampOff 0
|
||||
|
||||
# warmup period in seconds, 0 means no warmup
|
||||
option warmup 180
|
||||
|
||||
# 0 means leave lamp-status untouched, not 0 means switch off
|
||||
# on sane_close
|
||||
option lOffOnEnd 0
|
||||
|
||||
#
|
||||
# and of course the device-name
|
||||
#
|
||||
device /dev/usbscanner
|
||||
|
||||
#
|
||||
# to define a new device, start with a new section:
|
||||
# [usb] or [parport]
|
||||
#
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
;
|
||||
|
||||
:backend "plustek" ; name of backend
|
||||
:version "0.40" ; version of backend
|
||||
:version "0.41" ; version of backend
|
||||
:status :stable ; :alpha, :beta, :stable, :new
|
||||
:manpage "sane-plustek" ; name of manpage (if it exists)
|
||||
|
||||
|
@ -153,10 +153,15 @@
|
|||
|
||||
:model "Colorpage Vivid III V2"
|
||||
:interface "Parport (SPP, EPP)"
|
||||
:comment "OK"
|
||||
:comment "OK - Reported as PT12"
|
||||
|
||||
:model "Colorpage Vivid Pro II Film"
|
||||
:interface "Parport (SPP, EPP)"
|
||||
:comment "OK - Reported as OP9636T/12000T"
|
||||
|
||||
:model "Colorpage HR6 V2"
|
||||
:interface "USB"
|
||||
:comment "OK"
|
||||
|
||||
:mfg "BrightScan"
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
* added function pointers to control a scanner device
|
||||
* (Parport and USB)
|
||||
* 0.40 - added USB stuff
|
||||
* 0.41 - added configuration stuff
|
||||
*
|
||||
*.............................................................................
|
||||
*
|
||||
|
@ -138,10 +139,10 @@ enum {
|
|||
};
|
||||
|
||||
/*
|
||||
*
|
||||
* to distinguish between parallelport and USB device
|
||||
*/
|
||||
typedef enum {
|
||||
PARPORT,
|
||||
PARPORT = 0,
|
||||
USB,
|
||||
NUM_PORTTYPES
|
||||
} PORTTYPE;
|
||||
|
@ -166,6 +167,7 @@ typedef struct Plustek_Device
|
|||
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; /* pointer to Vendor and product*/
|
||||
|
@ -222,6 +224,21 @@ typedef const struct mode_param {
|
|||
int scanmode;
|
||||
} ModeParam, *pModeParam;
|
||||
|
||||
|
||||
/*
|
||||
* for collecting configuration info...
|
||||
*/
|
||||
typedef struct {
|
||||
|
||||
char devName[PATH_MAX];
|
||||
PORTTYPE porttype;
|
||||
char usbId[20];
|
||||
|
||||
/* contains the stuff to adjust... */
|
||||
AdjDef adj;
|
||||
|
||||
} CnfDef, *pCnfDef;
|
||||
|
||||
#endif /* guard __PLUSTEK_H__ */
|
||||
|
||||
/* END PLUSTEK.H.............................................................*/
|
||||
|
|
Ładowanie…
Reference in New Issue