From 28edd2af4de7691cbeb8d8215ca9d37747f73915 Mon Sep 17 00:00:00 2001 From: Gerhard Jaeger Date: Fri, 16 Aug 2002 11:43:30 +0000 Subject: [PATCH] Major update. Better support for LM983x based devices. --- backend/plustek-devs.c | 643 ++++++++++++++++++++-------------- backend/plustek-pp.c | 1 + backend/plustek-share.h | 2 + backend/plustek-usb.c | 115 +++--- backend/plustek-usb.h | 100 +++++- backend/plustek-usbhw.c | 338 ++++++++++++------ backend/plustek-usbimg.c | 1 + backend/plustek-usbmap.c | 5 +- backend/plustek-usbscan.c | 312 +++++++++-------- backend/plustek-usbshading.c | 309 +++++++++++----- backend/plustek.c | 44 ++- backend/plustek.conf | 7 + backend/plustek.h | 2 + doc/descriptions/plustek.desc | 98 +++--- po/saneopts.es.po | 52 ++- 15 files changed, 1266 insertions(+), 763 deletions(-) diff --git a/backend/plustek-devs.c b/backend/plustek-devs.c index 1aa04a390..a092a35ad 100644 --- a/backend/plustek-devs.c +++ b/backend/plustek-devs.c @@ -20,6 +20,11 @@ * added HP2100 settings according to Craig Smoothey * added LM9832 based U24 * added CANON650 entry + * 0.43 - tweaked HP 2200C entries + * added _WAF_MISC_IO5 for HP lamp switching + * added motor profiles + * cleanup + * *............................................................................. * * This file is part of the SANE package. @@ -115,12 +120,13 @@ static DCapsDef Cap0x07B3_0x0017_0 = SENSORORDER_rgb, /* bSensorOrder */ 4, /* bSensorDistance */ 4, /* bButtons */ - 0, /* bCCD */ + kNEC3799, /* bCCD */ 0x07, /* bPCB */ - _WAF_NONE /* no workarounds or other special stuff needed */ + _WAF_NONE, /* no workarounds or other special stuff needed */ + _NO_MIO /* does not use misc I/O for lamp */ }; -/* Plustek Model: ??? +/* Plustek Model: U24 * Description of the entries, see above... */ static DCapsDef Cap0x07B3_0x0015_0 = @@ -132,7 +138,7 @@ static DCapsDef Cap0x07B3_0x0015_0 = {600, 600}, 0, SENSORORDER_rgb, - 4, 4, 0, 0x05, _WAF_NONE + 4, 4, kNEC3799, 0x05, _WAF_NONE, _NO_MIO }; /* Plustek Model: ??? @@ -147,7 +153,7 @@ static DCapsDef Cap0x07B3_0x0014_0 = {600, 600}, 0, SENSORORDER_rgb, - 4, 0, 0, 0x04, _WAF_NONE + 4, 0, kNEC3799, 0x04, _WAF_NONE, _NO_MIO }; /* Plustek Model: ??? @@ -162,11 +168,11 @@ static DCapsDef Cap0x07B3_0x0007_0 = {600, 600}, DEVCAPSFLAG_Positive + DEVCAPSFLAG_Negative, SENSORORDER_rgb, - 4, 5, 0, 0x07, _WAF_NONE + 4, 5, kNEC3799, 0x07, _WAF_NONE, _NO_MIO }; /* Plustek Model: ??? - * Hualien: NS9832 + Button + NEC548 + * Tokyo: NS9832 + Button + NEC548 */ static DCapsDef Cap0x07B3_0x0005_2 = { @@ -176,8 +182,8 @@ static DCapsDef Cap0x07B3_0x0005_2 = {{ 0, 0}, 0, {0, 0}, { 0, 0 }, 0 }, {600, 600}, 0, - SENSORORDER_bgr, - 8, 2, 2, 0x05, _WAF_NONE + SENSORORDER_rgb, + 8, 2, kSONY548, 0x05, _WAF_NONE, _NO_MIO }; /* Plustek Model: ??? @@ -192,7 +198,7 @@ static DCapsDef Cap0x07B3_0x0007_4 = {1200, 1200}, DEVCAPSFLAG_Positive + DEVCAPSFLAG_Negative, SENSORORDER_rgb, - 12, 5, 4, 0x07, _WAF_NONE + 12, 5, kNEC3778, 0x07, _WAF_NONE, _NO_MIO }; /* Plustek Model: ??? @@ -207,7 +213,7 @@ static DCapsDef Cap0x07B3_0x0005_4 = {1200, 1200}, 0, SENSORORDER_rgb, - 12, 5, 4, 0x05, _WAF_NONE + 12, 5, kNEC3778, 0x05, _WAF_NONE, _NO_MIO }; /* Plustek Model: ??? @@ -222,7 +228,7 @@ static DCapsDef Cap0x07B3_0x000F_0 = {600, 600}, DEVCAPSFLAG_Normal + DEVCAPSFLAG_Adf, SENSORORDER_rgb, - 4, 5, 0, 0x0F, _WAF_NONE + 4, 5, kNEC3799, 0x0F, _WAF_NONE, _NO_MIO }; @@ -238,7 +244,7 @@ static DCapsDef Cap0x07B3_0x0013_0 = {600, 600}, DEVCAPSFLAG_Positive + DEVCAPSFLAG_Negative, SENSORORDER_rgb, - 4, 4, 0, 0x03, _WAF_NONE + 4, 4, kNEC3799, 0x03, _WAF_NONE, _NO_MIO }; /* Plustek Model: U24 @@ -253,7 +259,7 @@ static DCapsDef Cap0x07B3_0x0011_0 = {600, 600}, 0, SENSORORDER_rgb, - 4, 4, 0, 0x01, _WAF_NONE + 4, 4, kNEC3799, 0x01, _WAF_NONE, _NO_MIO }; /* Plustek Model: U12 @@ -268,11 +274,11 @@ static DCapsDef Cap0x07B3_0x0010_0 = {600, 600}, 0, SENSORORDER_rgb, - 4, 0, 0, 0x00, _WAF_BSHIFT7_BUG + 4, 0, kNEC3799, 0x00, _WAF_BSHIFT7_BUG, _NO_MIO }; /* Plustek Model: ??? - * KH: NS9831 + TPA + Button + NEC3799 + * KH: NS9831 + TPA + Button + NEC3778 */ static DCapsDef Cap0x07B3_0x0013_4 = { @@ -283,11 +289,11 @@ static DCapsDef Cap0x07B3_0x0013_4 = {1200, 1200}, DEVCAPSFLAG_Positive + DEVCAPSFLAG_Negative, SENSORORDER_rgb, - 12, 4, 4, 0x03, _WAF_NONE + 12, 4, kNEC3778, 0x03, _WAF_NONE, _NO_MIO }; /* Plustek Model: ??? - * KH: NS9831 + Button + NEC3799 + * KH: NS9831 + Button + NEC3778 */ static DCapsDef Cap0x07B3_0x0011_4 = { @@ -298,11 +304,11 @@ static DCapsDef Cap0x07B3_0x0011_4 = {1200, 1200}, 0, SENSORORDER_rgb, - 12, 4, 4, 0x01, _WAF_NONE + 12, 4, kNEC3778, 0x01, _WAF_NONE, _NO_MIO }; /* Plustek Model: ??? - * KH: NS9831 + TPA + Button + NEC3799 + * KH: NS9831 + TPA + Button + NEC3778 */ static DCapsDef Cap0x07B3_0x0010_4 = { @@ -313,11 +319,11 @@ static DCapsDef Cap0x07B3_0x0010_4 = {1200, 1200}, 0, SENSORORDER_rgb, - 12, 0, 4, 0x00, _WAF_NONE + 12, 0, kNEC3778, 0x00, _WAF_NONE, _NO_MIO }; /* Plustek Model: ??? - * KH: NS9831 + TPA + Button + NEC3799 + * KH: NS9831 + TPA + Button + NEC3778 */ static DCapsDef Cap0x07B3_0x000F_4 = { @@ -328,11 +334,11 @@ static DCapsDef Cap0x07B3_0x000F_4 = {1200, 1200}, DEVCAPSFLAG_Normal + DEVCAPSFLAG_Adf, SENSORORDER_rgb, - 12, 5, 4, 0x0F, _WAF_NONE + 12, 5, kNEC3778, 0x0F, _WAF_NONE, _NO_MIO }; /* Plustek Model: ??? - * KH: NS9831 + TPA + Button + NEC3799 + * KH: NS9831 + TPA + Button + NEC3778 */ static DCapsDef Cap0x07B3_0x0016_4 = { @@ -343,11 +349,11 @@ static DCapsDef Cap0x07B3_0x0016_4 = {1200, 1200}, DEVCAPSFLAG_Positive + DEVCAPSFLAG_Negative, SENSORORDER_rgb, - 12, 4, 4, 0x06, _WAF_NONE + 12, 4, kNEC3778, 0x06, _WAF_NONE, _NO_MIO }; /* Plustek Model: UT24 - * KH: NS9832 + TPA + Button + NEC3799 + * KH: NS9832 + TPA + Button + NEC3778 */ static DCapsDef Cap0x07B3_0x0017_4 = { @@ -358,11 +364,11 @@ static DCapsDef Cap0x07B3_0x0017_4 = {1200, 1200}, DEVCAPSFLAG_Positive + DEVCAPSFLAG_Negative, SENSORORDER_rgb, - 12, 4, 4, 0x07, _WAF_NONE + 12, 4, kNEC3778, 0x07, _WAF_NONE, _NO_MIO }; /* Plustek Model: ??? - * KH: NS9831 + Button + NEC3799 + * KH: NS9831 + Button + NEC3778 */ static DCapsDef Cap0x07B3_0x0015_4 = { @@ -373,11 +379,11 @@ static DCapsDef Cap0x07B3_0x0015_4 = {1200, 1200}, 0, SENSORORDER_rgb, - 12, 4, 4, 0x05, _WAF_NONE + 12, 4, kNEC3778, 0x05, _WAF_NONE, _NO_MIO }; /* Plustek Model: ??? - * KH: NS9831 + TPA + Button + NEC3799 + * KH: NS9831 + TPA + Button + NEC3778 */ static DCapsDef Cap0x07B3_0x0014_4 = { @@ -388,11 +394,11 @@ static DCapsDef Cap0x07B3_0x0014_4 = {1200, 1200}, 0, SENSORORDER_rgb, - 12, 0, 4, 0x04, _WAF_NONE + 12, 0, kNEC3778, 0x04, _WAF_NONE, _NO_MIO }; /* Plustek Model: ??? - * KH: NS9831 + TPA + Button + NEC3799 + * KH: NS9831 + TPA + Button + SONY518 */ static DCapsDef Cap0x07B3_0x0014_1 = { @@ -403,7 +409,7 @@ static DCapsDef Cap0x07B3_0x0014_1 = {400, 400}, 0, SENSORORDER_rgb, - 8, 0, 1, 0x04, _WAF_NONE + 8, 0, kSONY518, 0x04, _WAF_NONE, _NO_MIO }; /* Model: ??? @@ -418,11 +424,11 @@ static DCapsDef Cap0x07B3_0x0012_0 = {600, 600}, 0, SENSORORDER_rgb, - 4, 0, 0, 0x02, _WAF_NONE + 4, 0, kNEC3799, 0x02, _WAF_NONE, _NO_MIO }; /* Plustek Model: ??? - * KH: NS9831 + TPA + Button + NEC3799 + * KH: NS9831 + TPA + Button + SONY548 */ static DCapsDef Cap0x07B3_0x0017_2 = { @@ -433,7 +439,7 @@ static DCapsDef Cap0x07B3_0x0017_2 = {600, 600}, DEVCAPSFLAG_Positive + DEVCAPSFLAG_Negative, SENSORORDER_bgr, - 8, 4, 2, 0x07, _WAF_NONE + 8, 4, kSONY548, 0x07, _WAF_NONE, _NO_MIO }; /* Plustek Model: ??? @@ -448,7 +454,7 @@ static DCapsDef Cap0x07B3_0x0017_3 = {600, 600}, DEVCAPSFLAG_Positive + DEVCAPSFLAG_Negative, SENSORORDER_rgb, - 8, 4, kNEC8861, 0x07, _WAF_NONE + 8, 4, kNEC8861, 0x07, _WAF_NONE, _NO_MIO }; /* @@ -467,7 +473,7 @@ static DCapsDef Cap0x07B3_0x0017_1 = {600, 600}, DEVCAPSFLAG_Positive + DEVCAPSFLAG_Negative, SENSORORDER_rgb, - 8, 4, 1, 0x07, _WAF_NONE + 8, 4, kSONY518, 0x07, _WAF_NONE, _NO_MIO }; static DCapsDef Cap0x07B3_0x0015_1 = @@ -479,7 +485,7 @@ static DCapsDef Cap0x07B3_0x0015_1 = {600, 200}, 0, SENSORORDER_rgb, - 8, 4, 1, 0x05, _WAF_NONE + 8, 4, kSONY518, 0x05, _WAF_NONE, _NO_MIO }; static DCapsDef Cap0x07B3_0x0015_2 = @@ -491,11 +497,11 @@ static DCapsDef Cap0x07B3_0x0015_2 = {600, 600}, 0, SENSORORDER_bgr, - 8, 4, 2, 0x05, _WAF_NONE + 8, 4, kSONY548, 0x05, _WAF_NONE, _NO_MIO }; /* Plustek Model: ??? - * KH: NS9831 + TPA + Button + NEC3799 + * KH: NS9831 + TPA + Button + SONY548 */ static DCapsDef Cap0x07B3_0x0014_2 = { @@ -506,7 +512,7 @@ static DCapsDef Cap0x07B3_0x0014_2 = {600, 600}, 0, SENSORORDER_bgr, - 8, 0, 2, 0x04, _WAF_NONE + 8, 0, kSONY548, 0x04, _WAF_NONE, _NO_MIO }; #endif @@ -514,66 +520,67 @@ static DCapsDef Cap0x07B3_0x0014_2 = /* Model: HP Scanjet 2100C */ static DCapsDef Cap0x03F0_0x0505 = { - {{ 0, 93}, 0, {2550, 3508}, { 50, 50}, COLOR_BW }, - {{1040 + 15, 744 - 32}, 543, { 473, 414}, {150, 150}, COLOR_GRAY16 }, - {{1004 + 20, 744 + 32}, 543, { 567, 414}, {150, 150}, COLOR_GRAY16 }, - {{ 0, 95}, 0, {2550, 3508}, { 50, 50}, COLOR_BW }, + {{ 0, 208}, 100, {2550, 3508}, { 50, 50}, COLOR_BW }, + {{ 0, 0}, 0, {0, 0}, { 0, 0 }, 0 }, /* No film scanner module */ + {{ 0, 0}, 0, {0, 0}, { 0, 0 }, 0 }, /* No film scanner module */ + {{ 0, 0}, 0, {0, 0}, { 0, 0 }, 0 }, /* No ADF */ {600, 600}, 0, SENSORORDER_rgb, - 4, 0, 0, 0x02, _WAF_NONE + 4, 0, kNEC3799, 0x02, _WAF_NONE, _NO_MIO }; /* Model: HP Scanjet 2200c (thanks to Stefan Nilsen) - * KH: NS9832 + 2 Buttons + NEC3799(?) + 600 DPI Motor + * NS9832 + 2 Buttons + NEC3799 + 600 DPI Motor */ static DCapsDef Cap0x03F0_0x0605 = { - {{ 0, 180 }, /* OK */ - 135, /* OK, most values between 80 and 150 works, Might need - tweaking on different hardware */ - {2550, 3508}, /* OK */ - { 50, 50}, /* OK */ - COLOR_BW }, /* OK */ + /* DataOrigin (x, y), ShadingOriginY */ + {{ 0, 209}, 100, + {2550, 3508 }, { 50, 50}, COLOR_BW }, {{ 0, 0}, 0, {0, 0}, { 0, 0 }, 0 }, /* No film scanner module */ {{ 0, 0}, 0, {0, 0}, { 0, 0 }, 0 }, /* No film scanner module */ {{ 0, 0}, 0, {0, 0}, { 0, 0 }, 0 }, /* No ADF */ {600, 600}, /* Motor can handle 1200 DPI */ - 0, /* OK */ - SENSORORDER_rgb, /* OK */ - 4, 2, 0, 0x02, _WAF_NONE /* OK */ + 0, /* OK */ + SENSORORDER_rgb, /* OK */ + 4, 2, kNEC3799, 0x02, _WAF_NONE, _NO_MIO /* OK */ }; /* Mustek BearPaw 1200 (thanks to Henning Meier-Geinitz) - * NS9831 + 5 Buttons + NEC548 (?) + * NS9831 + 5 Buttons + NEC3798 */ static DCapsDef Cap0x0400_0x1000_0 = { - {{ 67, 55}, 55, {2550, 3530}, { 75, 75 }, COLOR_BW }, - {{ 0, 0}, 0, {0, 0}, { 0, 0 }, 0 }, - {{ 0, 0}, 0, {0, 0}, { 0, 0 }, 0 }, - {{ 0, 0}, 0, {0, 0}, { 0, 0 }, 0 }, - {600, 600},/*1200*/ - 0, - SENSORORDER_bgr, - 4, 5, 3, 0x00, _WAF_NONE -}; - -/* Mustek BearPaw 2400 - * NS9832 + 5 Buttons + NEC548 (?) - */ -static DCapsDef Cap0x0400_0x1001_0 = -{ - {{ 15, 115}, 0, {2550, 3508}, { 100, 100 }, COLOR_BW }, + {{ 0, 130}, 20, {2550, 3508}, { 50, 50 }, 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 }, {600, 600}, 0, - SENSORORDER_bgr, - 6, 5, 2, 0x05, _WAF_NONE + SENSORORDER_rgb, + 4, + 5, kNEC8861, 0x00, _WAF_NONE, _NO_MIO +}; + +/* Mustek BearPaw 2400 + * NS9832 + 5 Buttons + SONY548 + */ +static DCapsDef Cap0x0400_0x1001_0 = +{ + {{ 0, 130/*209*/}, 35/*20*/, {2550, 3508}, { 50, 50 }, 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 }, + { 600, 600 }, /*{ 1200, 1200 }, */ + 0, + SENSORORDER_rgb, + 4/*16*/, /* sensor distance */ + 5, /* number of buttons */ + kSONY548, /* CCD type */ + 0, _WAF_NONE, _NO_MIO }; /* Epson Perfection/Photo1250 (thanks to Gene Heskett and Reinhard Max) @@ -581,9 +588,9 @@ static DCapsDef Cap0x0400_0x1001_0 = */ static DCapsDef Cap0x04B8_0x010F_0 = { - {{ 25, 80}, 10, {2550, 3508}, { 100, 100 }, COLOR_BW }, - {{ 0, 0}, 0, {0, 0}, { 0, 0 }, 0 }, - {{ 0, 0}, 0, {0, 0}, { 0, 0 }, 0 }, + {{ 25, 80}, 10, {2550, 3508}, { 100, 100 }, COLOR_BW }, + {{ 1055, 744 - 84}, 543, { 473, 414}, { 150, 150 }, COLOR_GRAY16 }, + {{1004 + 20, 744 - 20}, 543, { 567, 414}, { 150, 150 }, COLOR_GRAY16 }, {{ 0, 0}, 0, {0, 0}, { 0, 0 }, 0 }, {1200, 1200}, 0, @@ -592,7 +599,8 @@ static DCapsDef Cap0x04B8_0x010F_0 = 4, /* number of buttons */ kNEC8861, /* use default settings during calibration */ 0, /* not used here... */ - _WAF_MISC_IO6_LAMP /* use miscio 6 for lamp switching */ + _WAF_MISC_IO_LAMPS, /* use miscio 6 for lamp switching */ + _MIO6 + _TPA(_MIO1) /* and miscio 1 for optional TPA */ }; /* Umax 3400 @@ -615,7 +623,8 @@ static DCapsDef Cap0x1606_0x0060_0 = 4, /* number of buttons */ kNEC8861, /* use default settings during calibration */ 0, /* not used here... */ - _WAF_MISC_IO3_LAMP /* use miscio 3 for lamp switching */ + _WAF_MISC_IO_LAMPS, /* use miscio 3 for lamp switching */ + _MIO3 }; /* Canon N650U/N656U @@ -633,7 +642,7 @@ static DCapsDef Cap0x04A9_0x2206_0 = 4, /* number of buttons */ kNEC8861, /* use default settings during calibration */ 0, /* not used here... */ - _WAF_NONE + _WAF_NONE, _NO_MIO }; /******************* additional Hardware descriptions ************************/ @@ -694,7 +703,7 @@ static HWDef Hw0x07B3_0x0017_0 = 0, /* bReg_0x5d */ 0, /* bReg_0x5e */ _LM9832, /* chip type */ - MODEL_KaoHsiung /* ScannerModel */ + MODEL_KaoHsiung /* motorModel */ }; static HWDef Hw0x07B3_0x0007_0 = @@ -1039,7 +1048,7 @@ static HWDef Hw0x07B3_0x0017_4 = 0x0d, 0x22, 0x82, 0x88, 0, 0, 0, _LM9832, - MODEL_KaoHsiung + MODEL_KaoHsiung }; static HWDef Hw0x07B3_0x0017_1 = @@ -1115,7 +1124,7 @@ static HWDef Hw0x07B3_0x0012_0 = 0x0d, 0x22, 0x82, 0x88, 0, 0, 0, _LM9832, - MODEL_KaoHsiung + MODEL_KaoHsiung }; static HWDef Hw0x07B3_0x0017_2 = @@ -1191,88 +1200,32 @@ static HWDef Hw0x07B3_0x0017_3 = 0x0d, 0x22, 0x82, 0x88, 0, 0, 0, _LM9832, - MODEL_KaoHsiung + MODEL_KaoHsiung }; /* HP Scanjet 2100C */ static HWDef Hw0x03F0_0x0505 = -{ - 1.5, /* dMaxMotorSpeed (Max_Speed) */ - 1.2, /* dMaxMoveSpeed (Max_Speed) */ - 9, /* wIntegrationTimeLowLamp */ - 9, /* wIntegrationTimeHighLamp */ - 600, /* ok wMotorDpi (Full step DPI) */ - 512, /* wRAMSize (KB) */ - 4, /* dMinIntegrationTimeLowres (ms) */ - 5, /* dMinIntegrationTimeHighres (ms) */ - 3000, /* wGreenPWMDutyCycleLow */ - 4095, /* wGreenPWMDutyCycleHigh */ - 0x02, /* bSensorConfiguration (0x0b) */ - 0x04, /* bReg_0x0c */ - 0x37, /* bReg_0x0d */ - 0x13, /* bReg_0x0e */ - /* bReg_0x0f_Mono[10] (0x0f to 0x18) */ - {2, 7, 0, 1, 0, 0, 0, 0, 4, 0}, - /* bReg_0x0f_Color[10] (0x0f to 0x18) */ - {5, 23, 1, 3, 0, 0, 0, 12, 10, 22}, - - _GREEN_CH, /* bReg_0x26 color mode - bits 4 and 5 */ - 0, /* bReg 0x27 color mode */ - 1, /* bReg 0x29 illumination mode */ - - 1, /* StepperPhaseCorrection (0x1a & 0x1b) */ - 14, /* 15,= bOpticBlackStart (0x1c) */ - 62, /* 60,= bOpticBlackEnd (0x1d) */ - 110, /* 65,= wActivePixelsStart (0x1e & 0x1f) */ - 5400, /* 5384 ,wLineEnd=(0x20 & 0x21) */ - - 0, /* red lamp on (reg 0x2c + 0x2d) */ - 16383, /* red lamp off (reg 0x2e + 0x2f) */ - 0, /* green lamp on (reg 0x30 + 0x31) */ - 0, /* green lamp off (reg 0x32 + 0x33) */ - 0, /* blue lamp on (reg 0x34 + 0x35) */ - 16383, /* blue lamp off (reg 0x36 + 0x37) */ - - /* Misc */ - 3, /* bReg_0x45 */ - 0, /* wStepsAfterPaperSensor2 (0x4c & 0x4d) */ - 0xa8, /* 0xfc -bReg_0x51 */ - 0, /* bReg_0x54 */ - 0xff, /* 0xa3 - bReg_0x55 */ - 64, /* bReg_0x56 */ - 20, /* bReg_0x57 */ - 0x0d, /* bReg_0x58 */ - 0x22, /* bReg_0x59 */ - 0x82, /* bReg_0x5a */ - 0x88, /* bReg_0x5b */ - 0, /* bReg_0x5c */ - 0, /* bReg_0x5d */ - 0, /* bReg_0x5e */ - _LM9832, /* chiptype */ - MODEL_NOPLUSTEK /* ScannerModel */ -}; - -/* HP 2200C */ -static HWDef Hw0x03F0_0x0605 = { 1.05, /* dMaxMotorSpeed (Max_Speed) */ 1.05, /* dMaxMoveSpeed (Max_Speed) */ - 12, /* wIntegrationTimeLowLamp */ - 12, /* wIntegrationTimeHighLamp */ + 6, /* wIntegrationTimeLowLamp */ + 8, /* wIntegrationTimeHighLamp */ 600, /* ok wMotorDpi (Full step DPI) */ 512, /* wRAMSize (KB) */ - 9, /* dMinIntegrationTimeLowres (ms) */ - 9, /* dMinIntegrationTimeHighres (ms) */ + 6, /* dMinIntegrationTimeLowres (ms) */ + 6, /* dMinIntegrationTimeHighres (ms) */ 0, /* wGreenPWMDutyCycleLow */ 0, /* wGreenPWMDutyCycleHigh */ 0x02, /* bSensorConfiguration (0x0b) */ 0x04, /* bReg_0x0c */ - 0x37, /* bReg_0x0d */ - 0x13, /* bReg_0x0e */ + 0x2F, /* bReg_0x0d */ + 0x1F, /* bReg_0x0e */ /* bReg_0x0f_Mono[10] (0x0f to 0x18) */ - {2, 7, 0, 1, 0, 0, 0, 0, 4, 0}, + + { 0x02, 0x07, 0x01, 0x02, 0x02, 0x03, 0x00, 0x00, 0x04, 0x07 }, + /* bReg_0x0f_Color[10] (0x0f to 0x18) */ - {5, 23, 1, 3, 0, 0, 0, 12, 10, 22}, + { 0x08, 0x17, 0x00, 0x03, 0x08, 0x0b, 0x00, 0x00, 0x0a, 0x14 }, _GREEN_CH, /* bReg_0x26 color mode - bits 4 and 5 */ 0, /* bReg 0x27 color mode */ @@ -1280,127 +1233,207 @@ static HWDef Hw0x03F0_0x0605 = 1, /* bReg 0x29 illumination mode */ 1, /* StepperPhaseCorrection (0x1a & 0x1b) */ - 14, /* 15,= bOpticBlackStart (0x1c) */ - 62, /* 60,= bOpticBlackEnd (0x1d) */ - 110, /* 65,= wActivePixelsStart (0x1e & 0x1f) */ - 5384, /* 5400 (?) ,wLineEnd=(0x20 & 0x21) */ + 14, /* bOpticBlackStart (0x1c) */ + 63, /* bOpticBlackEnd (0x1d) */ + 140, /* wActivePixelsStart (0x1e & 0x1f) */ + 5367, /* wLineEnd=(0x20 & 0x21) */ - 0, /* red lamp on (reg 0x2c + 0x2d) */ + 1, /* red lamp on (reg 0x2c + 0x2d) */ 16383, /* red lamp off (reg 0x2e + 0x2f) */ - 0, /* green lamp on (reg 0x30 + 0x31) */ - 0, /* green lamp off (reg 0x32 + 0x33) */ - 0, /* blue lamp on (reg 0x34 + 0x35) */ - 16383, /* blue lamp off (reg 0x36 + 0x37) */ + 16383, /* green lamp on (reg 0x30 + 0x31) */ + 1, /* green lamp off (reg 0x32 + 0x33) */ + 16383, /* blue lamp on (reg 0x34 + 0x35) */ + 1, /* blue lamp off (reg 0x36 + 0x37) */ /* Misc */ - 3, /* bReg_0x45 */ + 0x13, /* bReg_0x45 */ 0, /* wStepsAfterPaperSensor2 (0x4c & 0x4d) */ - 0xa8, /* 0xfc -bReg_0x51 */ + 0xfc, /* 0xa8 -bReg_0x51 */ 0, /* bReg_0x54 */ - 0xff, /* 0xa3 - bReg_0x55 */ - 64, /* bReg_0x56 */ - 20, /* bReg_0x57 */ + 0x18, /* bReg_0x55 */ + 8, /* bReg_0x56 */ + 60, /* bReg_0x57 */ 0x0d, /* bReg_0x58 */ - 0x22, /* bReg_0x59 */ - 0x82, /* bReg_0x5a */ - 0x88, /* bReg_0x5b */ + 0xcc, /* bReg_0x59 */ + 0xbc, /* bReg_0x5a */ + 0xbb, /* bReg_0x5b */ + 0, /* bReg_0x5c */ + 0, /* bReg_0x5d */ + 0, /* bReg_0x5e */ + _LM9831, /* chiptype */ + MODEL_HP /* motorModel */ +}; + +/* HP 2200C */ +static HWDef Hw0x03F0_0x0605 = +{ + 1.05, /* dMaxMotorSpeed (Max_Speed) */ + 1.05, /* dMaxMoveSpeed (Max_Speed) */ + 6, /* wIntegrationTimeLowLamp */ + 8, /* wIntegrationTimeHighLamp */ + 600, /* ok wMotorDpi (Full step DPI) */ + 512, /* wRAMSize (KB) */ + 6, /* dMinIntegrationTimeLowres (ms) */ + 6, /* dMinIntegrationTimeHighres (ms) */ + 0, /* wGreenPWMDutyCycleLow */ + 0, /* wGreenPWMDutyCycleHigh */ + 0x02, /* bSensorConfiguration (0x0b) */ + 0x04, /* bReg_0x0c */ + 0x2F, /* bReg_0x0d */ + 0x1F, /* bReg_0x0e */ + /* bReg_0x0f_Mono[10] (0x0f to 0x18) */ + + { 0x02, 0x07, 0x01, 0x02, 0x02, 0x03, 0x00, 0x00, 0x04, 0x07 }, + + /* bReg_0x0f_Color[10] (0x0f to 0x18) */ + { 0x08, 0x17, 0x00, 0x03, 0x08, 0x0b, 0x00, 0x00, 0x0a, 0x14 }, + + _GREEN_CH, /* bReg_0x26 color mode - bits 4 and 5 */ + 0, /* bReg 0x27 color mode */ + + 1, /* bReg 0x29 illumination mode */ + + 1, /* StepperPhaseCorrection (0x1a & 0x1b) */ + 14, /* bOpticBlackStart (0x1c) */ + 63, /* bOpticBlackEnd (0x1d) */ + 140, /* wActivePixelsStart (0x1e & 0x1f) */ + 5367, /* wLineEnd=(0x20 & 0x21) */ + + 1, /* red lamp on (reg 0x2c + 0x2d) */ + 16383, /* red lamp off (reg 0x2e + 0x2f) */ + 16383, /* green lamp on (reg 0x30 + 0x31) */ + 1, /* green lamp off (reg 0x32 + 0x33) */ + 16383, /* blue lamp on (reg 0x34 + 0x35) */ + 1, /* blue lamp off (reg 0x36 + 0x37) */ + + /* Misc */ + 0x13, /* bReg_0x45 */ + 0, /* wStepsAfterPaperSensor2 (0x4c & 0x4d) */ + 0xfc, /* 0xa8 -bReg_0x51 */ + 0, /* bReg_0x54 */ + 0x18, /* bReg_0x55 */ + 8, /* bReg_0x56 */ + 60, /* bReg_0x57 */ + 0x0d, /* bReg_0x58 */ + 0xcc, /* bReg_0x59 */ + 0xbc, /* bReg_0x5a */ + 0xbb, /* bReg_0x5b */ 0, /* bReg_0x5c */ 0, /* bReg_0x5d */ 0, /* bReg_0x5e */ _LM9832, /* chiptype */ - MODEL_NOPLUSTEK /* ScannerModel */ + MODEL_HP /* motorModel */ }; /* Mustek BearPaw 1200 */ static HWDef Hw0x0400_0x1000_0 = { - 1.25, /* ok dMaxMotorSpeed (Max_Speed) */ - 1.25, /* ok dMaxMoveSpeed (Max_Speed) */ - 12, /* ok wIntegrationTimeLowLamp */ - 12, /* ok wIntegrationTimeHighLamp */ - 600, /* ok wMotorDpi (Full step DPI) */ - 512, /* ok wRAMSize (KB) */ - 9, /* ok dMinIntegrationTimeLowres (ms) */ - 9, /* ok dMinIntegrationTimeHighres (ms) */ - 1169, /* ok wGreenPWMDutyCycleLow (reg 0x2a + 0x2b) */ - 1169, /* ok wGreenPWMDutyCycleHigh (reg 0x2a + 0x2b) */ - 0x02, /* ok bSensorConfiguration (0x0b) */ - 0x7c, /* ok sensor control settings (reg 0x0c) */ - 0x3f, /* ok sensor control settings (reg 0x0d) */ - 0x15, /* ok sensor control settings (reg 0x0e) */ - {0x04, 0x07, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x03, 0x06}, - /* ok mono (reg 0x0f to 0x18) */ - {0x04, 0x16, 0x01, 0x02, 0x05, 0x06, 0x00, 0x00, 0x0a, 0x16}, - /* ok color (reg 0x0f to 0x18) */ - _GREEN_CH, /* bReg_0x26 color mode - bits 4 and 5 */ - 0, /* bReg 0x27 color mode */ - 1, /* bReg 0x29 illumination mode */ - 257, /* ok StepperPhaseCorrection (reg 0x1a + 0x1b) */ - 0x0e, /* ok bOpticBlackStart (reg 0x1c) */ - 0x1d, /* ok bOpticBlackEnd (reg 0x1d) */ - 0, /* ok wActivePixelsStart (reg 0x1e + 0x1f) */ - 5369, /* ok wLineEnd (reg 0x20 + 0x21) */ - 0, /* red lamp on (reg 0x2c + 0x2d) */ - 16383, /* red lamp off (reg 0x2e + 0x2f) */ - 0, /* green lamp on (reg 0x30 + 0x31) */ - 0, /* green lamp off (reg 0x32 + 0x33) */ - 0, /* blue lamp on (reg 0x34 + 0x35) */ - 16383, /* blue lamp off (reg 0x36 + 0x37) */ - 0x13, /* ok stepper motor control (reg 0x45) */ - 0, /* ? wStepsAfterPaperSensor2 (reg 0x4c + 0x4d) */ - 0xfc, /* ok acceleration profile (reg 0x51) */ - 0, /* ok lines to process (reg 0x54) */ - 0x13, /* ok kickstart (reg 0x55) */ - 0x03, /* ok pwm freq (reg 0x56) */ - 0x20, /* ok pwm duty cycle (reg 0x57) */ - 0x15, /* ok Paper sense (reg 0x58) */ - 0x44, /* ok misc io12 (reg 0x59) */ - 0x44, /* ok misc io34 (reg 0x5a) */ - 0x4f, /* ok misc io56 (reg 0x5b) */ - 0, /* ok test mode ADC Output CODE MSB (reg 0x5c) */ - 0, /* ok test mode ADC Output CODE LSB (reg 0x5d) */ - 0, /* ok test mode (reg 0x5e) */ + 1.25, /* ok dMaxMotorSpeed (Max_Speed) */ + 1.25, /* ok dMaxMoveSpeed (Max_Speed) */ + 12, /* ok wIntegrationTimeLowLamp */ + 12, /* ok wIntegrationTimeHighLamp */ + 600, /* ok wMotorDpi (Full step DPI) */ + 512, /* ok wRAMSize (KB) */ + 9, /* ok dMinIntegrationTimeLowres (ms) */ + 9, /* ok dMinIntegrationTimeHighres (ms) */ + 1169, /* ok wGreenPWMDutyCycleLow (reg 0x2a + 0x2b) */ + 1169, /* ok wGreenPWMDutyCycleHigh (reg 0x2a + 0x2b) */ + 0x02, /* ok bSensorConfiguration (0x0b) */ + 0x7c, /* ok sensor control settings (reg 0x0c) */ + 0x3f, /* ok sensor control settings (reg 0x0d) */ + 0x15, /* ok sensor control settings (reg 0x0e) */ + /* ok mono (reg 0x0f to 0x18) */ + { 0x04, 0x07, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x03, 0x06}, + /* ok color (reg 0x0f to 0x18) */ + { 0x04, 0x16, 0x01, 0x02, 0x05, 0x06, 0x00, 0x00, 0x0a, 0x16}, + _GREEN_CH, /* bReg_0x26 color mode - bits 4 and 5 */ + 0, /* bReg 0x27 color mode */ + 1, /* bReg 0x29 illumination mode */ + 257, /* ok StepperPhaseCorrection (reg 0x1a + 0x1b) */ + 0x0e, /* ok bOpticBlackStart (reg 0x1c) */ + 0x1d, /* ok bOpticBlackEnd (reg 0x1d) */ + 140, /* ok wActivePixelsStart (reg 0x1e + 0x1f) */ + 5369, /* ok wLineEnd (reg 0x20 + 0x21) */ + 0, /* red lamp on (reg 0x2c + 0x2d) */ + 16383, /* red lamp off (reg 0x2e + 0x2f) */ + 0, /* green lamp on (reg 0x30 + 0x31) */ + 0, /* green lamp off (reg 0x32 + 0x33) */ + 0, /* blue lamp on (reg 0x34 + 0x35) */ + 16383, /* blue lamp off (reg 0x36 + 0x37) */ + 0x13, /* ok stepper motor control (reg 0x45) */ + 0, /* wStepsAfterPaperSensor2 (reg 0x4c + 0x4d) */ + 0xfc, /* ok acceleration profile (reg 0x51) */ + 0, /* ok lines to process (reg 0x54) */ + 0x13, /* ok kickstart (reg 0x55) */ + 0x03, /* ok pwm freq (reg 0x56) */ + 0x20, /* ok pwm duty cycle (reg 0x57) */ + 0x0d, /* ok Paper sense (reg 0x58) */ + 0x44, /* ok misc io12 (reg 0x59) */ + 0x44, /* ok misc io34 (reg 0x5a) */ + 0x4f, /* ok misc io56 (reg 0x5b) */ + 0, /* ok test mode ADC Output CODE MSB (reg 0x5c) */ + 0, /* ok test mode ADC Output CODE LSB (reg 0x5d) */ + 0, /* ok test mode (reg 0x5e) */ _LM9831, - MODEL_Tokyo600 + MODEL_MUSTEK600 }; /* BearPaw 2400 */ static HWDef Hw0x0400_0x1001_0 = { - 1.0, 0.9, - 9, 9, - 1200, - 2048, - 4, 5, - 3000, 4095, - 0x02, 0x3f, 0x2f, 0x36, +1.0 /* 1.8*/, /* ok dMaxMotorSpeed (Max_Speed) */ +0.9 /*1.8 */, /* ok dMaxMoveSpeed (Max_Speed) */ + 12, /* ok wIntegrationTimeLowLamp */ + 12, /* ok wIntegrationTimeHighLamp */ +1200 /* 600*/ , /* ok wMotorDpi (Full step DPI) */ + 2048, /* ok wRAMSize (KB) */ + 9, /* ok dMinIntegrationTimeLowres (ms) */ + 9, /* ok dMinIntegrationTimeHighres (ms) */ + 1169, /* ok wGreenPWMDutyCycleLow (reg 0x2a + 0x2b) */ + 1169, /* ok wGreenPWMDutyCycleHigh (reg 0x2a + 0x2b) */ + +0x02 /* 0x06*/, /* ok bSensorConfiguration (0x0b) */ + 0x3c, /* ok sensor control settings (reg 0x0c) */ + 0x3f, /* ok sensor control settings (reg 0x0d) */ + 0x11, /* ok sensor control settings (reg 0x0e) */ + /* ok mono (reg 0x0f to 0x18) */ + {2, 7, 0, 1, 0, 0, 0, 0, 4, 0}, - {7, 20, 1, 4, 7, 10, 0, 6, 12, 0}, - _GREEN_CH, - 0, - 1, - 1, - 16, - 64, - 152, - 5416, - 0, - 16383, - 0, - 0, - 0, - 16383, - 3, - 0, - 0xfc, - 0, - 0xff, - 64, - 20, - 0x0d, 0x88, 0x28, 0x3b, - 0, 0, 0, + +/* {5, 14, 12, 15, 18, 21, 0, 0, 0, 9 },*/ + {1, 4, 4, 5, 6, 7, 0, 0, 0, 3 }, + + _GREEN_CH, /* bReg_0x26 color mode - bits 4 and 5 */ + 0, /* bReg 0x27 color mode */ + 1, /* bReg 0x29 illumination mode */ + + 257, /* StepperPhaseCorrection (reg 0x1a + 0x1b) */ + 13, /* bOpticBlackStart (reg 0x1c) */ + 60, /* bOpticBlackEnd (reg 0x1d) */ + 10, /* wActivePixelsStart (reg 0x1e + 0x1f) */ +5416 /* 11000*/, /* wLineEnd (reg 0x20 + 0x21) */ + + 1, /* ok red lamp on (reg 0x2c + 0x2d) */ + 16383, /* ok red lamp off (reg 0x2e + 0x2f) */ + 1, /* ok green lamp on (reg 0x30 + 0x31) */ + 16383, /* ok green lamp off (reg 0x32 + 0x33) */ + 1, /* ok blue lamp on (reg 0x34 + 0x35) */ + 16383, /* ok blue lamp off (reg 0x36 + 0x37) */ + + 0x03, /* ok stepper motor control (reg 0x45) */ + 0, /* wStepsAfterPaperSensor2 (reg 0x4c + 0x4d) */ + 0xfc, /* ok acceleration profile (reg 0x51) */ + 0x03, /* ok lines to process (reg 0x54) */ + 0x13, /* Kickstart 0x55 */ + 2, /* PWM frequency 0x56 */ + 32, /* PWM duty cycle 0x57 */ + 0x15, /* paper sense 0x58 */ + 0x44, /* misc I/O 0x59 */ + 0x44, /* misc I/O 0x5a, */ + 0x46, /* misc I/O 0x5b */ + 0, 0, 0,/* test registers, set to 0 (0x5c, 0x5d, 0x5e) */ _LM9832, - MODEL_Tokyo600 + MODEL_MUSTEK1200 }; /* EPSON Perfection/Photo 1250 */ @@ -1456,12 +1489,12 @@ static HWDef Hw0x04B8_0x010F_0 = 0x41, /* ok misc io12 (reg 0x59) */ 0x44, /* ok misc io34 (reg 0x5a) */ - 0x49, /* ok misc io56 (reg 0x5b) */ + 0x94, /* ok misc io56 (reg 0x5b) */ 0, /* ok test mode ADC Output CODE MSB (reg 0x5c) */ 0, /* ok test mode ADC Output CODE LSB (reg 0x5d) */ 0, /* ok test mode (reg 0x5e) */ _LM9832, - MODEL_NOPLUSTEK + MODEL_NOPLUSTEK_1200 }; /* Umax 3400 */ @@ -1522,7 +1555,7 @@ static HWDef Hw0x1606_0x0060_0 = 0, /* test mode ADC Output CODE LSB (reg 0x5d) */ 0, /* test mode (reg 0x5e) */ _LM9832, - MODEL_NOPLUSTEK + MODEL_NOPLUSTEK_1200 }; /* Canon 650 */ @@ -1585,7 +1618,7 @@ static HWDef Hw0x04A9_0x2206_0 = 0, /* test mode ADC Output CODE LSB (reg 0x5d) */ 0, /* test mode (reg 0x5e) */ _LM9832, - MODEL_NOPLUSTEK + MODEL_NOPLUSTEK_600 }; /******************** all available combinations *****************************/ @@ -1623,7 +1656,7 @@ static SetDef Settings[] = /* Mustek BearPaw...*/ {"0x0400-0x1000", &Cap0x0400_0x1000_0, &Hw0x0400_0x1000_0, "BearPaw 1200" }, {"0x0400-0x1001", &Cap0x0400_0x1001_0, &Hw0x0400_0x1001_0, "BearPaw 2400" }, - + /* Genius devices... */ {"0x0458-0x2007", &Cap0x07B3_0x0007_0, &Hw0x07B3_0x0007_0, "ColorPage-HR6 V2" }, {"0x0458-0x2008", &Cap0x07B3_0x0007_0, &Hw0x07B3_0x0007_0, "Unknown device" }, @@ -1667,4 +1700,106 @@ static SetDef Settings[] = { NULL, NULL, NULL, NULL } /* last entry, never remove... */ }; + +/** + * tables for the motor settings + * The models KaoHsiung, HuaLien and Tokyo600 are currently set + * within the code in conjunction with some CCD combinations. + * NOTE: the touples PWM and PWM_Duty are used to set the registers + * 0x56 and 0x57, the recommended setting is 8,10 + * if you notice a whining noise and the motor does not move, + * you might increase the MCLK variable. + */ +static ClkMotorDef Motors[] = { + + { MODEL_KaoHsiung, + 64, 20, 6, /* PWM, PWM_Duty, MCLK for fast move */ + + /* Motor settings (PWM and PWM_Duty) */ + {{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }}, + /* Color mode MCLK settings */ + { 2, 2, 2, 2, 2, 3, 3, 3, 3, 3 }, + /* Gray mode MCLK settings */ + { 2, 2, 2, 2, 2, 3, 3, 3, 3, 3 } + }, + + { MODEL_HuaLien, 64, 20, 6, + /* Motor settings (PWM and PWM_Duty) */ + {{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }}, + /* Color mode MCLK settings */ + { 2, 2, 2, 2, 2, 3, 3, 3, 3, 3 }, + /* Gray mode MCLK settings */ + { 2, 2, 2, 2, 2, 3, 3, 3, 3, 3 } + }, + + { MODEL_Tokyo600, 4, 4, 6, + /* Motor settings (PWM and PWM_Duty) */ + {{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }}, + /* Color mode MCLK settings */ + { 2, 2, 2, 2, 2, 3, 3, 3, 3, 3 }, + /* Gray mode MCLK settings */ + { 2, 2, 2, 2, 2, 3, 3, 3, 3, 3 } + }, + + { MODEL_NOPLUSTEK_600, 64, 20, 6, + /* Motor settings (PWM and PWM_Duty) */ + {{ 16, 4 }, { 16, 4 }, { 16, 4 }, { 16, 4 }, { 16, 4 }, + { 16, 4 }, { 16, 4 }, { 16, 4 }, { 16, 4 }, { 16, 4 }}, + /* Color mode MCLK settings */ + { 4.0, 3.0, 2.0, 2.0, 2.0, 3.0, 3.0, 3.0, 3.0, 3.0 }, + /* Gray mode MCLK settings */ + { 3.0, 3.0, 3.0, 3.0, 3.0, 9.0, 9.0, 9.0, 9.0, 9.0 } + }, + + { MODEL_NOPLUSTEK_1200, 1, 48, 6, + /* Motor settings (PWM and PWM_Duty) */ + /* <=75dpi <=100dpi <=150dpi <=200dpi <=300dpi */ + {{ 1, 48 }, { 1, 48 }, { 1, 48 }, { 1, 48 }, { 1, 48 }, + + /* <=400dpi <=600dpi <=800dpi <=1200dpi <=2400dpi */ + { 2, 48 }, { 8, 48 }, { 2, 48 }, { 1, 48 }, { 1, 48 }}, + /* Color mode MCLK settings */ + { 2.0, 2.0, 2.0, 2.0, 2.0, 4.0, 4.0, 4.0, 5.5, 5.5 }, + /* Gray mode MCLK settings */ + { 5.0, 5.0, 5.0, 5.0, 5.0, 6.0, 6.0, 6.0, 6.0, 6.0 } + }, + + { MODEL_MUSTEK600, 4, 4, 6, + /* Motor settings (PWM and PWM_Duty) */ + {{ 16, 4 }, { 16, 4 }, { 16, 4 }, { 16, 4 }, { 16, 4 }, + { 16, 4 }, { 16, 4 }, { 16, 4 }, { 16, 4 }, { 16, 4 }}, + /* Color mode MCLK settings */ + { 3.5, 3.5, 3.5, 4.0, 6.0, 8.0, 11.5, 11.5, 11.5, 11.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 } + }, + + { MODEL_MUSTEK1200, 2, 32, 3, + /* Motor settings (PWM and PWM_Duty) */ + /* <=75dpi <=100dpi <=150dpi <=200dpi <=300dpi */ + {{ 2, 32 }, { 2, 32 }, { 2, 32 }, { 2, 32 }, { 2, 32 }, + + /* <=400dpi <=600dpi <=800dpi <=1200dpi <=2400dpi */ + { 2, 32 }, { 2, 32 }, { 2, 32 }, { 2, 32 }, { 2, 32 }}, + /* Color mode MCLK settings */ + { 3.5, 3.5, 3.5, 3.5, 3.5, 3.5, 3.5, 3.5, 3.5, 3.5 }, + /* Gray mode MCLK settings */ + { 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0 } + }, + + /* settings good for the HP models */ + { MODEL_HP, 8, 60, 6, + /* Motor settings (PWM and PWM_Duty) */ + {{ 23, 60 }, { 23, 60 }, { 23, 60 }, { 23, 60 }, { 23, 60 }, + { 8, 60 }, { 8, 60 }, { 8, 60 }, { 8, 60 }, { 8, 60 }}, + /* Color mode MCLK settings */ + { 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 3.5, 3.5, 3.5, 3.5 }, + /* Gray mode MCLK settings */ + { 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0, 7.0 } + } +}; + /* END PLUSTEK-DEVS.C .......................................................*/ diff --git a/backend/plustek-pp.c b/backend/plustek-pp.c index e6a56ffba..2c927231c 100644 --- a/backend/plustek-pp.c +++ b/backend/plustek-pp.c @@ -16,6 +16,7 @@ * 0.41 - added _PTDRV_ADJUST call * 0.42 - added setmap function * fixed the stopscan problem, that causes a crash in the kernel module + * 0.43 - no changes * *............................................................................. * diff --git a/backend/plustek-share.h b/backend/plustek-share.h index 92cc5a72f..7f3441ee4 100644 --- a/backend/plustek-share.h +++ b/backend/plustek-share.h @@ -22,6 +22,7 @@ * 0.42 - added FLAG_CUSTOM_GAMMA and _MAP_ definitions * changed IOCTL interface to allow downloadable MAPS * added error codes + * 0.43 - added tpa entry for AdjDef * *............................................................................. * @@ -234,6 +235,7 @@ typedef struct { int lampOff; int lampOffOnEnd; int warmup; + int enableTpa; OffsDef pos; /* for adjusting normal scan area */ OffsDef tpa; /* for adjusting transparency scan area */ diff --git a/backend/plustek-usb.c b/backend/plustek-usb.c index 11608c24e..8cbb1130e 100644 --- a/backend/plustek-usb.c +++ b/backend/plustek-usb.c @@ -15,6 +15,7 @@ * added setmap function * changed detection stuff, so we first check whether * the vendor and product Ids match with the ones in our list + * 0.43 - cleanup * *............................................................................. * @@ -133,6 +134,13 @@ static void usb_initDev( pPlustek_Device dev, int idx, int handle, int vendor ) } } + if( vendor == 0x04B8 ) { + if( dev->adj.enableTpa ) { + DBG( _DBG_INFO, "Enabled TPA for EPSON\n" ); + dev->usbDev.Caps.wFlags |= DEVCAPSFLAG_TPA; + } + } + dev->usbDev.currentLamp = usb_GetLampStatus( dev ); usb_ResetRegisters( dev ); @@ -373,13 +381,14 @@ static int usbDev_open( const char *dev_name, void *misc ) return -1; } -#if 0 +#if 1 dev->fd = handle; - usbio_ResetLM983x( dev ); + usbio_ResetLM983x ( dev ); + usb_IsScannerReady( dev ); dev->fd = -1; -#endif - +#else sanei_lm983x_reset( handle ); +#endif /* * Plustek uses the misc IO 1/2 to get the PCB ID @@ -469,8 +478,8 @@ static int usbDev_getCaps( Plustek_Device *dev ) return 0; } -/*............................................................................. - * +/** usbDev_getLensInfo + * set the info for the scan-area. */ static int usbDev_getLensInfo( Plustek_Device *dev, pLensInfo lens ) { @@ -499,30 +508,15 @@ static int usbDev_getLensInfo( Plustek_Device *dev, pLensInfo lens ) lens->rDpiY.wMax = (dev->usbDev.Caps.OpticDpi.x *16); lens->rDpiY.wPhyMax = (dev->usbDev.Caps.OpticDpi.x * 2); - return 0; -} + lens->rDpiY.wMin = dev->usbDev.Caps.Normal.MinDpi.y; -/* - * HEINER: workaround - remove it!!!! - */ -static ImgDef xxx; - -/*............................................................................. - * HEINER: No function, should be removed from backend and driver as well - */ -static int usbDev_putImgInfo( Plustek_Device *dev, pImgDef img ) -{ - DBG( _DBG_INFO, "usbDev_putImgInfo()\n" ); - - _VAR_NOT_USED(dev); - - memcpy( &xxx, img, sizeof(ImgDef)); + DBG( _DBG_INFO, "wMAX=%u, WPHYMAX=%u\n", lens->rDpiY.wMax, lens->rDpiY.wPhyMax ); return 0; } -/*............................................................................. - * +/** usbDev_getCropInfo + * function to set the image relevant stuff */ static int usbDev_getCropInfo( Plustek_Device *dev, pCropInfo ci ) { @@ -532,8 +526,6 @@ static int usbDev_getCropInfo( Plustek_Device *dev, pCropInfo ci ) _VAR_NOT_USED(dev); - memcpy( &ci->ImgDef, &xxx, sizeof(ImgDef)); - usb_GetImageInfo( &ci->ImgDef, &size ); ci->dwPixelsPerLine = size.dwPixels; @@ -628,6 +620,13 @@ static int usbDev_setScanEnv( Plustek_Device *dev, pScanInfo si ) SCANFLAG_DWORDBoundary | SCANFLAG_RightAlign | SCANFLAG_StillModule | SCANDEF_Adf | SCANDEF_ContinuousScan); + if( !(SCANDEF_QualityScan & si->ImgDef.dwFlag)) { + DBG( _DBG_INFO, "Preview Mode set!\n" ); + } else { + DBG( _DBG_INFO, "Preview Mode NOT set!\n" ); + dev->scanning.dwFlag |= SCANDEF_QualityScan; + } + dev->scanning.sParam.siThreshold = si->siBrightness; dev->scanning.sParam.brightness = si->siBrightness; dev->scanning.sParam.contrast = si->siContrast; @@ -736,18 +735,28 @@ static int usbDev_startScan( Plustek_Device *dev, pStartScan start ) DBG( _DBG_INFO, "usbDev_startScan()\n" ); +/* HEINER: PReview currently not working correctly */ +#if 0 + if( scanning->dwFlag & SCANDEF_QualityScan ) + a_bRegs[0x0a] = 0; + else + a_bRegs[0x0a] = 1; +#endif a_bRegs[0x0a] = 0; + /* Allocate shading buffer */ if((dev->scanning.dwFlag & SCANDEF_Adf) && (dev->scanning.dwFlag & SCANDEF_ContinuousScan)) { dev->scanning.fCalibrated = SANE_TRUE; } else { + dev->scanning.fCalibrated = SANE_FALSE; iSkipLinesForADF = 0; } - scanning->sParam.PhyDpi.x = usb_SetAsicDpiX( dev, scanning->sParam.UserDpi.x ); + scanning->sParam.PhyDpi.x = usb_SetAsicDpiX(dev,scanning->sParam.UserDpi.x); + scanning->sParam.PhyDpi.y = usb_SetAsicDpiY(dev,scanning->sParam.UserDpi.y); scanning->pScanBuffer = (u_char*)malloc( dev->usbDev.dwBufferSize ); if( NULL != scanning->pScanBuffer ) { @@ -774,11 +783,9 @@ static int usbDev_readImage( struct Plustek_Device *dev, SANE_Byte *buf, unsigned long data_length ) { int result, lines; - u_long dw; - struct timeval t; + u_long dw; pScanDef scanning = &dev->scanning; pDCapsDef scaps = &dev->usbDev.Caps; - pHWDef hw = &dev->usbDev.HwSetting; DBG( _DBG_INFO, "usbDev_readImage()\n" ); @@ -787,23 +794,6 @@ static int usbDev_readImage( struct Plustek_Device *dev, */ usb_ModuleStatus( dev ); - /* - * wait until warmup period has been elapsed - */ - DBG(_DBG_INFO,"Warmup: Waiting %lu seconds\n",dev->usbDev.dwWarmup ); - - do { - gettimeofday( &t, NULL); - - dw = t.tv_sec - dev->usbDev.dwTicksLampOn; - - if( usb_IsEscPressed()) { - DBG( _DBG_INFO, "ReadImage() - Cancel detected...\n" ); - return 0; - } - - } while( dw < dev->usbDev.dwWarmup ); - result = usb_DoCalibration( dev ); if( SANE_TRUE != result ) { DBG( _DBG_INFO, "calibration failed!!!\n" ); @@ -811,7 +801,6 @@ static int usbDev_readImage( struct Plustek_Device *dev, } DBG( _DBG_INFO, "calibration done.\n" ); - if( !( scanning->dwFlag & SCANFLAG_Scanning )) { usleep( 10 * 1000 ); @@ -893,23 +882,13 @@ static int usbDev_readImage( struct Plustek_Device *dev, break; case SENSORORDER_bgr: - if( hw->ScannerModel == MODEL_Tokyo600 ) { - scanning->Red.pb = scanning->pbScanBufBegin; - scanning->Green.pb = scanning->pbScanBufBegin + - scanning->dwLinesDiscard * - scanning->sParam.Size.dwPhyBytes; - scanning->Blue.pb = scanning->pbScanBufBegin + - scanning->dwLinesDiscard * + scanning->Blue.pb = scanning->pbScanBufBegin; + scanning->Green.pb = scanning->pbScanBufBegin + + scanning->dwLinesDiscard * + scanning->sParam.Size.dwPhyBytes; + scanning->Red.pb = scanning->pbScanBufBegin + + scanning->dwLinesDiscard * scanning->sParam.Size.dwPhyBytes * 2UL; - } else { - scanning->Blue.pb = scanning->pbScanBufBegin; - scanning->Green.pb = scanning->pbScanBufBegin + - scanning->dwLinesDiscard * - scanning->sParam.Size.dwPhyBytes; - scanning->Red.pb = scanning->pbScanBufBegin + - scanning->dwLinesDiscard * - scanning->sParam.Size.dwPhyBytes * 2UL; - } } /* double it for last channel */ @@ -950,8 +929,8 @@ static int usbDev_readImage( struct Plustek_Device *dev, return _E_INTERNAL; } - - scanning->dwFlag |= SCANFLAG_Scanning; + + scanning->dwFlag |= SCANFLAG_Scanning; if( scanning->sParam.UserDpi.y != scanning->sParam.PhyDpi.y ) { @@ -1007,7 +986,7 @@ static int usbDev_readImage( struct Plustek_Device *dev, DBG(_DBG_INFO,"dwBytesLine = %lu\n",scanning->dwBytesLine ); scanning->pbGetDataBuf = scanning->pbScanBufBegin; - + lines = usb_ReadData( dev ); if( 0 == lines ) return _E_DATAREAD; diff --git a/backend/plustek-usb.h b/backend/plustek-usb.h index 816ccbaac..599a4fb52 100644 --- a/backend/plustek-usb.h +++ b/backend/plustek-usb.h @@ -14,6 +14,8 @@ * 0.42 - added MODEL_NOPLUSTEK * replaced fLM9831 by chip (valid entries: _LM9831, _LM9832, _LM9833) * added _WAF_MISC_IO3_LAMP for UMAX 3400 + * 0.43 - added _WAF_MISC_IOx_LAMP (x=1,2,4,5) + * added CLKDef * *............................................................................. * @@ -126,15 +128,6 @@ typedef enum _CHIPSET _LM9833 } eChipDef; -typedef enum -{ - MODEL_KaoHsiung, - MODEL_HuaLien, - MODEL_Tokyo600, - MODEL_NOPLUSTEK -} eModelDef; - - /* ScanParam.bCalibration */ enum _SHADINGID { @@ -178,10 +171,41 @@ 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 */ - _WAF_MISC_IO3_LAMP = 0x00000004 /* to make Umax 3400 lamp work */ + _WAF_MISC_IO_LAMPS = 0x00000002, /* special lamp switching */ + _WAF_BLACKFINE = 0x00000004 /* use black calibration strip */ }; +enum _LAMPS +{ + _NO_MIO = 0, + _MIO1 = 0x0001, + _MIO2 = 0x0002, + _MIO3 = 0x0004, + _MIO4 = 0x0008, + _MIO5 = 0x0010, + _MIO6 = 0x0020 +}; + +#define _TPA(flag) ((u_long)(flag << 16)) +#define _HAS_TPA(flag) (flag & 0xFFFF0000) +#define _GET_TPALAMP(flag) (flag >> 16) + +/* motor types */ +typedef enum +{ + MODEL_KaoHsiung = 0, + MODEL_HuaLien, + MODEL_Tokyo600, + MODEL_NOPLUSTEK_600, /* for 600 dpi models */ + MODEL_NOPLUSTEK_1200, /* for 1200 dpi models */ + MODEL_MUSTEK600, /* for BearPaw 1200 */ + MODEL_MUSTEK1200, /* for BearPaw 2400 */ + MODEL_HP, /* for HP2x00 */ + MODEL_LAST +} eModelDef; + +#define _IS_PLUSTEKMOTOR(x) (x<=MODEL_Tokyo600) + /* Generic usage */ enum _CHANNEL { @@ -255,6 +279,7 @@ typedef struct DevCaps u_char bPCB; /* PCB ID */ u_long workaroundFlag; /* Flag to allow special work arounds, see */ /* _WORKAROUNDS */ + u_long lamp; /* for lamp: loword: normal, hiword: tpa */ } DCapsDef, *pDCapsDef; @@ -331,8 +356,8 @@ typedef struct HWDefault u_char bReg_0x5d; u_char bReg_0x5e; - eChipDef chip; /* chiptype */ - eModelDef ScannerModel; /* to identify Model */ + eChipDef chip; /* chiptype */ + eModelDef motorModel; /* to identify used motor */ } HWDef, *pHWDef; @@ -354,11 +379,7 @@ typedef struct DeviceDef u_long dwTicksLampOn; /* The ticks when lamp turns on */ u_long dwLampOnPeriod; /* How many seconds to keep lamp on */ SANE_Bool bLampOffOnEnd; /* switch lamp off on end or keep cur. state*/ -/* HEINER: REMOVE */ int currentLamp; /* The lamp ID */ -#if 0 - u_char bLastColor; /* The last color channel comes from CCD */ -#endif u_char bStepsToReverse; /* reg 0x50, this value is from registry */ u_long dwBufferSize; /* */ @@ -434,7 +455,7 @@ typedef struct struct Plustek_Device; -/* +/** * */ typedef struct ScanDef @@ -490,6 +511,49 @@ typedef struct ScanDef } ScanDef, *pScanDef; + +#define _MAX_CLK 10 + +/** + * + */ +typedef struct +{ + u_char pwm; + u_char pwm_duty; + +} MDef, *pMDef; + +/** + * array used to get motor-settings and mclk-settings + */ +static int dpi_ranges[] = { 75,100,150,200,300,400,600,800,1200,2400 }; + +/** + * + */ +typedef struct { + + eModelDef motorModel; + + u_char pwm_fast; + u_char pwm_duty_fast; + u_char mclk_fast; + + /* + * here we define some ranges for better supporting + * non-Plustek devices with it's different hardware + * we can set the MCLK and the motor PWM stuff for color + * and gray modes + * 0 1 2 3 4 5 6 7 8 9 + * <= 75 <=100 <=150 <=200 <=300 <=400 <=600 <= 800 <=1200 <=2400DPI + */ + MDef motor_sets[_MAX_CLK]; + double color_mclk[_MAX_CLK]; + double gray_mclk[_MAX_CLK]; + +} ClkMotorDef, *pClkMotorDef; + #endif /* guard __PLUSTEK_USB_H__ */ /* END PLUSTEK-USB.H ........................................................*/ diff --git a/backend/plustek-usbhw.c b/backend/plustek-usbhw.c index 6b199129b..c5f7b08e7 100644 --- a/backend/plustek-usbhw.c +++ b/backend/plustek-usbhw.c @@ -14,6 +14,7 @@ * 0.42 - added warmup stuff * added UMAX 3400 stuff * fixed problem with minimum wait time... + * 0.43 - added usb_switchLamp for non-Plustek devices * *............................................................................. * @@ -71,8 +72,28 @@ static SANE_Bool fModuleFirstHome; /* HEINER: this has to be initialized */ static SANE_Bool fLastScanIsAdf; static u_char a_bRegs[0x80]; -/*............................................................................. - * + +/** usb_GetMotorSet + * according to the model, the function returns the address of + * the corresponding entry of the Motor table + */ +static pClkMotorDef usb_GetMotorSet( eModelDef model ) +{ + int i; + + for( i = 0; i < MODEL_LAST; i++ ) { + if( model == Motors[i].motorModel ) { + return &(Motors[i]); + } + } + + return NULL; +} + +/** switch motor on or off + * @param handle - handle to open USB device + * @param fOn - SANE_TRUE means motor on, SANE_FALSE means motor off + * @return always SANE_TRUE */ static SANE_Bool usb_MotorOn( int handle, SANE_Bool fOn ) { @@ -168,11 +189,12 @@ static SANE_Bool usb_SensorPaper( int handle ) static SANE_Bool usb_ModuleMove( pPlustek_Device dev, u_char bAction, u_long dwStep ) { - SANE_Status res; - u_char bReg2, reg7; - u_short wFastFeedStepSize; - double dMaxMoveSpeed; - pHWDef hw = &dev->usbDev.HwSetting; + SANE_Status res; + u_char bReg2, reg7, mclk_div; + u_short wFastFeedStepSize; + double dMaxMoveSpeed; + pClkMotorDef clk; + pHWDef hw = &dev->usbDev.HwSetting; /* Check if LM9831 is ready for setting command */ if( bAction != MOVE_ToPaperSensor && @@ -235,8 +257,13 @@ static SANE_Bool usb_ModuleMove( pPlustek_Device dev, dMaxMoveSpeed = hw->dMaxMoveSpeed; } + clk = usb_GetMotorSet( hw->motorModel ); + + mclk_div = clk->mclk_fast; + wFastFeedStepSize = (u_short)(dwCrystalFrequency / - (6UL * 8UL * 1 * dMaxMoveSpeed * 4 * hw->wMotorDpi)); + ((u_long)mclk_div * 8UL * 1 * + dMaxMoveSpeed * 4 * hw->wMotorDpi)); a_bRegs[0x48] = (u_char)(wFastFeedStepSize >> 8); a_bRegs[0x49] = (u_char)(wFastFeedStepSize & 0xFF); @@ -253,7 +280,7 @@ static SANE_Bool usb_ModuleMove( pPlustek_Device dev, */ /* MCLK divider = 6 */ - if( !usbio_WriteReg(dev->fd, 0x08, 0x0A)) + if( !usbio_WriteReg(dev->fd, 0x08, (mclk_div-1)*2 /*0x0A*/)) return SANE_FALSE; /* 8 bits/pixel, HDPI divider = 12 */ @@ -361,6 +388,7 @@ static SANE_Bool usb_ModuleMove( pPlustek_Device dev, */ static SANE_Bool usb_ModuleToHome( pPlustek_Device dev, SANE_Bool fWait ) { + u_char mclk_div; u_char value; pDCapsDef scaps = &dev->usbDev.Caps; pHWDef hw = &dev->usbDev.HwSetting; @@ -381,7 +409,7 @@ static SANE_Bool usb_ModuleToHome( pPlustek_Device dev, SANE_Bool fWait ) if( fModuleFirstHome ) { fModuleFirstHome = SANE_FALSE; - if( hw->ScannerModel != MODEL_Tokyo600 ) + if( hw->motorModel != MODEL_Tokyo600 ) usb_ModuleMove( dev, MOVE_Forward, hw->wMotorDpi / 2); } @@ -390,7 +418,7 @@ static SANE_Bool usb_ModuleToHome( pPlustek_Device dev, SANE_Bool fWait ) u_short wFastFeedStepSize; - if( hw->ScannerModel == MODEL_Tokyo600 ) { + if( hw->motorModel == MODEL_Tokyo600 ) { usbio_WriteReg( dev->fd, 0x07, 0 ); } else { @@ -399,58 +427,82 @@ static SANE_Bool usb_ModuleToHome( pPlustek_Device dev, SANE_Bool fWait ) usleep(200*1000); } - /* Compute fast feed step size, use equation 3 and equation 8 */ - wFastFeedStepSize = (u_short)(dwCrystalFrequency / (6UL * 8UL * 1 * + if(!_IS_PLUSTEKMOTOR(hw->motorModel)) { + + pClkMotorDef clk; + + clk = usb_GetMotorSet( hw->motorModel ); + + a_bRegs[0x56] = clk->pwm_fast; + a_bRegs[0x57] = clk->pwm_duty_fast; + mclk_div = clk->mclk_fast; + + } else { + + mclk_div = 6; + + if( scaps->OpticDpi.x == 1200 || scaps->bPCB == 2) { + switch( hw->motorModel ) { + + case MODEL_KaoHsiung: + case MODEL_HuaLien: + default: + a_bRegs[0x56] = 1; + a_bRegs[0x57] = 63; + break; + } + } else { /* if(Device.Caps.OpticDpi.x == 600) */ + + switch( hw->motorModel ) { + + case MODEL_Tokyo600: + a_bRegs[0x56] = 4; + a_bRegs[0x57] = 4; /* 2; */ + break; + case MODEL_HuaLien: + if( dev->caps.dwFlag & SFLAG_ADF ) { + a_bRegs[0x56] = 64; /* 32; */ + a_bRegs[0x57] = 4; /* 16; */ + } else { + a_bRegs[0x56] = 32; + a_bRegs[0x57] = 16; + } + break; + + case MODEL_KaoHsiung: + default: + a_bRegs[0x56] = 64; + a_bRegs[0x57] = 20; + break; + } + } + } + + /* Compute fast feed step size, use equation 3 and equation 8 + * assumptions: MCLK = 6, Lineratemode (CM=1) + */ + wFastFeedStepSize = (u_short)(dwCrystalFrequency / (mclk_div * 8 * 1 * hw->dMaxMotorSpeed * 4 * hw->wMotorDpi)); a_bRegs[0x48] = (u_char)(wFastFeedStepSize >> 8); a_bRegs[0x49] = (u_char)(wFastFeedStepSize & 0xFF); a_bRegs[0x4a] = 0; a_bRegs[0x4b] = 0; - if( scaps->OpticDpi.x == 1200 || scaps->bPCB == 2) { - switch( hw->ScannerModel ) { - - case MODEL_KaoHsiung: - case MODEL_HuaLien: - default: - a_bRegs[0x56] = 1; - a_bRegs[0x57] = 63; - break; - } - } else { /* if(Device.Caps.OpticDpi.x == 600) */ - - switch( hw->ScannerModel ) { - - case MODEL_Tokyo600: - a_bRegs[0x56] = 4; - a_bRegs[0x57] = 4; /* 2; */ - break; - case MODEL_HuaLien: - if( dev->caps.dwFlag & SFLAG_ADF ) { - a_bRegs[0x56] = 64; /* 32; */ - a_bRegs[0x57] = 4; /* 16; */ - } else { - a_bRegs[0x56] = 32; - a_bRegs[0x57] = 16; - } - break; - - case MODEL_KaoHsiung: - default: - a_bRegs[0x56] = 64; - a_bRegs[0x57] = 20; - break; - } - } - a_bRegs[0x45] |= 0x10; + DBG( _DBG_INFO, "MOTOR-Settings: PWM=0x%02x, PWM_DUTY=0x%02x 0x%02x\n", + a_bRegs[0x56], a_bRegs[0x57], a_bRegs[0x45] ); + /* The setting for chassis moving is: * MCLK divider = 6, 8 bits/pixel, HDPI divider = 12, * no integration time adjustment and 1 channel grayscale */ /* MCLK divider = 6 */ - if( !usbio_WriteReg(dev->fd, 0x08, 0x0A)) + value = (u_char)((mclk_div-1) * 2); + + DBG( _DBG_INFO, "MCLK_FFW = %u --> 0x%02x\n", mclk_div, value ); + + if( !usbio_WriteReg(dev->fd, 0x08, value)) return SANE_FALSE; /* 8 bits/pixel, HDPI divider = 12 */ @@ -473,14 +525,14 @@ static SANE_Bool usb_ModuleToHome( pPlustek_Device dev, SANE_Bool fWait ) usbio_WriteReg(dev->fd, 0x0a, 0); - if( hw->ScannerModel == MODEL_HuaLien && scaps->OpticDpi.x == 600 ) + if( hw->motorModel == MODEL_HuaLien && scaps->OpticDpi.x == 600 ) usleep(100 * 1000); if( !usbio_WriteReg(dev->fd, 0x07, 2)) return SANE_FALSE; #if 0 - if(Device.HwSetting.ScannerModel == MODEL_Tokyo600) + if(Device.HwSetting.motorModel == MODEL_Tokyo600) { DWORD dwSpeedUp = GetTickCount () + 250; @@ -537,12 +589,13 @@ static SANE_Bool usb_MotorSelect( pPlustek_Device dev, SANE_Bool fADF ) pDCapsDef sCaps = &dev->usbDev.Caps; pHWDef hw = &dev->usbDev.HwSetting; - if( hw->ScannerModel == MODEL_NOPLUSTEK ) + if(!_IS_PLUSTEKMOTOR(hw->motorModel)) { return SANE_TRUE; + } if( fADF ) { - if( sCaps->bCCD == 4 ) { + if( sCaps->bCCD == kNEC3778 ) { hw->wMotorDpi = 300; hw->dMaxMotorSpeed = 1.5; @@ -553,7 +606,7 @@ static SANE_Bool usb_MotorSelect( pPlustek_Device dev, SANE_Bool fADF ) } else { - if( sCaps->bCCD == 4 ) { + if( sCaps->bCCD == kNEC3778 ) { hw->wMotorDpi = 600; hw->dMaxMotorSpeed = 1.1; @@ -571,7 +624,46 @@ static SANE_Bool usb_MotorSelect( pPlustek_Device dev, SANE_Bool fADF ) return SANE_TRUE; } -/** +/** according to the flag field, we return the register and + * it's maks to turn on/off the lamp. + * @param flag - field to check + * @param reg - pointer to a var to receive the register value + * @param msk - pointer to a var to receive the mask value + * @return Nothing + */ +static void usb_GetLampRegAndMask( u_long flag, SANE_Byte *reg, SANE_Byte *msk ) +{ + if( _MIO6 == ( _MIO6 & flag )) { + *reg = 0x5b; + *msk = 0x80; + + } else if( _MIO5 == ( _MIO5 & flag )) { + *reg = 0x5b; + *msk = 0x08; + + } else if( _MIO4 == ( _MIO4 & flag )) { + *reg = 0x5a; + *msk = 0x80; + + } else if( _MIO3 == ( _MIO3 & flag )) { + *reg = 0x5a; + *msk = 0x08; + + } else if( _MIO2 == ( _MIO2 & flag )) { + *reg = 0x59; + *msk = 0x80; + + } else if( _MIO1 == ( _MIO1 & flag )) { + *reg = 0x59; + *msk = 0x08; + + } else { + *reg = 0; + *msk = 0; + } +} + +/** usb_Get * This function returns the current lamp in use. * For non Plustek devices, it always returns DEV_LampReflection. * @param dev - pointer to our device structure, @@ -585,6 +677,7 @@ static int usb_GetLampStatus( pPlustek_Device dev ) int iLampStatus = 0; pHWDef hw = &dev->usbDev.HwSetting; pDCapsDef sc = &dev->usbDev.Caps; + SANE_Byte reg, msk, val; if( NULL == hw ) { @@ -592,10 +685,26 @@ static int usb_GetLampStatus( pPlustek_Device dev ) return -1; } - if((_WAF_MISC_IO6_LAMP == (_WAF_MISC_IO6_LAMP & sc->workaroundFlag)) || - (_WAF_MISC_IO3_LAMP == (_WAF_MISC_IO3_LAMP & sc->workaroundFlag))) { + /* do we use the misc I/O pins for switchwing the lamp ? */ + if( _WAF_MISC_IO_LAMPS & sc->workaroundFlag ) { - iLampStatus |= DEV_LampReflection; + usb_GetLampRegAndMask( sc->lamp, ®, &msk ); + + /* check if the lamp is on */ + usbio_ReadReg( dev->fd, reg, &val ); + DBG( _DBG_INFO, "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), ®, &msk ); + usbio_ReadReg( dev->fd, reg, &val ); + DBG( _DBG_INFO, "REG[0x%02x] = 0x%02x (msk=0x%02x)\n",reg,val,msk); + if( val & msk ) + iLampStatus |= DEV_LampTPA; + } } else { @@ -603,26 +712,64 @@ static int usb_GetLampStatus( pPlustek_Device dev ) if((a_bRegs[0x29] & 3) == 1) { - if((a_bRegs[0x2e] * 256 + a_bRegs[0x2f]) > hw->wLineEnd ) +/* HEINER: BETTER define register to check ! */ + + if(!_IS_PLUSTEKMOTOR(hw->motorModel)) { iLampStatus |= DEV_LampReflection; - if((a_bRegs[0x36] * 256 + a_bRegs[0x37]) > hw->wLineEnd ) - iLampStatus |= DEV_LampTPA; - } + } else { + + 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; + } + } } DBG( _DBG_INFO, "LAMP-STATUS: 0x%08x\n", iLampStatus ); return iLampStatus; } -/*............................................................................. +/** usb_switchLamp + * used for all devices that use some misc I/O pins to switch the lamp + */ +static SANE_Bool usb_switchLamp( pPlustek_Device dev, SANE_Bool on ) +{ + SANE_Byte reg, msk; + pScanDef scanning = &dev->scanning; + pDCapsDef sc = &dev->usbDev.Caps; + + if((scanning->sParam.bSource == SOURCE_Negative) || + (scanning->sParam.bSource == SOURCE_Transparency)) + usb_GetLampRegAndMask( _GET_TPALAMP(sc->lamp), ®, &msk ); + else + usb_GetLampRegAndMask( sc->lamp, ®, &msk ); + + if( 0 == reg ) + return SANE_FALSE; /* no need to switch something */ + + if( on ) + a_bRegs[reg] |= msk; + else + a_bRegs[reg] &= ~msk; + + DBG( _DBG_INFO, "Switch Lamp: %u, regs[0x%02x] = 0x%02x\n", + on, reg, a_bRegs[reg] ); + usbio_WriteReg( dev->fd, reg, a_bRegs[reg] ); + + return SANE_TRUE; +} + +/** usb_LedOn * */ -static void usb_LedOn( pPlustek_Device dev, SANE_Bool fOn ) +static void usb_LedOn( pPlustek_Device dev, SANE_Bool fOn ) { u_char value; - if( dev->usbDev.HwSetting.ScannerModel != MODEL_HuaLien ) + if( dev->usbDev.HwSetting.motorModel != MODEL_HuaLien ) return; value = a_bRegs[0x0d]; @@ -639,14 +786,14 @@ static void usb_LedOn( pPlustek_Device dev, SANE_Bool fOn ) } } -/*............................................................................. +/** usb_LampOn * */ static SANE_Bool usb_LampOn( pPlustek_Device dev, SANE_Bool fOn, SANE_Bool fResetTimer ) { - pScanDef scanning = &dev->scanning; pDCapsDef sc = &dev->usbDev.Caps; + pScanDef scanning = &dev->scanning; pHWDef hw = &dev->usbDev.HwSetting; int iLampStatus = usb_GetLampStatus( dev ); int lampId = -1; @@ -678,23 +825,9 @@ static SANE_Bool usb_LampOn( pPlustek_Device dev, memset( &a_bRegs[0x29], 0, (0x37-0x29+1)); - /* - * EPSON specific stuff - */ a_bRegs[0x29] = hw->bReg_0x29; - - if(_WAF_MISC_IO6_LAMP==(_WAF_MISC_IO6_LAMP & sc->workaroundFlag)) { - a_bRegs[0x5b] = 0x94; - usbio_WriteReg( dev->fd, 0x5b, a_bRegs[0x5b] ); - - } else if(_WAF_MISC_IO3_LAMP == - (_WAF_MISC_IO3_LAMP & sc->workaroundFlag)) { - - a_bRegs[0x5a] |= 0x08; - usbio_WriteReg( dev->fd, 0x5a, a_bRegs[0x5a] ); - - } else { + if( !usb_switchLamp(dev, SANE_TRUE )) { if( lampId == DEV_LampReflection ) { a_bRegs[0x2e] = 16383 / 256; @@ -706,8 +839,8 @@ static SANE_Bool usb_LampOn( pPlustek_Device dev, a_bRegs[0x37] = 16383 % 256; } } - - if( hw->ScannerModel == MODEL_NOPLUSTEK ) { + + if( _WAF_MISC_IO_LAMPS & sc->workaroundFlag ) { a_bRegs[0x2c] = hw->red_lamp_on / 256; a_bRegs[0x2d] = hw->red_lamp_on & 0xFF; @@ -727,7 +860,7 @@ static SANE_Bool usb_LampOn( pPlustek_Device dev, sanei_lm983x_write( dev->fd, 0x29, &a_bRegs[0x29], 0x37-0x29+1, SANE_TRUE ); - + if( lampId != dev->usbDev.currentLamp ) { dev->usbDev.currentLamp = lampId; @@ -751,23 +884,7 @@ static SANE_Bool usb_LampOn( pPlustek_Device dev, memset( &a_bRegs[0x29], 0, 0x37-0x29+1 ); - a_bRegs[0x29] = hw->bReg_0x29; - - /* - * EPSON specific stuff - */ - if(_WAF_MISC_IO6_LAMP==(_WAF_MISC_IO6_LAMP & sc->workaroundFlag)) { - - a_bRegs[0x5b] = 0x14; - usbio_WriteReg( dev->fd, 0x5b, a_bRegs[0x5b] ); - - } else if( _WAF_MISC_IO3_LAMP == - (_WAF_MISC_IO3_LAMP & sc->workaroundFlag)) { - - a_bRegs[0x5a] &= ~0x08; - usbio_WriteReg( dev->fd, 0x5a, a_bRegs[0x5a] ); - - } else { + if( !usb_switchLamp(dev, SANE_FALSE )) { if( iStatusChange & DEV_LampReflection ) { a_bRegs[0x2e] = 16383 / 256; @@ -780,7 +897,7 @@ static SANE_Bool usb_LampOn( pPlustek_Device dev, } } - if( hw->ScannerModel == MODEL_NOPLUSTEK ) { + if( _WAF_MISC_IO_LAMPS & sc->workaroundFlag ) { a_bRegs[0x2c] = hw->red_lamp_on / 256; a_bRegs[0x2d] = hw->red_lamp_on & 0xFF; @@ -832,6 +949,7 @@ static void usb_ResetRegisters( pPlustek_Device dev ) { pHWDef hw = &dev->usbDev.HwSetting; + DBG( _DBG_INFO, "RESETTING REGISTERS\n" ); memset( a_bRegs, 0, sizeof(a_bRegs)); memcpy( a_bRegs+0x0b, &hw->bSensorConfiguration, 4 ); @@ -848,7 +966,7 @@ static void usb_ResetRegisters( pPlustek_Device dev ) memcpy( a_bRegs+0x54, &hw->bReg_0x54, 0x5e - 0x54 + 1 ); } -/*............................................................................. +/** usb_ModuleStatus * */ static SANE_Bool usb_ModuleStatus( pPlustek_Device dev ) @@ -856,8 +974,9 @@ static SANE_Bool usb_ModuleStatus( pPlustek_Device dev ) u_char value; pHWDef hw = &dev->usbDev.HwSetting; +/* HEINER: Maybe needed to avoid recalibration!!! */ #if 0 - if(Calibration.fCalibrated) + if( dev->scanning.fCalibrated ) return SANE_TRUE; #endif @@ -910,6 +1029,9 @@ static void usb_LampTimerIrq( int sig ) dev_xxx->fd = handle; } } + + /* needs to be recalibrated */ + dev_xxx->scanning.fCalibrated = SANE_FALSE; if( -1 != dev_xxx->fd ) usb_LampOn( dev_xxx, SANE_FALSE, SANE_FALSE ); @@ -920,7 +1042,7 @@ static void usb_LampTimerIrq( int sig ) } } -/*............................................................................. +/** usb_StartLampTimer * */ static void usb_StartLampTimer( pPlustek_Device dev ) @@ -961,7 +1083,7 @@ static void usb_StartLampTimer( pPlustek_Device dev ) } } -/*............................................................................. +/** usb_StopLampTimer * */ static void usb_StopLampTimer( pPlustek_Device dev ) diff --git a/backend/plustek-usbimg.c b/backend/plustek-usbimg.c index 740b82a7d..ca38effd0 100644 --- a/backend/plustek-usbimg.c +++ b/backend/plustek-usbimg.c @@ -12,6 +12,7 @@ * 0.40 - starting version of the USB support * 0.41 - fixed the 14bit problem for LM9831 devices * 0.42 - no changes + * 0.43 - no changes * *............................................................................. * diff --git a/backend/plustek-usbmap.c b/backend/plustek-usbmap.c index b5c08df83..8637cf187 100644 --- a/backend/plustek-usbmap.c +++ b/backend/plustek-usbmap.c @@ -11,6 +11,7 @@ * 0.40 - starting version of the USB support * 0.41 - fixed brightness problem for lineart mode * 0.42 - removed preset of linear gamma tables + * 0.43 - no changes * *............................................................................. * @@ -171,7 +172,7 @@ static SANE_Bool usb_MapDownload( pPlustek_Device dev, u_char bDataType ) } else { fInverse = 0; } - + if( /*scanning->dwFlag & SCANFLAG_Pseudo48 && */ scanning->sParam.bSource == SOURCE_Negative ) { fInverse ^= 1; @@ -181,7 +182,7 @@ static SANE_Bool usb_MapDownload( pPlustek_Device dev, u_char bDataType ) !(scanning->dwFlag & SCANFLAG_Pseudo48)) { fInverse ^= 1; } - + if( fInverse ) { u_char map[_MAP_SIZE]; diff --git a/backend/plustek-usbscan.c b/backend/plustek-usbscan.c index 91cb121ea..bb8be650d 100644 --- a/backend/plustek-usbscan.c +++ b/backend/plustek-usbscan.c @@ -11,6 +11,7 @@ * 0.40 - starting version of the USB support * 0.41 - minor fixes * 0.42 - added some stuff for CIS devices + * 0.43 - no changes * *............................................................................. * @@ -146,6 +147,7 @@ static u_short usb_SetAsicDpiX( pPlustek_Device dev, u_short xdpi ) xdpi < 150 && scanning->sParam.bDataType == SCANDATATYPE_BW ) { xdpi = 150; + DBG( _DBG_INFO, "LIMIT XDPI to %udpi\n", xdpi ); } m_dHDPIDivider = (double)scaps->OpticDpi.x / xdpi; @@ -195,6 +197,7 @@ static u_short usb_SetAsicDpiX( pPlustek_Device dev, u_short xdpi ) if( a_bRegs[0x0a] ) a_bRegs[0x09] -= ((a_bRegs[0x0a] >> 2) + 2); + DBG( _DBG_INFO, "HDPI: %.3f\n", m_dHDPIDivider ); return (u_short)((double)scaps->OpticDpi.x / m_dHDPIDivider); } @@ -223,8 +226,8 @@ static u_short usb_SetAsicDpiY( pPlustek_Device dev, u_short ydpi ) if( wDpi > sCaps->OpticDpi.y * 2 ) wDpi = sCaps->OpticDpi.y * 2; - if((hw->ScannerModel == MODEL_Tokyo600) || - (hw->ScannerModel == MODEL_NOPLUSTEK)) { + if( (hw->motorModel == MODEL_Tokyo600) || + !_IS_PLUSTEKMOTOR(hw->motorModel)) { /* return wDpi; */ } else if( sCaps->wFlags & DEVCAPSFLAG_Adf && sCaps->OpticDpi.x == 600 ) { /* for ADF scanner color mode 300 dpi big noise */ @@ -355,7 +358,7 @@ static void usb_GetScanRect( pPlustek_Device dev, pScanParam pParam ) } wLineEnd = wDataPixelStart + (u_short)(m_dHDPIDivider * pParam->Size.dwPhyPixels + 0.5); - DBG( _DBG_INFO, "DataPixelStart=0x%04x, LineEnd=0x%04x\n", + DBG( _DBG_INFO, "DataPixelStart=%u, LineEnd=%u\n", wDataPixelStart, wLineEnd ); a_bRegs[0x22] = _HIBYTE( wDataPixelStart ); @@ -366,7 +369,7 @@ static void usb_GetScanRect( pPlustek_Device dev, pScanParam pParam ) /* Y origin */ if( pParam->bCalibration == PARAM_Scan ) { - if( hw->ScannerModel == MODEL_Tokyo600 ) { + if( hw->motorModel == MODEL_Tokyo600 ) { if(pParam->PhyDpi.x <= 75) pParam->Origin.y += 20; @@ -408,8 +411,8 @@ static void usb_GetScanRect( pPlustek_Device dev, pScanParam pParam ) if (pParam->bDataType == SCANDATATYPE_Gray) pParam->Origin.y += 4; } - } + /* Add gray mode offset (Green offset, we assume the CCD are * always be RGB or BGR order). */ @@ -420,7 +423,7 @@ static void usb_GetScanRect( pPlustek_Device dev, pScanParam pParam ) pParam->Origin.y = (u_short)((u_long)pParam->Origin.y * hw->wMotorDpi / 300UL); /* Something wrong, but I can not find it. */ - if( hw->ScannerModel == MODEL_HuaLien && sCaps->OpticDpi.x == 600) + if( hw->motorModel == MODEL_HuaLien && sCaps->OpticDpi.x == 600) pParam->Origin.y = pParam->Origin.y * 297 / 298; DBG( _DBG_INFO, "Full Steps to Skip at Start = 0x%04x\n", pParam->Origin.y ); @@ -492,6 +495,9 @@ static double usb_GetMCLKDivider( pPlustek_Device dev, pScanParam pParam ) else m_bIntTimeAdjust = ceil( 5.3/*6.0*/ / (m_dHDPIDivider*m_dMCLKDivider)); + DBG( _DBG_INFO, "Integration Time Adjust = %u (HDPI=%.3f,MCLKD=%.3f)\n", + m_bIntTimeAdjust, m_dHDPIDivider, m_dMCLKDivider ); + if( pParam->bCalibration == PARAM_Scan ) { /* Compare Integration with USB speed to find the best ITA value */ @@ -503,7 +509,7 @@ static double usb_GetMCLKDivider( pPlustek_Device dev, pScanParam pParam ) m_bIntTimeAdjust++; } - if( hw->ScannerModel == MODEL_HuaLien && + if( hw->motorModel == MODEL_HuaLien && sCaps->bCCD == kNEC3799 && m_bIntTimeAdjust > bMaxITA) { m_bIntTimeAdjust = bMaxITA; } @@ -574,16 +580,18 @@ static double usb_GetMCLKDivider( pPlustek_Device dev, pScanParam pParam ) * 4e pause limit * 52:53 dpd */ -#if 0 +#if 1 { +/*#define PCTR 2000000*/ +#define PCTR 1000000 /* --> typical transfer rate... */ #define MCLKDIV_SCALING 2 int minmclk, maxmclk, mclkdiv, max_mclkdiv, min_mclkdiv; int stepsize; int j; int pixelbits, pixelsperline; - unsigned long PCTransferRate = 2000000; + unsigned long PCTransferRate = PCTR; double dpi; double min_integration_time; @@ -619,8 +627,8 @@ static double usb_GetMCLKDivider( pPlustek_Device dev, pScanParam pParam ) maxmclk = (int) (32.5*MCLKDIV_SCALING + .5); /*round to be sure proper int*/ - DBG( _DBG_INFO, "lower mclkdiv limit=%f\n",(double)minmclk/MCLKDIV_SCALING ); - DBG( _DBG_INFO, "upper mclkdiv limit=%f\n",(double)maxmclk/MCLKDIV_SCALING ); + DBG( _DBG_INFO2, "lower mclkdiv limit=%f\n",(double)minmclk/MCLKDIV_SCALING ); + DBG( _DBG_INFO2, "upper mclkdiv limit=%f\n",(double)maxmclk/MCLKDIV_SCALING ); /* * 2. calculate ideal mclk divider from average pc transfer rate @@ -650,33 +658,36 @@ static double usb_GetMCLKDivider( pPlustek_Device dev, pScanParam pParam ) dwCrystalFrequency /((double) 8. * m_wLineLength * PCTransferRate)); - DBG( _DBG_INFO, "mclkdiv before limit=%f\n", (double)mclkdiv/MCLKDIV_SCALING); + DBG( _DBG_INFO2, "mclkdiv before limit=%f\n", (double)mclkdiv/MCLKDIV_SCALING); mclkdiv = usb_max( mclkdiv,minmclk ); mclkdiv = usb_min( mclkdiv,maxmclk ); - DBG( _DBG_INFO, "mclkdiv after limit=%f\n", (double)mclkdiv/MCLKDIV_SCALING); + DBG( _DBG_INFO2, "mclkdiv after limit=%f\n", (double)mclkdiv/MCLKDIV_SCALING); -#if 0 - if (PCTransferRate == 2000000) +#if 1 + /* limited by the transfer speed... */ + if (PCTransferRate == PCTR) { { int mult,timeadj; - mult = timeadj =Hardware.merlininfo.timeadj; + mult = timeadj = m_bIntTimeAdjust; if (!mult) mult++; while (mclkdiv*dpi*mult < 6.*MCLKDIV_SCALING) { - mclkdiv++; //for now + mclkdiv++; /* for now */ } - Hardware.merlininfo.timeadj = regs[0x19] = timeadj; + /* Hardware.merlininfo.timeadj = regs[0x19] = timeadj; */ } - Hardware.NSCStatusOut("PCrate mclkdiv=%f",(double)mclkdiv/MCLKDIV_SCALING); - return mclkdiv; //computing rate + DBG( _DBG_INFO, "PC-Rate mclkdiv=%f\n", (double)mclkdiv/MCLKDIV_SCALING ); +/* return mclkdiv; */ + + return m_dMCLKDivider; /* = ((double)mclkdiv/MCLKDIV_SCALING); */ } #endif - DBG( _DBG_INFO, "mclkdiv=%f\n",(double)mclkdiv/MCLKDIV_SCALING ); - DBG( _DBG_INFO, "pixel bytes per line=%d\n",pixelsperline*m_bCM); - DBG( _DBG_INFO, "linewidth=%d\n", m_wLineLength); + DBG( _DBG_INFO2, "mclkdiv=%f\n",(double)mclkdiv/MCLKDIV_SCALING ); + DBG( _DBG_INFO2, "pixel bytes per line=%d\n",pixelsperline*m_bCM); + DBG( _DBG_INFO2, "linewidth=%d\n", m_wLineLength); /* * 3. calculate max mclk divider based on max integration time @@ -689,12 +700,12 @@ static double usb_GetMCLKDivider( pPlustek_Device dev, pScanParam pParam ) dwCrystalFrequency * hw->dIntegrationTimeLowLamp /((double) 1000. * 8 * m_bCM * m_wLineLength)); - DBG( _DBG_INFO, "max mclkdiv before limit=%f\n", (double)max_mclkdiv/MCLKDIV_SCALING); + DBG( _DBG_INFO2, "max mclkdiv before limit=%f\n", (double)max_mclkdiv/MCLKDIV_SCALING); max_mclkdiv = usb_max( max_mclkdiv,minmclk ); max_mclkdiv = usb_min( max_mclkdiv,maxmclk ); - DBG( _DBG_INFO, "max mclkdiv after limit=%f\n", (double)max_mclkdiv/MCLKDIV_SCALING); + DBG( _DBG_INFO2, "max mclkdiv after limit=%f\n", (double)max_mclkdiv/MCLKDIV_SCALING); /* * 4. calculate min mclk divider based on max motor speed @@ -706,12 +717,12 @@ static double usb_GetMCLKDivider( pPlustek_Device dev, pScanParam pParam ) ((double) stepsize * hw->dMaxMotorSpeed *8 * m_bCM * hw->wMotorDpi * 4.)); - DBG( _DBG_INFO, "min mclkdiv before limit=%f\n", (double)min_mclkdiv/MCLKDIV_SCALING); + DBG( _DBG_INFO2, "min mclkdiv before limit=%f\n", (double)min_mclkdiv/MCLKDIV_SCALING); min_mclkdiv = usb_max( min_mclkdiv,minmclk ); min_mclkdiv = usb_min( min_mclkdiv,maxmclk ); - DBG( _DBG_INFO, "min mclkdiv after limit=%f\n", (double)min_mclkdiv/MCLKDIV_SCALING); + DBG( _DBG_INFO2, "min mclkdiv after limit=%f\n", (double)min_mclkdiv/MCLKDIV_SCALING); /* 5.Check if stepsize must be adjusted because max integration * time gives too fast motor speed @@ -729,7 +740,7 @@ static double usb_GetMCLKDivider( pPlustek_Device dev, pScanParam pParam ) stepsize = (int)ceil(x); - DBG( _DBG_INFO, "step size for mclk calc=%d\n", stepsize ); + DBG( _DBG_INFO2, "step size for mclk calc=%d\n", stepsize ); #if 0 Hardware.LimitStepSize(stepsize,regs); @@ -765,7 +776,7 @@ static double usb_GetMCLKDivider( pPlustek_Device dev, pScanParam pParam ) } } /*Hardware.merlininfo.timeadj = a_bRegs[0x19] = timeadj; */ - DBG( _DBG_INFO, "time adj=%d\n", timeadj); + DBG( _DBG_INFO2, "time adj=%d\n", timeadj); x = stepsize; if( timeadj ) @@ -923,121 +934,139 @@ static void usb_GetLineLength( pPlustek_Device dev ) m_wLineLength = tr / m_bLineRateColor; } -/*............................................................................. - * +/** usb_GetMotorParam + * registers 0x56, 0x57 */ static void usb_GetMotorParam( pPlustek_Device dev, pScanParam pParam ) { - pDCapsDef sCaps = &dev->usbDev.Caps; - pHWDef hw = &dev->usbDev.HwSetting; + int idx, i; + pClkMotorDef clk; + pMDef md; + pDCapsDef sCaps = &dev->usbDev.Caps; + pHWDef hw = &dev->usbDev.HwSetting; - if( sCaps->OpticDpi.x == 1200 ) { - - switch( hw->ScannerModel ) { - - case MODEL_NOPLUSTEK: - break; - - case MODEL_HuaLien: - case MODEL_KaoHsiung: - default: - if(pParam->PhyDpi.x <= 200) - { - a_bRegs[0x56] = 1; - a_bRegs[0x57] = 48; /* 63; */ - } - else if(pParam->PhyDpi.x <= 300) - { - a_bRegs[0x56] = 2; /* 8; */ - a_bRegs[0x57] = 48; /* 56; */ - } - else if(pParam->PhyDpi.x <= 400) - { - a_bRegs[0x56] = 8; - a_bRegs[0x57] = 48; - } - else if(pParam->PhyDpi.x <= 600) - { - a_bRegs[0x56] = 2; /* 10; */ - a_bRegs[0x57] = 48; /* 56; */ - } - else /* pParam->PhyDpi.x == 1200) */ - { - a_bRegs[0x56] = 1; /* 8; */ - a_bRegs[0x57] = 48; /* 56; */ - } - break; + if( !_IS_PLUSTEKMOTOR(hw->motorModel)) { + + clk = usb_GetMotorSet( hw->motorModel ); + md = clk->motor_sets; + idx = 0; + for( i = 0; i < _MAX_CLK; i++ ) { + if( pParam->PhyDpi.x <= dpi_ranges[i] ) + break; + idx++; } - } else { - switch ( hw->ScannerModel ) { + if( idx >= _MAX_CLK ) + idx = _MAX_CLK - 1; - case MODEL_NOPLUSTEK: - break; + a_bRegs[0x56] = md[idx].pwm; + a_bRegs[0x57] = md[idx].pwm_duty; - case MODEL_Tokyo600: - a_bRegs[0x56] = 16; - a_bRegs[0x57] = 4; /* 2; */ - break; - case MODEL_HuaLien: - { - if(pParam->PhyDpi.x <= 200) - { - a_bRegs[0x56] = 64; /* 24; */ - a_bRegs[0x57] = 4; /* 16; */ - } - else if(pParam->PhyDpi.x <= 300) - { - a_bRegs[0x56] = 64; /* 16; */ - a_bRegs[0x57] = 4; /* 16; */ - } - else if(pParam->PhyDpi.x <= 400) - { - a_bRegs[0x56] = 64; /* 16; */ - a_bRegs[0x57] = 4; /* 16; */ - } - else /* if(pParam->PhyDpi.x <= 600) */ - { -/* HEINER: check ADF stuff... */ -#if 0 - if(ScanInf.m_fADF) - { - a_bRegs[0x56] = 8; - a_bRegs[0x57] = 48; - } - else -#endif - { - a_bRegs[0x56] = 64; /* 2; */ - a_bRegs[0x57] = 4; /* 48; */ - } - } - } - break; - case MODEL_KaoHsiung: - default: - if(pParam->PhyDpi.x <= 200) - { - a_bRegs[0x56] = 24; - a_bRegs[0x57] = 16; - } - else if(pParam->PhyDpi.x <= 300) - { - a_bRegs[0x56] = 16; - a_bRegs[0x57] = 16; - } - else if(pParam->PhyDpi.x <= 400) - { - a_bRegs[0x56] = 16; - a_bRegs[0x57] = 16; - } - else /* if(pParam->PhyDpi.x <= 600) */ - { - a_bRegs[0x56] = 2; - a_bRegs[0x57] = 48; - } - break; - } + } else { + if( sCaps->OpticDpi.x == 1200 ) { + + switch( hw->motorModel ) { + + case MODEL_HuaLien: + case MODEL_KaoHsiung: + default: + if(pParam->PhyDpi.x <= 200) + { + a_bRegs[0x56] = 1; + a_bRegs[0x57] = 48; /* 63; */ + } + else if(pParam->PhyDpi.x <= 300) + { + a_bRegs[0x56] = 2; /* 8; */ + a_bRegs[0x57] = 48; /* 56; */ + } + else if(pParam->PhyDpi.x <= 400) + { + a_bRegs[0x56] = 8; + a_bRegs[0x57] = 48; + } + else if(pParam->PhyDpi.x <= 600) + { + a_bRegs[0x56] = 2; /* 10; */ + a_bRegs[0x57] = 48; /* 56; */ + } + else /* pParam->PhyDpi.x == 1200) */ + { + a_bRegs[0x56] = 1; /* 8; */ + a_bRegs[0x57] = 48; /* 56; */ + } + break; + } + } else { + switch ( hw->motorModel ) { + + case MODEL_Tokyo600: + a_bRegs[0x56] = 16; + a_bRegs[0x57] = 4; /* 2; */ + break; + case MODEL_HuaLien: + { + if(pParam->PhyDpi.x <= 200) + { + a_bRegs[0x56] = 64; /* 24; */ + a_bRegs[0x57] = 4; /* 16; */ + } + else if(pParam->PhyDpi.x <= 300) + { + a_bRegs[0x56] = 64; /* 16; */ + a_bRegs[0x57] = 4; /* 16; */ + } + else if(pParam->PhyDpi.x <= 400) + { + a_bRegs[0x56] = 64; /* 16; */ + a_bRegs[0x57] = 4; /* 16; */ + } + else /* if(pParam->PhyDpi.x <= 600) */ + { + /* HEINER: check ADF stuff... */ + #if 0 + if(ScanInf.m_fADF) + { + a_bRegs[0x56] = 8; + a_bRegs[0x57] = 48; + } + else + #endif + { + a_bRegs[0x56] = 64; /* 2; */ + a_bRegs[0x57] = 4; /* 48; */ + } + } + } + break; + case MODEL_KaoHsiung: + default: + if(pParam->PhyDpi.x <= 200) + { + a_bRegs[0x56] = 24; + a_bRegs[0x57] = 16; + } + else if(pParam->PhyDpi.x <= 300) + { + a_bRegs[0x56] = 16; + a_bRegs[0x57] = 16; + } + else if(pParam->PhyDpi.x <= 400) + { + a_bRegs[0x56] = 16; + a_bRegs[0x57] = 16; + } + else /* if(pParam->PhyDpi.x <= 600) */ + { + a_bRegs[0x56] = 2; + a_bRegs[0x57] = 48; + } + break; + } + } } + + DBG( _DBG_INFO, "MOTOR-Settings: PWM=0x%02x, PWM_DUTY=0x%02x\n", + a_bRegs[0x56], a_bRegs[0x57] ); } /*............................................................................. @@ -1092,7 +1121,7 @@ static void usb_GetPauseLimit( pPlustek_Device dev, pScanParam pParam ) m_dwPauseLimit, a_bRegs[0x4e], a_bRegs[0x4f] ); } -/** +/** usb_GetScanLinesAndSize * */ static void usb_GetScanLinesAndSize( pPlustek_Device dev, pScanParam pParam ) @@ -1115,7 +1144,7 @@ static void usb_GetScanLinesAndSize( pPlustek_Device dev, pScanParam pParam ) pParam->Size.dwTotalBytes = pParam->Size.dwPhyBytes * pParam->Size.dwPhyLines; } -/*............................................................................. +/** function to preset/reset the merlin registers * */ static SANE_Bool usb_SetScanParameters( pPlustek_Device dev, pScanParam pParam ) @@ -1199,6 +1228,7 @@ static SANE_Bool usb_SetScanParameters( pPlustek_Device dev, pScanParam pParam ) 4 * hw->wMotorDpi)); if( m_bIntTimeAdjust != 0 ) m_wFastFeedStepSize /= m_bIntTimeAdjust; + if(a_bRegs[0x0a]) m_wFastFeedStepSize *= ((a_bRegs[0x0a] >> 2) + 2); a_bRegs[0x48] = _HIBYTE( m_wFastFeedStepSize ); @@ -1253,6 +1283,7 @@ static SANE_Bool usb_SetScanParameters( pPlustek_Device dev, pScanParam pParam ) /* 0x03 - 0x05 */ _UIO(sanei_lm983x_write( dev->fd, 0x03, &a_bRegs[0x03], 3, SANE_TRUE)); + /* 0x5C - 0x7F */ _UIO(sanei_lm983x_write( dev->fd, 0x5C, &a_bRegs[0x5C], 0x7F - 0x5C +1, SANE_TRUE)); @@ -1321,7 +1352,6 @@ static SANE_Bool usb_ScanBegin( pPlustek_Device dev, SANE_Bool fAutoPark ) /* Download map & Shading data */ if(( m_pParam->bCalibration == PARAM_Scan && !usb_MapDownload( dev, m_pParam->bDataType)) || -/* !usb_LinearMapDownload( dev )) || */ !usb_DownloadShadingData( dev, m_pParam->bCalibration )) return SANE_FALSE; @@ -1337,8 +1367,8 @@ static SANE_Bool usb_ScanBegin( pPlustek_Device dev, SANE_Bool fAutoPark ) return SANE_TRUE; } -/*............................................................................. - * +/** usb_ScanEnd + * stop all the processing stuff and reposition sensor back home */ static SANE_Bool usb_ScanEnd( pPlustek_Device dev ) { diff --git a/backend/plustek-usbshading.c b/backend/plustek-usbshading.c index 1d25ce28b..f16684d79 100644 --- a/backend/plustek-usbshading.c +++ b/backend/plustek-usbshading.c @@ -12,6 +12,7 @@ * 0.41 - minor fixes * - added workaround stuff for EPSON1250 * 0.42 - added workaround stuff for UMAX 3400 + * 0.43 - added call to usb_switchLamp before reading dark data * *............................................................................. * @@ -82,11 +83,11 @@ static double dMCLK, dExpect, dMax; static double dMCLK_ADF; static double dRed, dGreen, dBlue; -static u_short m_wHilight = 0; /* check the windows registry... */ -static u_short m_wShadow = 0; /* check the windows registry... */ +static u_short m_wHilight = 4 /*0*/; /* check the windows registry... */ +static u_short m_wShadow = 4 /*0*/; /* check the windows registry... */ -/*............................................................................. - * +/** usb_SetDarkShading + * download the dark shading data to Merlins' DRAM */ static SANE_Bool usb_SetDarkShading( int fd, u_char channel, void *lpCoeff, u_short wCount ) @@ -122,8 +123,8 @@ static SANE_Bool usb_SetDarkShading( int fd, u_char channel, return SANE_FALSE; } -/*............................................................................. - * +/** usb_SetWhiteShading + * download the white shading data to Merlins' DRAM */ static SANE_Bool usb_SetWhiteShading( int fd, u_char channel, void *lpData, u_short wCount ) @@ -158,8 +159,10 @@ static SANE_Bool usb_SetWhiteShading( int fd, u_char channel, return SANE_FALSE; } -/*............................................................................. - * +/** usb_GetSoftwareOffsetGain + * preset the offset and gain parameter for fine calibration. + * Adjustment on these defaults is done for negative and transparency + * scanning... */ static void usb_GetSoftwareOffsetGain( pPlustek_Device dev ) { @@ -167,8 +170,13 @@ static void usb_GetSoftwareOffsetGain( pPlustek_Device dev ) pDCapsDef sCaps = &dev->usbDev.Caps; pHWDef hw = &dev->usbDev.HwSetting; - pParam->swOffset[0] = pParam->swOffset[1] = pParam->swOffset[2] = 0; - pParam->swGain[0] = pParam->swGain[1] = pParam->swGain[2] = 1000; + pParam->swOffset[0] = 0; + pParam->swOffset[1] = 0; + pParam->swOffset[2] = 0; + + pParam->swGain[0] = 1000; + pParam->swGain[1] = 1000; + pParam->swGain[2] = 1000; if( pParam->bSource != SOURCE_Reflection ) return; @@ -202,7 +210,7 @@ static void usb_GetSoftwareOffsetGain( pPlustek_Device dev ) pParam->swGain[1] = 980; pParam->swGain[2] = 1000; } - } else if( hw->ScannerModel == MODEL_KaoHsiung ) { + } else if( hw->motorModel == MODEL_KaoHsiung ) { pParam->swOffset[0] = 1950; pParam->swOffset[1] = 1700; pParam->swOffset[2] = 1250; @@ -321,7 +329,7 @@ static void usb_GetSoftwareOffsetGain( pPlustek_Device dev ) pParam->swGain[1] = 920; pParam->swGain[2] = 980; } - else if( hw->ScannerModel == MODEL_HuaLien && pParam->PhyDpi.x > 800) + else if( hw->motorModel == MODEL_HuaLien && pParam->PhyDpi.x > 800) { pParam->swOffset[0] = 0; pParam->swOffset[1] = 0; @@ -405,7 +413,15 @@ static u_char usb_GetNewGain( u_short wMax ) } } -/*............................................................................. +/** usb_AdjustGain + * function to perform the "coarse calibration step" part 1. + * We scan reference image pixels to determine the optimum coarse gain settings + * for R, G, B. (Analog gain and offset prior to ADC). These coefficients are + * applied at the line rate during normal scanning. + * The scanned line should contain a white strip with some black at the + * beginning. The function searches for the maximum value which corresponds to + * the maximum white value. + * Affects register 0x3b, 0x3c and 0x3d * */ static SANE_Bool usb_AdjustGain( pPlustek_Device dev, int fNegative ) @@ -415,12 +431,16 @@ static SANE_Bool usb_AdjustGain( pPlustek_Device dev, int fNegative ) pHWDef hw = &dev->usbDev.HwSetting; u_long dw; SANE_Bool fRepeatITA = SANE_TRUE; + struct timeval t; if( usb_IsEscPressed()) return SANE_FALSE; bMaxITA = 0xff; + /* + * define the strip to scan for coarse calibration + */ m_ScanParam.Size.dwLines = 1; /* for gain */ m_ScanParam.Size.dwPixels = scaps->Normal.Size.x * scaps->OpticDpi.x / 300UL; @@ -433,14 +453,37 @@ static SANE_Bool usb_AdjustGain( pPlustek_Device dev, int fNegative ) TOGAIN: m_ScanParam.dMCLK = dMCLK; - if( !usb_SetScanParameters( dev, &m_ScanParam ) || (usleep(50*1000), - !usb_ScanBegin( dev, SANE_FALSE)) || + if( !usb_SetScanParameters( dev, &m_ScanParam )) + return SANE_FALSE; + + /* + * wait until warmup period has been elapsed + */ + gettimeofday( &t, NULL); + dw = t.tv_sec - dev->usbDev.dwTicksLampOn; + if( dw < dev->usbDev.dwWarmup ) + DBG(_DBG_INFO,"Warmup: Waiting %lu seconds\n",dev->usbDev.dwWarmup ); + + do { + + gettimeofday( &t, NULL); + + dw = t.tv_sec - dev->usbDev.dwTicksLampOn; + + if( usb_IsEscPressed()) { + DBG( _DBG_INFO, "ReadImage() - Cancel detected...\n" ); + return 0; + } + + } while( dw < dev->usbDev.dwWarmup ); + + if( !usb_ScanBegin( dev, SANE_FALSE) || !usb_ScanReadImage( dev, pScanBuffer, m_ScanParam.Size.dwPhyBytes ) || !usb_ScanEnd( dev )) { DBG( _DBG_ERROR, "usb_AdjustGain() failed\n" ); return SANE_FALSE; } - + usb_Swap((u_short *)pScanBuffer, m_ScanParam.Size.dwPhyBytes ); if( fNegative ) { @@ -515,8 +558,10 @@ TOGAIN: rgb.Red = rgb.Green = rgb.Blue = 0; + /* find out the max pixel value for R, G, B */ for( dw = 0; dwLoop1; dwLoop1-- ) { + /* do some averaging... */ for (dwLoop2 = dwDiv, dwR = dwG = dwB = 0; dwLoop2; dwLoop2--, dw++) { dwR += ((pRGBUShortDef)pScanBuffer)[dw].Red; @@ -537,21 +582,21 @@ TOGAIN: m_dwIdealGain = 0xf000; /* min(min(rgb.wRed, rgb.wGreen), rgb.wBlue) */ - a_bRegs[0x3b] = usb_GetNewGain(rgb.Red); - a_bRegs[0x3c] = usb_GetNewGain(rgb.Green); - a_bRegs[0x3d] = usb_GetNewGain(rgb.Blue); + a_bRegs[0x3b] = usb_GetNewGain( rgb.Red ); + a_bRegs[0x3c] = usb_GetNewGain( rgb.Green ); + a_bRegs[0x3d] = usb_GetNewGain( rgb.Blue ); /* for MODEL KaoHsiung 1200 scanner multi-straight-line bug at * 1200 dpi color mode */ - if( hw->ScannerModel == MODEL_KaoHsiung && scaps->bCCD==kNEC3778 && + if( hw->motorModel == MODEL_KaoHsiung && scaps->bCCD == kNEC3778 && dMCLK >= 5.5 && !a_bRegs[0x3c] ) { a_bRegs[0x3b] = a_bRegs[0x3c] = a_bRegs[0x3d] = 1; scanning->sParam.dMCLK = dMCLK = dMCLK - 1.5; goto TOGAIN; - } else if( hw->ScannerModel == MODEL_HuaLien && + } else if( hw->motorModel == MODEL_HuaLien && scaps->bCCD == kNEC3799 && fRepeatITA ) { if((!a_bRegs[0x3b] || @@ -586,12 +631,13 @@ TOGAIN: return SANE_TRUE; } -/*............................................................................. +/** usb_GetNewOffset * */ static void usb_GetNewOffset( u_long *pdwSum, u_long *pdwDiff, char *pcOffset, u_char *pIdeal, u_long dw, char cAdjust ) { + /* IDEAL_Offset is currently set to 0x1000 = 4096 */ u_long dwIdealOffset = IDEAL_Offset; if( pdwSum[dw] > dwIdealOffset ) { @@ -623,7 +669,12 @@ static void usb_GetNewOffset( u_long *pdwSum, u_long *pdwDiff, char *pcOffset, a_bRegs[0x38 + dw] = (u_char)(32 - pcOffset[dw]); } -/*............................................................................. +/** usb_AdjustOffset + * function to perform the "coarse calibration step" part 2. + * We scan reference image pixels to determine the optimum coarse offset settings + * for R, G, B. (Analog gain and offset prior to ADC). These coefficients are + * applied at the line rate during normal scanning. + * Affects register 0x38, 0x39 and 0x3a * */ static SANE_Bool usb_AdjustOffset( pPlustek_Device dev ) @@ -662,6 +713,9 @@ static SANE_Bool usb_AdjustOffset( pPlustek_Device dev ) while( cAdjust ) { + /* + * read data (a white calibration strip - hopefully ;-) + */ if((!usb_ScanBegin(dev, SANE_FALSE)) || (!usb_ScanReadImage(dev,pScanBuffer,m_ScanParam.Size.dwPhyBytes)) || !usb_ScanEnd( dev )) { @@ -679,12 +733,16 @@ static SANE_Bool usb_AdjustOffset( pPlustek_Device dev ) dwSum[1] += (u_long)_HILO2WORD(((pColorWordDef)pScanBuffer)[dw].HiLo[1]); dwSum[2] += (u_long)_HILO2WORD(((pColorWordDef)pScanBuffer)[dw].HiLo[2]); } + + /* do averaging for each channel */ dwSum[0] /= dwPixels; dwSum[1] /= dwPixels; dwSum[2] /= dwPixels; + usb_GetNewOffset( dwSum, dwDiff, cOffset, bExpect, 0, cAdjust ); usb_GetNewOffset( dwSum, dwDiff, cOffset, bExpect, 1, cAdjust ); usb_GetNewOffset( dwSum, dwDiff, cOffset, bExpect, 2, cAdjust ); + } else { dwSum[0] = 0; @@ -710,7 +768,7 @@ static SANE_Bool usb_AdjustOffset( pPlustek_Device dev ) return SANE_TRUE; } -/*............................................................................. +/** this * */ static void usb_GetDarkShading( pPlustek_Device dev, u_short *pwDest, @@ -722,12 +780,11 @@ static void usb_GetDarkShading( pPlustek_Device dev, u_short *pwDest, pDCapsDef scaps = &dev->usbDev.Caps; pHWDef hw = &dev->usbDev.HwSetting; -/* HEINER: check that */ -#if 0 - if(Registry.GetEvenOdd() == 2) + if( scaps->workaroundFlag & _WAF_BLACKFINE ) { - u_short w; + u_short w; + /* here we use the source buffer + a static offset */ for (dw = 0; dw < dwPixels; dw++, pSrce += dwAdd) { w = (u_short)((int)_PHILO2WORD(pSrce) + iOffset); @@ -736,7 +793,6 @@ static void usb_GetDarkShading( pPlustek_Device dev, u_short *pwDest, } else { -#endif dwSum [0] = dwSum [1] = 0; if( hw->bSensorConfiguration & 0x04 ) { @@ -772,11 +828,14 @@ static void usb_GetDarkShading( pPlustek_Device dev, u_short *pwDest, u_long dwEnd = 0; /* Standard CCD */ + + /* do some averaging on the line */ for( dw = dwEnd; dw < dwPixels; dw++, pSrce += dwAdd ) dwSum[0] += (u_long)_PHILO2WORD(pSrce); dwSum [0] /= (dwPixels - dwEnd); + /* add our offset... */ dwSum [0] = (int)dwSum[0] + iOffset; if((int)dwSum[0] < 0) dwSum [0] = 0; @@ -784,14 +843,18 @@ static void usb_GetDarkShading( pPlustek_Device dev, u_short *pwDest, dwSum[0] = (u_long)_LOBYTE(_LOWORD(dwSum[0])) * 256UL + _HIBYTE(_LOWORD(dwSum[0])); + /* fill the shading data */ for( dw = dwEnd; dw < dwPixels; dw++ ) pwDest[dw] = (u_short)dwSum [0]; } -/* } */ + } } -/*............................................................................. - * +/** usb_AdjustDarkShading + * fine calibration part 1 - read the black calibration area and write + * the black line data to the offset coefficient data in Merlins' DRAM + * If there's no black line available, we can use the min pixel value + * from coarse calibration... */ static SANE_Bool usb_AdjustDarkShading( pPlustek_Device dev ) { @@ -811,6 +874,7 @@ static SANE_Bool usb_AdjustDarkShading( pPlustek_Device dev ) m_ScanParam.dMCLK = dMCLK; if( _LM9831 == hw->chip ) { + m_ScanParam.UserDpi.x = usb_SetAsicDpiX( dev, m_ScanParam.UserDpi.x); if( m_ScanParam.UserDpi.x < 100) m_ScanParam.UserDpi.x = 150; @@ -827,28 +891,26 @@ static SANE_Bool usb_AdjustDarkShading( pPlustek_Device dev ) m_ScanParam.UserDpi.x / scanning->sParam.UserDpi.x; } else { m_ScanParam.Size.dwBytes = m_ScanParam.Size.dwPixels * - 2 * m_ScanParam.bChannels; + 2 * m_ScanParam.bChannels; } + /* switch lamp off to read dark data... */ a_bRegs[0x29] = 0; + usb_switchLamp( dev, SANE_FALSE ); + usb_SetScanParameters( dev, &m_ScanParam ); - if((!usb_SetScanParameters( dev, &m_ScanParam)) || - (!usb_ScanBegin(dev, SANE_FALSE)) || + /* wait until really out ;-) - after glow !!! */ +#if 0 + usleep( 2000 * 1000 ); +#endif + if((!usb_ScanBegin(dev, SANE_FALSE)) || (!usb_ScanReadImage(dev,pScanBuffer,m_ScanParam.Size.dwPhyBytes)) || (!usb_ScanEnd( dev ))) { + + /* on error, reset the lamp settings*/ a_bRegs[0x29] = hw->bReg_0x29; - - if(_WAF_MISC_IO6_LAMP==(_WAF_MISC_IO6_LAMP & scaps->workaroundFlag)) { - a_bRegs[0x5b] = 0x94; - usbio_WriteReg( dev->fd, 0x5b, a_bRegs[0x5b] ); - - } else if( _WAF_MISC_IO3_LAMP == - (_WAF_MISC_IO3_LAMP & scaps->workaroundFlag)) { - a_bRegs[0x5a] |= 0x08; - usbio_WriteReg( dev->fd, 0x5a, a_bRegs[0x5a] ); - - } + usb_switchLamp( dev, SANE_TRUE ); usbio_WriteReg( dev->fd, 0x29, a_bRegs[0x29] ); DBG( _DBG_ERROR, "usb_AdjustDarkShading() failed\n" ); @@ -856,20 +918,10 @@ static SANE_Bool usb_AdjustDarkShading( pPlustek_Device dev ) } /* - * set illumination mode to 1 or 3 on EPSON + * set illumination mode and switch lamp on again */ a_bRegs[0x29] = hw->bReg_0x29; - - if( _WAF_MISC_IO6_LAMP == (_WAF_MISC_IO6_LAMP & scaps->workaroundFlag)) { - - a_bRegs[0x5b] = 0x94; - usbio_WriteReg( dev->fd, 0x5b, a_bRegs[0x5b] ); - - } else if( _WAF_MISC_IO3_LAMP == - (_WAF_MISC_IO3_LAMP & scaps->workaroundFlag)) { - a_bRegs[0x5a] |= 0x08; - usbio_WriteReg( dev->fd, 0x5a, a_bRegs[0x5a] ); - } + usb_switchLamp( dev, SANE_TRUE ); if( !usbio_WriteReg( dev->fd, 0x29, a_bRegs[0x29])) { DBG( _DBG_ERROR, "usb_AdjustDarkShading() failed\n" ); @@ -907,7 +959,9 @@ static SANE_Bool usb_AdjustDarkShading( pPlustek_Device dev ) return SANE_TRUE; } -/*............................................................................. +/** usb_AdjustWhiteShading + * fine calibration part 2 - read the white calibration area and calculate + * the gain coefficient for each pixel * */ static SANE_Bool usb_AdjustWhiteShading( pPlustek_Device dev ) @@ -919,6 +973,7 @@ static SANE_Bool usb_AdjustWhiteShading( pPlustek_Device dev ) u_long dw, dwLines, dwRead; pMonoWordDef pValue; u_long* pdw; + int i; m_pAvColor = (pRGBUShortDef)pScanBuffer; m_pAvMono = (u_short*)pScanBuffer; @@ -1132,8 +1187,6 @@ static SANE_Bool usb_AdjustWhiteShading( pPlustek_Device dev ) /* Software gain */ if( scanning->sParam.bSource != SOURCE_Negative ) { - - int i; for( i = 0; i < 3; i++ ) { @@ -1155,7 +1208,7 @@ static SANE_Bool usb_AdjustWhiteShading( pPlustek_Device dev ) } } else { for( dw = m_ScanParam.Size.dwPhyPixels * 3; dw; dw--, pValue++, pdw++) - pValue->Mono = (u_short)(*pdw / (dwShadingLines/*SHADING_Lines*/ - m_wHilight - m_wShadow)); + pValue->Mono = (u_short)(*pdw / (dwShadingLines - m_wHilight - m_wShadow)); } } else { @@ -1229,11 +1282,11 @@ static SANE_Bool usb_AdjustWhiteShading( pPlustek_Device dev ) } else{ for( dw = 0; dw < m_ScanParam.Size.dwPhyPixels; dw++ ) pValue[dw].Mono = (u_short)(pdw[dw] / - (dwShadingLines/*SHADING_Lines*/ - m_wHilight - m_wShadow)); + (dwShadingLines - m_wHilight - m_wShadow)); } } - if( hw->ScannerModel != MODEL_Tokyo600 ) { + if( hw->motorModel != MODEL_Tokyo600 ) { usb_ModuleMove( dev, MOVE_Forward, hw->wMotorDpi / 5 ); usb_ModuleToHome( dev, SANE_TRUE ); } @@ -1272,7 +1325,40 @@ static void usb_ResizeWhiteShading( double dAmp, u_short *pwShading, int iGain ) } } -/*............................................................................. +/** usb_SetMCLK + * get the MCLK out of our table + */ +static void usb_SetMCLK( pPlustek_Device dev ) +{ + int idx, i; + pClkMotorDef clk; + + pScanDef scanning = &dev->scanning; + pHWDef hw = &dev->usbDev.HwSetting; + + clk = usb_GetMotorSet( hw->motorModel ); + idx = 0; + for( i = 0; i < _MAX_CLK; i++ ) { + if( scanning->sParam.PhyDpi.x <= dpi_ranges[i] ) + break; + idx++; + } + if( idx >= _MAX_CLK ) + idx = _MAX_CLK - 1; + + if( scanning->sParam.bDataType != SCANDATATYPE_Color ) + dMCLK = clk->gray_mclk[idx]; + else + dMCLK = clk->color_mclk[idx]; + + scanning->sParam.dMCLK = dMCLK; + + DBG( _DBG_INFO, "SETMCLK[%u/%u], using entry %u: %f, %u\n", + hw->motorModel, scanning->sParam.bDataType, + idx, dMCLK, scanning->sParam.PhyDpi.x ); +} + +/** usb_DoCalibration * */ static int usb_DoCalibration( pPlustek_Device dev ) @@ -1284,7 +1370,7 @@ static int usb_DoCalibration( pPlustek_Device dev ) DBG( _DBG_INFO, "usb_DoCalibration()\n" ); if( SANE_TRUE == scanning->fCalibrated ) - return 0; + return SANE_TRUE; usb_GetSoftwareOffsetGain( dev ); @@ -1303,19 +1389,20 @@ static int usb_DoCalibration( pPlustek_Device dev ) else m_ScanParam.bDataType = SCANDATATYPE_Gray; + /* preset these registers offset/gain */ a_bRegs[0x38] = a_bRegs[0x39] = a_bRegs[0x3a] = 0; a_bRegs[0x3b] = a_bRegs[0x3c] = a_bRegs[0x3d] = 1; a_bRegs[0x45] &= ~0x10; /* Go to shading position - * Wait for function implemented */ DBG( _DBG_INFO, "goto shading position\n" ); /* HEINER: Currently not clear why Plustek didn't use the ShadingOriginY * for all modes + * It should be okay to remove thisand reference to the ShadingOriginY */ -#if 1 +#if 0 if( scanning->sParam.bSource == SOURCE_Negative ) { DBG( _DBG_INFO, "DataOrigin.x=%u, DataOrigin.y=%u\n", @@ -1331,7 +1418,7 @@ static int usb_DoCalibration( pPlustek_Device dev ) DBG( _DBG_INFO, "ShadingOriginY=%lu\n", (u_long)dev->usbDev.pSource->ShadingOriginY ); - if((hw->ScannerModel == MODEL_HuaLien) && (scaps->OpticDpi.x == 600)) { + if((hw->motorModel == MODEL_HuaLien) && (scaps->OpticDpi.x == 600)) { if (!usb_ModuleMove(dev, MOVE_ToShading, (u_long)dev->usbDev.pSource->ShadingOriginY)) { return _E_LAMP_NOT_IN_POS; @@ -1342,7 +1429,7 @@ static int usb_DoCalibration( pPlustek_Device dev ) return _E_LAMP_NOT_IN_POS; } } - } +/* }*/ DBG( _DBG_INFO, "shading position reached\n" ); @@ -1373,7 +1460,7 @@ static int usb_DoCalibration( pPlustek_Device dev ) Gain_Reg.Green = a_bRegs[0x3c]; Gain_Reg.Blue = a_bRegs[0x3d]; Gain_NegHilight = Gain_Hilight; -#if 1 +#if 0 if( !usb_ModuleMove( dev, MOVE_Backward, dev->usbDev.pSource->DataOrigin.y + dev->usbDev.pSource->Size.y / 2 - @@ -1388,8 +1475,8 @@ static int usb_DoCalibration( pPlustek_Device dev ) if(!usb_AdjustGain( dev, 1 )) return _E_INTERNAL; - a_bRegs[0x3b] = a_bRegs[0x3c] = a_bRegs[0x3d] = 1; - + /* a_bRegs[0x3b] = a_bRegs[0x3c] = a_bRegs[0x3d] = 1; + */ DBG( _DBG_INFO, "Settings done, so start...\n" ); if( !usb_AdjustOffset(dev) || !usb_AdjustDarkShading(dev) || !usb_AdjustWhiteShading(dev)) { @@ -1423,7 +1510,7 @@ static int usb_DoCalibration( pPlustek_Device dev ) case SOURCE_ADF: DBG( _DBG_INFO, "ADF Shading\n" ); m_dwIdealGain = IDEAL_GainPositive; - if( scanning->sParam.bDataType == SCANDATATYPE_BW ) { + if( scanning->sParam.bDataType == SCANDATATYPE_BW ) { if( scanning->sParam.PhyDpi.x <= 200 ) { scanning->sParam.dMCLK = 4.5; dMCLK = 4.0; @@ -1479,18 +1566,15 @@ static int usb_DoCalibration( pPlustek_Device dev ) break; default: - if( dev->usbDev.Caps.OpticDpi.x == 600 ) { + if( !_IS_PLUSTEKMOTOR(hw->motorModel)) { + DBG( _DBG_INFO, "No Plustek model: %udpi\n", + scanning->sParam.PhyDpi.x ); + usb_SetMCLK( dev ); + + } else if( dev->usbDev.Caps.OpticDpi.x == 600 ) { DBG( _DBG_INFO, "Default Shading (600dpi)\n" ); - if( MODEL_NOPLUSTEK == hw->ScannerModel ) { - DBG( _DBG_INFO, "No Plustek model\n" ); - - if( scanning->sParam.PhyDpi.x > 300 ) - scanning->sParam.dMCLK = dMCLK = ((scanning->sParam.bDataType == SCANDATATYPE_Color)? 3: 9); - else - scanning->sParam.dMCLK = dMCLK = ((scanning->sParam.bDataType == SCANDATATYPE_Color)? 2: 6); - - } else if( dev->usbDev.Caps.bCCD == kSONY548 ) { + if( dev->usbDev.Caps.bCCD == kSONY548 ) { DBG( _DBG_INFO, "CCD - SONY548\n" ); if( scanning->sParam.PhyDpi.x <= 75 ) { @@ -1543,7 +1627,7 @@ static int usb_DoCalibration( pPlustek_Device dev ) DBG( _DBG_INFO, "CAPS - Buttons\n" ); scanning->sParam.dMCLK = dMCLK = ((scanning->sParam.bDataType == SCANDATATYPE_Color)?3: 6); - if( dev->usbDev.HwSetting.ScannerModel == MODEL_KaoHsiung ) { + if( dev->usbDev.HwSetting.motorModel == MODEL_KaoHsiung ) { if( dev->usbDev.Caps.bCCD == kNEC3799 ) { if( scanning->sParam.PhyDpi.x > 300 ) scanning->sParam.dMCLK = dMCLK = ((scanning->sParam.bDataType == SCANDATATYPE_Color)? 6: 13); @@ -1554,7 +1638,7 @@ static int usb_DoCalibration( pPlustek_Device dev ) } else { scanning->sParam.dMCLK = dMCLK = ((scanning->sParam.bDataType == SCANDATATYPE_Color)?3: 6); } - } else { /* ScannerModel == MODEL_Hualien */ + } else { /* motorModel == MODEL_Hualien */ /* IMPORTANT !!!! * for Hualien 600 dpi scanner big noise */ @@ -1610,9 +1694,16 @@ static int usb_DoCalibration( pPlustek_Device dev ) m_dwIdealGain = IDEAL_GainNormal; DBG( _DBG_INFO, "Settings done, so start...\n" ); - if( !usb_AdjustGain(dev, 0) || !usb_AdjustOffset(dev) || - !usb_AdjustDarkShading(dev) || !usb_AdjustWhiteShading(dev)) { - DBG( _DBG_ERROR, "Shading failed!!!\n" ); + if( !usb_AdjustGain(dev, 0)) { + DBG( _DBG_ERROR, "Coarse Calibration failed!!!\n" ); + return _E_INTERNAL; + } + if( !usb_AdjustOffset(dev)) { + DBG( _DBG_ERROR, "Coarse Calibration failed!!!\n" ); + return _E_INTERNAL; + } + if( !usb_AdjustDarkShading(dev) || !usb_AdjustWhiteShading(dev)) { + DBG( _DBG_ERROR, "Fine Calibration!!!\n" ); return _E_INTERNAL; } break; @@ -1620,12 +1711,22 @@ static int usb_DoCalibration( pPlustek_Device dev ) scanning->fCalibrated = SANE_TRUE; DBG( _DBG_INFO, "Calibration done\n-----------------------\n" ); + DBG( _DBG_INFO, "Static Gain:\n" ); + DBG( _DBG_INFO, "REG[0x3b] = %u\n", a_bRegs[0x3b] ); + DBG( _DBG_INFO, "REG[0x3c] = %u\n", a_bRegs[0x3c] ); + DBG( _DBG_INFO, "REG[0x3d] = %u\n", a_bRegs[0x3d] ); + DBG( _DBG_INFO, "Static Offset:\n" ); + DBG( _DBG_INFO, "REG[0x38] = %u\n", a_bRegs[0x38] ); + DBG( _DBG_INFO, "REG[0x39] = %u\n", a_bRegs[0x39] ); + DBG( _DBG_INFO, "REG[0x3a] = %u\n", a_bRegs[0x3a] ); + DBG( _DBG_INFO, "-----------------------\n" ); return SANE_TRUE; } -/*............................................................................. - * +/** 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( pPlustek_Device dev, u_char bJobID ) { @@ -1651,6 +1752,12 @@ static SANE_Bool usb_DownloadShadingData( pPlustek_Device dev, u_char bJobID ) } a_bRegs[0x40] = 0x40; a_bRegs[0x41] = 0x00; + + /* set RAM configuration AND + * Gain = Multiplier Coefficient/16384 + * CFG Register 0x40/0x41 for Multiplier Coefficient Source + * External DRAM for Offset Coefficient Source + */ a_bRegs[0x42] = (u_char)(( hw->wDRAMSize > 512)? 0x64: 0x24); _UIO(sanei_lm983x_write( dev->fd, 0x40, @@ -1662,7 +1769,7 @@ static SANE_Bool usb_DownloadShadingData( pPlustek_Device dev, u_char bJobID ) if( _LM9831 != hw->chip ) m_dwPixels = m_ScanParam.Size.dwPhyPixels; - /* Download the dark & white shadings to LM9831 */ + /* Download the dark & white shadings to LM983x */ if( pParam->bDataType == SCANDATATYPE_Color ) { usb_SetDarkShading( dev->fd, CHANNEL_red, a_wDarkShading, (u_short)m_ScanParam.Size.dwPhyPixels * 2); @@ -1693,7 +1800,12 @@ static SANE_Bool usb_DownloadShadingData( pPlustek_Device dev, u_char bJobID ) usb_SetWhiteShading( dev->fd,CHANNEL_green,a_wWhiteShading, (u_short)m_ScanParam.Size.dwPhyPixels * 2); } - + + /* set RAM configuration AND + * Gain = Multiplier Coefficient/16384 + * External DRAM for Multiplier Coefficient Source + * External DRAM for Offset Coefficient Source + */ a_bRegs[0x42] = (u_char)((hw->wDRAMSize > 512)? 0x66: 0x26); if( !usbio_WriteReg( dev->fd, 0x42, a_bRegs[0x42])) @@ -1702,10 +1814,17 @@ static SANE_Bool usb_DownloadShadingData( pPlustek_Device dev, u_char bJobID ) break; default: - a_bRegs[0x3E] = 0; - a_bRegs[0x3F] = 0; + /* for coarse calibration and "black fine"*/ + a_bRegs[0x3e] = 0; + a_bRegs[0x3f] = 0; a_bRegs[0x40] = 0x40; a_bRegs[0x41] = 0x00; + + /* set RAM configuration AND + * Bypass Multiplier + * CFG Register 0x40/0x41 for Multiplier Coefficient Source + * CFG Register 0x3e/0x3f for Offset Coefficient Source + */ a_bRegs[0x42] = (u_char)((hw->wDRAMSize > 512)? 0x60: 0x20); _UIO(sanei_lm983x_write( dev->fd, 0x3e, &a_bRegs[0x3e], diff --git a/backend/plustek.c b/backend/plustek.c index b9c27cb62..99b6e7483 100644 --- a/backend/plustek.c +++ b/backend/plustek.c @@ -49,6 +49,7 @@ * fixed a bug that causes segfault when using the autodetection for USB * devices * added OS/2 switch to disable the USB stuff for OS/2 + * 0.43 - added support for PREVIEW flag * *............................................................................. * @@ -140,6 +141,7 @@ #define _DBG_INFO 5 #define _DBG_PROC 7 #define _DBG_SANE_INIT 10 +#define _DBG_INFO2 13 #define _DBG_READ 15 /*****************************************************************************/ @@ -593,7 +595,9 @@ static SANE_Status do_cancel( Plustek_Scanner *scanner, SANE_Bool closepipe ) */ static SANE_Status limitResolution( Plustek_Device *dev ) { - dev->dpi_range.min = _DEF_DPI; + dev->dpi_range.min = /*lens.rDpiY.wMin; */ _DEF_DPI; + if( dev->dpi_range.min < _DEF_DPI ) + dev->dpi_range.min = _DEF_DPI; /* * CHANGE: limit resolution to max. physical available one @@ -804,6 +808,13 @@ static SANE_Status init_options( Plustek_Scanner *s ) s->opt[OPT_CUSTOM_GAMMA].type = SANE_TYPE_BOOL; s->val[OPT_CUSTOM_GAMMA].w = SANE_FALSE; + /* preview */ + s->opt[OPT_PREVIEW].name = SANE_NAME_PREVIEW; + s->opt[OPT_PREVIEW].title = SANE_TITLE_PREVIEW; + s->opt[OPT_PREVIEW].desc = SANE_DESC_PREVIEW; + s->opt[OPT_PREVIEW].cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT; + s->val[OPT_PREVIEW].w = 0; + /* "Geometry" group: */ s->opt[OPT_GEOMETRY_GROUP].name = "geometry-group"; s->opt[OPT_GEOMETRY_GROUP].title = SANE_I18N("Geometry"); @@ -1151,7 +1162,7 @@ static SANE_Status attach( const char *dev_name, pCnfDef cnf, dev->getCaps = usbDev_getCaps; dev->getLensInfo = usbDev_getLensInfo; dev->getCropInfo = usbDev_getCropInfo; - dev->putImgInfo = usbDev_putImgInfo; + dev->putImgInfo = NULL; dev->setScanEnv = usbDev_setScanEnv; dev->startScan = usbDev_startScan; dev->stopScan = usbDev_stopScan; @@ -1349,8 +1360,9 @@ SANE_Status sane_init( SANE_Int *version_code, SANE_Auth_Callback authorize ) decodeVal( str, "warmup", _INT, &config.adj.warmup, &ival); decodeVal( str, "lampOff", _INT, &config.adj.lampOff, &ival); decodeVal( str, "lOffOnEnd", _INT, &config.adj.lampOffOnEnd,&ival); - + ival = 0; + decodeVal( str, "enableTPA", _INT, &config.adj.enableTpa, &ival ); decodeVal( str, "posOffX", _INT, &config.adj.pos.x, &ival ); decodeVal( str, "posOffY", _INT, &config.adj.pos.y, &ival ); @@ -1626,6 +1638,7 @@ SANE_Status sane_control_option( SANE_Handle handle, SANE_Int option, case SANE_ACTION_GET_VALUE: switch (option) { + case OPT_PREVIEW: case OPT_NUM_OPTS: case OPT_RESOLUTION: case OPT_TL_X: @@ -1706,6 +1719,8 @@ SANE_Status sane_control_option( SANE_Handle handle, SANE_Int option, break; } + + case OPT_PREVIEW: case OPT_TL_X: case OPT_TL_Y: case OPT_BR_X: @@ -2112,11 +2127,18 @@ SANE_Status sane_start( SANE_Handle handle ) sinfo.ImgDef.wLens = s->hw->caps.wLens; - result = s->hw->putImgInfo( s->hw, &sinfo.ImgDef ); - if( result < 0 ) { - DBG( _DBG_ERROR, "dev->putImgInfo failed(%d)\n", result ); - s->hw->close( s->hw ); - return SANE_STATUS_IO_ERROR; + /* only for parallel-port devices */ + if( s->hw->putImgInfo ) { + result = s->hw->putImgInfo( s->hw, &sinfo.ImgDef ); + if( result < 0 ) { + DBG( _DBG_ERROR, "dev->putImgInfo failed(%d)\n", result ); + s->hw->close( s->hw ); + return SANE_STATUS_IO_ERROR; + } + } else { + + memcpy( &(crop.ImgDef), &sinfo.ImgDef, sizeof(ImgDef)); + } result = s->hw->getCropInfo( s->hw, &crop ); @@ -2134,6 +2156,12 @@ SANE_Status sane_start( SANE_Handle handle ) /* build a SCANINFO block and get ready to scan it */ sinfo.ImgDef.dwFlag |= (SCANDEF_BuildBwMap | SCANDEF_QualityScan); + /* remove that for preview scans (USB only) */ + if( _ASIC_IS_USB == s->hw->caps.AsicID ) { + if( s->val[OPT_PREVIEW].w ) + sinfo.ImgDef.dwFlag &= (~SCANDEF_QualityScan); + } + /* set adjustments for brightness and contrast */ sinfo.siBrightness = s->val[OPT_BRIGHTNESS].w; sinfo.siContrast = s->val[OPT_CONTRAST].w; diff --git a/backend/plustek.conf b/backend/plustek.conf index 1a5223112..3d7a93207 100644 --- a/backend/plustek.conf +++ b/backend/plustek.conf @@ -77,6 +77,13 @@ option greenGamma 1.0 option blueGamma 1.0 option grayGamma 1.0 +# +# to enable TPA (non Plustek devices only) +# 0 means default behaviour as specified in the internal tables +# 1 means enable +# +enableTPA 0 + # # and of course the device-name # diff --git a/backend/plustek.h b/backend/plustek.h index 9a02adf2e..00c359099 100644 --- a/backend/plustek.h +++ b/backend/plustek.h @@ -35,6 +35,7 @@ * 0.42 - added custom gamma tables * changed usbId to static array * added _MAX_ID_LEN + * 0.43 - no changes * *............................................................................. * @@ -127,6 +128,7 @@ enum { OPT_MODE, OPT_EXT_MODE, OPT_RESOLUTION, + OPT_PREVIEW, OPT_GEOMETRY_GROUP, OPT_TL_X, OPT_TL_Y, diff --git a/doc/descriptions/plustek.desc b/doc/descriptions/plustek.desc index 3c4a37662..0de7fb6e8 100644 --- a/doc/descriptions/plustek.desc +++ b/doc/descriptions/plustek.desc @@ -10,7 +10,7 @@ ; :backend "plustek" ; name of backend -:version "0.42" ; version of backend +:version "0.43" ; version of backend :status :stable ; :alpha, :beta, :stable, :new :manpage "sane-plustek" ; name of manpage (if it exists) @@ -29,99 +29,105 @@ ;name models for above-specified mfg. :model "OpticPro 4800P" :interface "Parport (SPP, EPP)" -:comment "OK" +:status :stable :model "OpticPro 4830P" :interface "Parport (SPP, EPP)" -:comment "OK" +:status :stable :model "OpticPro 600P/6000P" :interface "Parport (SPP, EPP)" -:comment "OK" +:status :stable :model "OpticPro 4831P" :interface "Parport (SPP, EPP)" -:comment "OK" +:status :stable :model "OpticPro 9630P" :interface "Parport (SPP, EPP)" -:comment "OK" +:status :stable :model "OpticPro 9630PL" :interface "Parport (SPP, EPP)" -:comment "OK - use driver-switch mov=1" +:status :stable +:comment "use driver-switch mov=1" :model "OpticPro 9600P" :interface "Parport (SPP, EPP)" -:comment "OK" +:status :stable :model "OpticPro 1236P" :interface "Parport (SPP, EPP)" -:comment "OK - reported as OpticPro 12000P/96000P" +:status :stable +:comment "reported as OpticPro 12000P/96000P" :model "OpticPro 12000P/96000P" :interface "Parport (SPP, EPP)" -:comment "OK" +:status :stable :model "OpticPro 9636P" :interface "Parport (SPP, EPP)" -:comment "OK - use driver-switch mov=4" +:status :stable +:comment "use driver-switch mov=4" :model "OpticPro 9636P+/Turbo" :interface "Parport (SPP, EPP)" -:comment "OK - use driver-switch mov=3" +:status :stable +:comment "use driver-switch mov=3" :model "OpticPro 9636T" :interface "Parport (SPP, EPP)" -:comment "OK" +:status :stable :model "OpticPro 12000T" :interface "Parport (SPP, EPP)" -:comment "OK" +:status :stable :model "OpticPro AI3" :interface "Parport (SPP, EPP)" -:comment "OK - use driver-switch mov=5" +:status :stable +:comment "use driver-switch mov=5" :model "OpticPro P8" :interface "Parport" -:comment "Not tested." +:status :untested :model "OpticPro P12" :interface "Parport (SPP, EPP)" -:comment "OK" +:status :stable :model "OpticPro PT12" :interface "Parport (SPP, EPP)" -:comment "OK." +:status :stable :model "OpticPro 19200S" :interface "SCSI" +:status :unsupported :comment "rebadged Artec AM12S (supported by Artec Backend)" :model "OpticPro 1212U" :interface "USB" -:comment "not supported." +:status :unsupported :model "OpticPro U12" :interface "USB" -:comment "OK." +:status :stable :model "OpticPro UT12" :interface "USB" -:comment "OK." +:status :stable :model "OpticPro UT16" :interface "USB" -:comment "OK." +:status :stable :model "OpticPro U24" :interface "USB" -:comment "OK." +:status :stable :model "OpticPro UT24" :interface "USB" -:comment "OK." +:status :stable :mfg "Primax" ; name of manufacturer @@ -130,46 +136,54 @@ ;name models for above-specified mfg. :model "Colorado 4800" :interface "Parport (SPP, EPP)" -:comment "Not tested, (same as OP4800P)" +:status :untested +:comment "same as OpticPro 4800P" :model "Compact 4800 Direct" :interface "Parport (SPP, EPP)" -:comment "OK - use driver-switch mov=2" +:status :stable +:comment "use driver-switch mov=2" :model "Compact 4800 Direct-30" :interface "Parport (SPP, EPP)" -:comment "Not tested, (same as OP4830P)" +:status :untested +:comment "same as OpticPro 4830P" :model "Compact 9600 Direct-30" :interface "Parport (SPP, EPP)" -:comment "OK - (same as OP9630P)" +:status :stable +:comment "same as OpticPro 9630P" :mfg "Aries" ; name of manufacturer :model "Scan-It Pro 4800" :interface "Parport (SPP, EPP)" -:comment "OK - use driver-switch mov=2" +:status :stable +:comment "use driver-switch mov=2" -:mfg "KYE - Genius" ; name of manufacturer +:mfg "Genius" ; name of manufacturer :url "http://www.geniusnet.com.tw/" :model "Colorpage Vivid III V2" :interface "Parport (SPP, EPP)" -:comment "OK - Reported as PT12" +:status :stable +:comment "Reported as PT12" :model "Colorpage Vivid Pro II Film" :interface "Parport (SPP, EPP)" -:comment "OK - Reported as OP9636T/12000T" +:status :stable +:comment "Reported as OP9636T/12000T" :model "Colorpage HR6 V2" :interface "USB" -:comment "OK" +:status :stable :mfg "BrightScan" :model "BrighScan OpticPro" :interface "Parport (SPP, EPP)" -:comment "OK - Reported as P12" +:status :stable +:comment "Reported as P12" :mfg "Mustek" ; name of manufacturer :url "http://www.mustek.com/" @@ -177,39 +191,43 @@ ;name models for above-specified mfg. :model "BearPaw 1200" :interface "USB" -:comment "Mostly OK" +:status :stable :model "BearPaw 2400" :interface "USB" +:status :stable :comment "Mostly OK" :mfg "Hewlett-Packard" ; name of manufacturer :url "http://www.hp.com/" -:model "HP ScanJet 2100C" +:model "ScanJet 2100C" :interface "USB" -:comment "Mostly OK" +:status :stable -:model "HP ScanJet 2200C" +:model "ScanJet 2200C" :interface "USB" -:comment "Mostly OK" +:status :stable :mfg "Epson" ; name of manufacturer :url "http://www.epson.com/" :model "Perfection 1250" :interface "USB" +:status :stable :comment "Mostly OK" :model "Perfection 1250Photo" :interface "USB" -:comment "Mostly OK - TPU not supported" +:status :stable +:comment "Mostly OK - use enableTPA" :mfg "Umax" ; name of manufacturer :url "http://www.umax.com/" :model "UMAX 3400" :interface "USB" +:status :stable :comment "Mostly OK" ; :comment and :url specifiers are optional after :mfg, :model, :desc, diff --git a/po/saneopts.es.po b/po/saneopts.es.po index 41e1f6cd6..fac7841af 100644 --- a/po/saneopts.es.po +++ b/po/saneopts.es.po @@ -1,34 +1,35 @@ +# translation of saneopts.es.po to Castellano # Translation file for common options from the file saneopts.h # Copyright (C) 2002 Henning Meier-Geinitz # Based on the translation file for the UMAX and Mustek backends +# Gustavo D. Vranjes , 2002 msgid "" msgstr "" -"Project-Id-Version: sane-backends 1.0.7\n" +"Project-Id-Version: saneopts.es\n" "POT-Creation-Date: 2002-01-18 22:49+0100\n" -"PO-Revision-Date: 2002-03-05 01:45GMT\n" +"PO-Revision-Date: 2002-06-06 22:24GMT\n" "Last-Translator: Gustavo D. Vranjes \n" "Language-Team: Castellano \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=ISO-8859-1\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: KBabel 0.9.5\n" +"X-Generator: KBabel 1.0beta1\n" #: .tmp/saneopts.h:105 msgid "Number of options" msgstr "Número de opciones" #: .tmp/saneopts.h:106 - msgid "Preview" msgstr "Previsualizar" #: .tmp/saneopts.h:107 msgid "Force monochrome preview" -msgstr "" +msgstr "Forzar vista previa monocroma" #: .tmp/saneopts.h:108 msgid "Bit depth" -msgstr "" +msgstr "Profundidad de bit" # Scanmodus #: .tmp/saneopts.h:109 @@ -45,7 +46,7 @@ msgstr "Fuente de Escaneo" #: .tmp/saneopts.h:112 msgid "Force backtracking" -msgstr "" +msgstr "Forzar backtracking" #: .tmp/saneopts.h:113 msgid "Top-left x" @@ -100,17 +101,16 @@ msgid "Brightness" msgstr "Brillo" #: .tmp/saneopts.h:126 - msgid "Contrast" msgstr "Contraste" #: .tmp/saneopts.h:127 msgid "Grain size" -msgstr "" +msgstr "Tamaño del grano" #: .tmp/saneopts.h:128 msgid "Halftoning" -msgstr "" +msgstr "Mediostonos" #: .tmp/saneopts.h:129 msgid "Black level" @@ -121,7 +121,6 @@ msgid "White level" msgstr "Nivel de Blanco" #: .tmp/saneopts.h:131 - msgid "Shadow" msgstr "Sombra" @@ -154,22 +153,18 @@ msgid "Highlight for blue" msgstr "Resaltado para azul" #: .tmp/saneopts.h:139 - msgid "Hue" msgstr "Tono" #: .tmp/saneopts.h:140 - msgid "Saturation" msgstr "Saturación" #: .tmp/saneopts.h:141 - msgid "Filename" msgstr "Nombre de archivo" #: .tmp/saneopts.h:142 - msgid "Halftone pattern size" msgstr "Medida del patrón de mediotono" @@ -182,7 +177,6 @@ msgid "Bind X and Y resolution" msgstr "Enlazar resoluciones X e Y" #: .tmp/saneopts.h:145 - msgid "Negative" msgstr "Negativo" @@ -192,11 +186,11 @@ msgstr "Calibraci #: .tmp/saneopts.h:147 msgid "Double Optical Resolution" -msgstr "" +msgstr "Doble Resolución Óptica" #: .tmp/saneopts.h:148 msgid "Bind RGB" -msgstr "" +msgstr "Enlazar RGB" #: .tmp/saneopts.h:149 msgid "Threshold" @@ -204,39 +198,39 @@ msgstr "Umbral" #: .tmp/saneopts.h:150 msgid "Analog gamma correction" -msgstr "" +msgstr "Corrección de gamma analógica" #: .tmp/saneopts.h:151 msgid "Analog gamma red" -msgstr "" +msgstr "Gamma analógico rojo" #: .tmp/saneopts.h:152 msgid "Analog gamma green" -msgstr "" +msgstr "Gamma analógico verde" #: .tmp/saneopts.h:153 msgid "Analog gamma blue" -msgstr "" +msgstr "Gamma analógico azul" #: .tmp/saneopts.h:154 msgid "Bind analog gamma" -msgstr "" +msgstr "Enlazar gamma analógico" #: .tmp/saneopts.h:155 msgid "Smear" -msgstr "" +msgstr "Tiznar" #: .tmp/saneopts.h:156 msgid "10 bit-mode" -msgstr "" +msgstr "Modo de 10 bits" #: .tmp/saneopts.h:157 msgid "12 bit-mode" -msgstr "" +msgstr "Modo de 12 bits" #: .tmp/saneopts.h:158 msgid "Warmup lamp" -msgstr "" +msgstr "Lámpara de calentamiento" #: .tmp/saneopts.h:159 msgid "Preview patch" @@ -569,7 +563,7 @@ msgstr "Definir tiempo de exposici #: .tmp/saneopts.h:354 msgid "Enable selection of exposure-time" -msgstr "" +msgstr "Establecer selección del tiempo de exposición" #: .tmp/saneopts.h:356 msgid "Define lamp density for calibration" @@ -581,5 +575,5 @@ msgstr "Definir densidad de la l #: .tmp/saneopts.h:360 msgid "Enable selection of lamp density" -msgstr "" +msgstr "Establecer selección de la densidad de la lámpara"