[sane-devel] Sheetfed Scanners

John McGill jmcgill85258 at yahoo.com
Mon Nov 3 05:34:36 UTC 2008


Hello Gerhard,
Here is an update on adding support for the Pentax DSMobile to the plustek backend.

In plustek-usbdevs.c I have added the following sections:

/* TravelScan Pro-Pentax DSMobile sheet-fed scanner
 */
static DCapsDef Cap0x0A82_0x2000 =
{
	{{ 0,   0}, 150, -1, {2550, 3508}, {75, 75}},
	{{ 0,   0},   0,  0, {0, 0}, { 0, 0 }},
	{{ 0,   0},   0,  0, {0, 0}, { 0, 0 }},
	{{ 0,   0},   0,  0, {0, 0}, { 0, 0 }},
	{300, 300},
	DEVCAPSFLAG_SheetFed,
	SENSORORDER_gbr,
	8,                  /* sensor distance                         */
	0,                  /* number of buttons                       */
	kNEC8861,           /* use default settings during calibration */
	0,                /* threshold for resetting sensor-order    */
	(_WAF_MISC_IO_LAMPS | _WAF_BIN_FROM_COLOR |
	_WAF_MISC_IO_BUTTONS | _WAF_GRAY_FROM_COLOR),
	_MIO5 + _PORT0 + _PS_INP_MIO2
};

and 

/** TravelScan Pro-Pentax DS Mobile */
static HWDef Hw0x0A82_0x2000 =
{
	0.50,   /* dMaxMotorSpeed                                 */
	0.40,   /* dMaxMoveSpeed                                  */
	0.0,    /* dHighSpeed                                     */
	100,    /* wIntegrationTimeLowLamp                        */
	100,    /* wIntegrationTimeHighLamp                       */
	300,    /* wMotorDpi (Full step DPI)                      */
	512,    /* wRAMSize (KB)                                  */
	3.75,   /* dMinIntegrationTimeLowres (ms)                 */
	5.75,   /* dMinIntegrationTimeHighres (ms)                */
	3000,   /* wGreenPWMDutyCycleLow (reg 0x2a + 0x2b)        */
	3000,   /* wGreenPWMDutyCycleHigh (reg 0x2a + 0x2b)       */

	0x09,   /* bSensorConfiguration (0x0b)                    */
	0x00,   /* sensor control settings (reg 0x0c)             */
	0x25,   /* sensor control settings (reg 0x0d)             */
	0x00,   /* sensor control settings (reg 0x0e)             */

	{0x18, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x03, 0x07},
	        /* mono (reg 0x0f to 0x18)                        */

	{0x18, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x03, 0x07},
	        /* color (reg 0x0f to 0x18)                       */

	(_BLUE_CH | _ONE_CH_COLOR), /* bReg_0x26 color mode       */

	0x00,   /* bReg 0x27 color mode                           */
	2,      /* bReg 0x29 illumination mode                    */

	{ 3, 2600, 3000, 2600, 3000, 2600, 3000 },
	{ 2, 2600, 3000, 2600, 3000, 2600, 3000 },

	257,      /* StepperPhaseCorrection (reg 0x1a + 0x1b)       */
	1,      /* bOpticBlackStart (reg 0x1c)                    */
	2,      /* bOpticBlackEnd (reg 0x1d)                      */
	0x02,   /* wActivePixelsStart (reg 0x1e + 0x1f)           */
	3200,   /* wLineEnd (reg 0x20 + 0x21)                     */

	2600,    /* red lamp on    (reg 0x2c + 0x2d)               */
	3000,   /* red lamp off   (reg 0x2e + 0x2f)               */
	2600,    /* green lamp on  (reg 0x30 + 0x31)               */
	3000,    /* green lamp off (reg 0x32 + 0x33)               */
	2600,    /* blue lamp on   (reg 0x34 + 0x35)               */
	3000,    /* blue lamp off  (reg 0x36 + 0x37)               */

	3,      /* stepper motor control (reg 0x45)               */
	0,      /* wStepsAfterPaperSensor2 (reg 0x4c + 0x4d)      */

	0,      /* steps to reverse when buffer is full reg 0x50) */
	0,      /* acceleration profile (reg 0x51)                */
	0,      /* lines to process (reg 0x54)                    */
	0x09,   /* kickstart (reg 0x55)                           */
	0x80,   /* pwm freq (reg 0x56)                            */
	0x14,   /* pwm duty cycle (reg 0x57)                      */

	0x01,   /* Paper sense (reg 0x58)                         */

	0xee,   /* misc io12 (reg 0x59)                           */
	0x16,   /* misc io34 (reg 0x5a)                           */
	0x09,   /* misc io56 (reg 0x5b)                           */
	0,      /* test mode ADC Output CODE MSB (reg 0x5c)       */
	0,      /* test mode ADC Output CODE LSB (reg 0x5d)       */
	0,      /* test mode (reg 0x5e)                           */
	_LM9833,
	MODEL_TSCAN_PRO,	/*motor setting*/
	1.8		/* what is this?usb speed?*/
};

and

	{ MODEL_TSCAN_PRO, 128, 20, 6, 75, 8400,
	/* Motor settings (PWM and PWM_Duty) */
		/* <=75dpi       <=100dpi      <=150dpi      <=200dpi      <=300dpi */
		{{ 128, 20, 1 }, { 128, 20, 1 }, { 128, 20, 1 }, { 128, 20, 1 }, { 128, 20, 1 },
		/* <=400dpi     <=600dpi      <=800dpi      <=1200dpi     <=2400dpi */
		{ 128, 20, 1 }, { 128, 20, 1 }, { 128, 20, 1 }, { 128, 20, 1 }, { 128, 20, 1 }},
		/* Color mode MCLK settings */
		{ 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0 },
		{ 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0 },
		/* Gray mode MCLK settings */
		{ 16.0, 16.0, 16.0, 16.0, 16.0, 16.0, 16.0, 16.0, 16.0, 16.0 },
		{ 16.0, 16.0, 16.0, 16.0, 16.0, 16.0, 16.0, 16.0, 16.0, 16.0 },
	},

My snoop logs are available at http://sites.google.com/site/roadwarriorscanner/top-page.

Currently the scanned images have faint vertical stripes. The image quality is suboptimal. The colors seem to be correct at lower resolutions, and switched at 300dpi. Calibration does not seem to be working correctly. Results of SANE_DEBUG_PLUSTEK=19 are attached.

To Do
1. Get calibration to work, so we can get the proper values for illumination mode settings.
2. Optimize flags in DCapsDef section, especially _MIO and add _WAF_RESET_SO_TO_RGB. Paper sense switch seems to be working for regular scans, but possibly not for the calibation scans. This scanner does not have any buttons, but does have a paper sense switch.
3. Optimize motor settings. What is MCLK? How do I find these settings. Did I guess the right settings? How do you set the lineend adjustment?
4. Is kNEC8861 the correct setting for DCapsDef section? This has something to do with calibration.
5. Figure out the correct value for sensor distance in DCapsDef section. I will look in plustek-usbscan.c and see how this is derived. For now, will use the Travelscan 464 value.
6. Is stepper motor control (reg 0x45) correct? My log gives the value of 0x13. 
7. What does the very last entry of HWDef section mean? Is it the usb speed?

 

Jack McGill


--- On Fri, 10/31/08, Gerhard Jaeger <gerhard at gjaeger.de> wrote:

> From: Gerhard Jaeger <gerhard at gjaeger.de>
> Subject: Re: [sane-devel] Sheetfed Scanners
> To: jmcgill at bigfoot.com, "SANE-List" <sane-devel at lists.alioth.debian.org>
> Date: Friday, October 31, 2008, 3:21 AM
> Hi Jack,
> 
> On Thursday 30 October 2008 19:53:46 John McGill wrote:
> [SNIPSNAP]
> > Your email inspired me to keep going. I have made some
> progress on the DS Mobile.  
> > (I will wait to work on my TravelScanPro 600 until
> after I learn how to get this one working).  
> 
> good to hear that ;)
> 
> > Based on my usbsnoop logs, I made new new DCapsDef and
> HWDef sections. I think I have the 
> > motor speeds correct.  
> 
> Great. In fact the motor speeds are correct, when the
> thingy moves smoothly.
> 
> > The colors are still not correct using SENSORORDER_gbr
> or rgb. 
> > When I try other combinations, I get a I/O error. 
> 
> Not that good...
> Which colors are swapped?
> Have you tried SENSORORDER_gbr? 
> What about the settings for IRIScan/Q-Scan USB001? 
> 
> I noticed that the sensor order changes depending on the
> resolution to scan.
> Try to scan @75 dpi and @ 300 dpi - what changes?
> 
> > There are two parameters that I don't know how to
> set, which may be 
> > the key to this problem. Maybe you could help.  
> > 
> > First, in HW Def, just after reg 0x29. The 464
> settings are:
> > 
> > 	{ 3, 500, 1045, 500, 990, 500, 990 },
> > 	{ 2, 500, 1045, 500, 990, 500, 990 },
> > 
> > While the Qscan uses:
> > 
> > 	{ 3,    0,    0, 2593, 4600,    0,    0 },
> > 	{ 2, 2593, 7100, 2593, 4600, 2593, 4480 },
> > 
> > I am currently using the 464 settings. Next I will try
> the Qscan settings for 
> > this parameter. Are these values based on the usb
> snoop log? Are they guessed or calculated? 
> 
> The first sets will come out of the snoop log. The first
> line will be
> used for gray scans, the second one for color scans. The
> first value is reg 0x29, the 
> following ones are for registers 0x2c...0x37, the rgb lamp
> on off values...
> Yes I know these settings are also found later on and are
> somehow duplicated, but I
> never found the time to cleanup that ;)
> 
> In general I got the final settings from the calibration
> step, where I set
> the debug environment (epxort SANE_DEBUG_PLUSTEK=19) and
> see what the automatic
> lamp adjustment produces:
> 
> [plustek] ###### ADJUST LAMP (COARSE)#######
> [plustek] MotorDPI=1200, MaxMoveSpeed=0.230,
> FFStepSize=452, Steps=180
> [plustek] MOTOR: PWM=0x08, PWM_DUTY=0x1f 0x45=0x13
> 0x48=0x01, 0x49=0xc4
> [plustek] MCLK_FFW = 12 --> 0x16
>    .
>    .
>    .
> [plustek] usb_ScanBegin() done.
> [plustek] usb_IsDataAvailableInDRAM()
> [plustek] Data is available
> [plustek] usbDev_ScanEnd(), start=1, park=0
> [plustek] * PhyBytes  = 30606
> [plustek] * PhyPixels = 5100
> [plustek] red_lamp_off  = 1911/2855/3800
> [plustek] green_lamp_off = 1661/2480/3300
> [plustek] blue_lamp_off = 1361/2030/2700
> [plustek] CUR(R,G,B)= 0xffff(65535), 0xe40f(58383),
> 0xd404(54276)
> [plustek] * TOO BRIGHT --> reduce
> [plustek] usb_AdjustLamps(1)
>    .
>    .
>    .
> [plustek] Data is available
> [plustek] usbDev_ScanEnd(), start=1, park=0
> [plustek] * PhyBytes  = 30606
> [plustek] * PhyPixels = 5100
> [plustek] red_lamp_off  = 1911/2383/2855
> [plustek] green_lamp_off = 1661/2480/3300
> [plustek] blue_lamp_off = 1361/2030/2700
> [plustek] CUR(R,G,B)= 0xe235(57909), 0xe4fc(58620),
> 0xd42b(54315)
> [plustek] * red_lamp_on    = 23
> [plustek] * red_lamp_off   = 2383
> [plustek] * green_lamp_on  = 23
> [plustek] * green_lamp_off = 2480
> [plustek] * blue_lamp_on   = 23
> [plustek] * blue_lamp_off  = 2030
> [plustek] cano_AdjustLightsource() done.
> [plustek] ###### ADJUST OFFSET (COARSE) ####
> 
> After the "lamp calibration" you'll get the
> values you need.
> 
> This lamp calibration lasts long if the start values are
> bad. The goal
> is to find much better values. The lamp_on values could be
> retrived
> from the usbsnoop log.
> 
> > Second, in DCapsDef there is a setting called sensor
> distance. The value is 
> > different for the Qscan and the TS464. I tried the
> values of 8 and then 2 and 
> > didn't see much of a difference.   
> 
> The "distance" is responsible for min DPI
> limitation - see 
> plustek-usbscan.c
> 
> > Should we put this email on the SANE message board, in
> case someone else has 
> > the same questions in the future? 
> 
> I'll cc it.
> 
> Good luck,
> - Gerhard
> 
> -- 
> sane-devel mailing list: sane-devel at lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/sane-devel
> Unsubscribe: Send mail with subject "unsubscribe
> your_password"
>              to sane-devel-request at lists.alioth.debian.org
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: debug_dsmobile.txt
Url: http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20081102/1b799b9f/attachment-0001.txt 


More information about the sane-devel mailing list