kopia lustrzana https://gitlab.com/sane-project/backends
				
				
				
			Added support for binary scanning for the CanoScan D660U, cleanup work.
							rodzic
							
								
									6bb7bcaf49
								
							
						
					
					
						commit
						349bce36ca
					
				|  | @ -705,9 +705,7 @@ static int usbDev_getCropInfo( Plustek_Device *dev, pCropInfo ci ) | |||
| 
 | ||||
| 	DBG( _DBG_INFO, "usbDev_getCropInfo()\n" ); | ||||
| 
 | ||||
| 	_VAR_NOT_USED(dev); | ||||
| 
 | ||||
| 	usb_GetImageInfo( &ci->ImgDef, &size ); | ||||
| 	usb_GetImageInfo( dev, &ci->ImgDef, &size ); | ||||
| 
 | ||||
| 	ci->dwPixelsPerLine = size.dwPixels; | ||||
| 	ci->dwLinesPerArea  = size.dwLines; | ||||
|  | @ -726,7 +724,7 @@ static int usbDev_getCropInfo( Plustek_Device *dev, pCropInfo ci ) | |||
| /**
 | ||||
|  */ | ||||
| static int usbDev_setMap( Plustek_Device *dev, SANE_Word *map, | ||||
| 						  SANE_Word length, SANE_Word channel ) | ||||
|                           SANE_Word length, SANE_Word channel ) | ||||
| { | ||||
| 	SANE_Word i, idx; | ||||
| 
 | ||||
|  | @ -762,10 +760,12 @@ static int usbDev_setMap( Plustek_Device *dev, SANE_Word *map, | |||
|  */ | ||||
| static int usbDev_setScanEnv( Plustek_Device *dev, pScanInfo si ) | ||||
| { | ||||
| 	DCapsDef *caps = &dev->usbDev.Caps; | ||||
| 
 | ||||
| 	DBG( _DBG_INFO, "usbDev_setScanEnv()\n" ); | ||||
| 
 | ||||
|     /* clear all the stuff */ | ||||
|     memset( &dev->scanning, 0, sizeof(ScanDef)); | ||||
| 	/* clear all the stuff */ | ||||
| 	memset( &dev->scanning, 0, sizeof(ScanDef)); | ||||
| 
 | ||||
| 	if((si->ImgDef.dwFlag & SCANDEF_Adf) && | ||||
| 	   (si->ImgDef.dwFlag & SCANDEF_ContinuousScan)) { | ||||
|  | @ -781,30 +781,34 @@ static int usbDev_setScanEnv( Plustek_Device *dev, pScanInfo si ) | |||
| 		  (dev->usbDev.Caps.OpticDpi.x == 1200 && si->ImgDef.xyDpi.x <= 300)) { | ||||
| 			dev->scanning.fGrayFromColor = 2; | ||||
| 			si->ImgDef.wDataType = COLOR_TRUE24; | ||||
| 
 | ||||
| 			DBG( _DBG_INFO, "* Gray from color set!\n" ); | ||||
| 		} | ||||
| 
 | ||||
| 		if((dev->usbDev.vendor == 0x04A9) && (dev->usbDev.product == 0x2208)) { | ||||
| 			DBG( _DBG_INFO, "* Gray(GRAY256) from color set (D660U)!\n" ); | ||||
| 		if( caps->workaroundFlag & _WAF_GRAY_FROM_COLOR ) { | ||||
| 			DBG( _DBG_INFO, "* Gray(8-bit) from color set!\n" ); | ||||
| 			dev->scanning.fGrayFromColor = 2; | ||||
| 			si->ImgDef.wDataType = COLOR_TRUE24; | ||||
| 		} | ||||
| 
 | ||||
| 	} else if ( si->ImgDef.wDataType == COLOR_GRAY16 ) { | ||||
| 		if((dev->usbDev.vendor == 0x04A9) && (dev->usbDev.product == 0x2208)) { | ||||
| 			DBG( _DBG_INFO, "* Gray(GRAY16) from color set (D660U)!\n" ); | ||||
| 		if( caps->workaroundFlag & _WAF_GRAY_FROM_COLOR ) { | ||||
| 			DBG( _DBG_INFO, "* Gray(16-bit) from color set!\n" ); | ||||
| 			dev->scanning.fGrayFromColor = 2; | ||||
| 			si->ImgDef.wDataType = COLOR_TRUE48; | ||||
| 		} | ||||
| 	} else if ( si->ImgDef.wDataType == COLOR_BW ) { | ||||
| 		if( caps->workaroundFlag & _WAF_BIN_FROM_COLOR ) { | ||||
| 			DBG( _DBG_INFO, "* Binary from color set!\n" ); | ||||
| 			dev->scanning.fGrayFromColor = 10; | ||||
| 			si->ImgDef.wDataType = COLOR_TRUE24; | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	usb_SaveImageInfo( dev, &si->ImgDef ); | ||||
| 	usb_GetImageInfo ( &si->ImgDef, &dev->scanning.sParam.Size ); | ||||
| 	usb_GetImageInfo ( dev, &si->ImgDef, &dev->scanning.sParam.Size ); | ||||
| 
 | ||||
| 	/* Flags */ | ||||
| 	dev->scanning.dwFlag = si->ImgDef.dwFlag &  | ||||
| 	              (SCANFLAG_bgr | SCANFLAG_BottomUp | SCANFLAG_Invert | | ||||
| 	              (SCANFLAG_bgr | SCANFLAG_BottomUp | | ||||
| 	               SCANFLAG_DWORDBoundary | SCANFLAG_RightAlign | | ||||
| 	               SCANFLAG_StillModule | SCANDEF_Adf | SCANDEF_ContinuousScan); | ||||
| 
 | ||||
|  | @ -823,14 +827,14 @@ static int usbDev_setScanEnv( Plustek_Device *dev, pScanInfo si ) | |||
| 		dev->scanning.dwFlag &= ~SCANFLAG_RightAlign; | ||||
| 
 | ||||
| 	if( dev->scanning.dwFlag & SCANFLAG_DWORDBoundary ) { | ||||
| 		if( dev->scanning.fGrayFromColor ) | ||||
| 		if( dev->scanning.fGrayFromColor && dev->scanning.fGrayFromColor < 10) | ||||
| 			dev->scanning.dwBytesLine = (dev->scanning.sParam.Size.dwBytes / 3 + 3) & 0xfffffffcUL; | ||||
| 		else | ||||
| 			dev->scanning.dwBytesLine = (dev->scanning.sParam.Size.dwBytes + 3UL) & 0xfffffffcUL; | ||||
| 
 | ||||
| 	} else { | ||||
| 
 | ||||
| 		if( dev->scanning.fGrayFromColor ) | ||||
| 		if( dev->scanning.fGrayFromColor && dev->scanning.fGrayFromColor < 10) | ||||
| 			dev->scanning.dwBytesLine = dev->scanning.sParam.Size.dwBytes / 3; | ||||
| 		else | ||||
| 			dev->scanning.dwBytesLine = dev->scanning.sParam.Size.dwBytes; | ||||
|  |  | |||
|  | @ -32,6 +32,7 @@ | |||
|  *        - added gamma to struct HWDefault | ||||
|  * - 0.48 - added DEVCAPSFLAG_LargeTPA | ||||
|  *        - added min_ffstep to ClkMotorDef | ||||
|  *        - added _WAF_BIN_FROM_COLOR and _WAF_GRAY_FROM_COLOR | ||||
|  * . | ||||
|  * <hr> | ||||
|  * This file is part of the SANE package. | ||||
|  | @ -231,7 +232,9 @@ enum _WORKAROUNDS | |||
| 	_WAF_BYPASS_CALIBRATION = 0x00000008, /* no calibration,use linear gamma */ | ||||
| 	_WAF_INV_NEGATIVE_MAP   = 0x00000010, /* the backend does the neg. stuff */ | ||||
| 	_WAF_SKIP_FINE          = 0x00000020, /* skip the fine calbration        */ | ||||
| 	_WAF_SKIP_WHITEFINE     = 0x00000040  /* skip the fine white calbration  */ | ||||
| 	_WAF_SKIP_WHITEFINE     = 0x00000040, /* skip the fine white calbration  */ | ||||
| 	_WAF_BIN_FROM_COLOR     = 0x00000080, /* generate binary & gray images   */ | ||||
| 	_WAF_GRAY_FROM_COLOR    = 0x00000100  /* from color scans                */ | ||||
| }; | ||||
| 
 | ||||
| /** for lamps connected to the misc I/O pins*/ | ||||
|  | @ -308,7 +311,6 @@ enum SCANFLAG | |||
| 
 | ||||
| 	SCANFLAG_bgr            = 0x00004000, | ||||
| 	SCANFLAG_BottomUp       = 0x00008000, | ||||
| 	SCANFLAG_Invert         = 0x00010000, | ||||
| 	SCANFLAG_DWORDBoundary  = 0x00020000, | ||||
| 	SCANFLAG_RightAlign     = 0x00040000, | ||||
| 	SCANFLAG_StillModule    = 0x00080000,  | ||||
|  | @ -340,21 +342,21 @@ typedef struct SrcAttr | |||
| 
 | ||||
| typedef struct DevCaps | ||||
| { | ||||
| 	SrcAttrDef	Normal;			/**< Reflection                              */ | ||||
| 	SrcAttrDef	Positive;		/**< Positive film                           */ | ||||
| 	SrcAttrDef	Negative;		/**< Negative film                           */ | ||||
| 	SrcAttrDef	Adf;			/**< Adf device                              */ | ||||
| 	XY   		OpticDpi;		/**< Maximum DPI                             */ | ||||
| 	u_short		wFlags;			/**< Flag to indicate what kinds of elements */ | ||||
| 	SrcAttrDef Normal;          /**< Reflection                              */ | ||||
| 	SrcAttrDef Positive;        /**< Positive film                           */ | ||||
| 	SrcAttrDef Negative;        /**< Negative film                           */ | ||||
| 	SrcAttrDef Adf;             /**< Adf device                              */ | ||||
| 	XY         OpticDpi;        /**< Maximum DPI                             */ | ||||
| 	u_short    wFlags;          /**< Flag to indicate what kinds of elements */ | ||||
|                                 /*   are available                           */ | ||||
| 	u_char		bSensorOrder;	/**< CCD color sequences, see _SENSORORDER   */ | ||||
| 	u_char		bSensorDistance;/**< CCD Color distance                      */ | ||||
| 	u_char		bButtons;		/**< Number of buttons                       */ | ||||
| 	u_char		bCCD;			/**< CCD ID                                  */ | ||||
| 	u_char		bPCB;			/**< PCB ID                                  */ | ||||
| 	u_long		workaroundFlag;	/**< Flag to allow special work arounds, see */ | ||||
| 	u_char     bSensorOrder;    /**< CCD color sequences, see _SENSORORDER   */ | ||||
| 	u_char     bSensorDistance; /**< CCD Color distance                      */ | ||||
| 	u_char     bButtons;        /**< Number of buttons                       */ | ||||
| 	u_char     bCCD;            /**< CCD ID                                  */ | ||||
| 	u_char     bPCB;            /**< PCB ID                                  */ | ||||
| 	u_long     workaroundFlag;  /**< Flag to allow special work arounds, see */ | ||||
| 	                            /*   _WORKAROUNDS                            */ | ||||
| 	u_long      lamp;           /**< for lamp: loword: normal, hiword: tpa   */ | ||||
| 	u_long     lamp;            /**< for lamp: loword: normal, hiword: tpa   */ | ||||
| 
 | ||||
| } DCapsDef, *pDCapsDef; | ||||
| 
 | ||||
|  |  | |||
|  | @ -661,7 +661,8 @@ static DCapsDef Cap0x04A9_0x2208 = | |||
| 	1, | ||||
| 	kNEC8861,           /* use default settings during calibration */ | ||||
| 	0, | ||||
| 	_WAF_MISC_IO_LAMPS, _MIO5 + _TPA(_MIO6) | ||||
| 	(_WAF_MISC_IO_LAMPS | _WAF_BIN_FROM_COLOR | _WAF_GRAY_FROM_COLOR),  | ||||
| 	_MIO5 + _TPA(_MIO6) | ||||
| }; | ||||
| 
 | ||||
| /* Canon N670U/N676U/LiDE20
 | ||||
|  | @ -2519,7 +2520,7 @@ static ClkMotorDef Motors[] = { | |||
| 		{ 6.0, 6.0, 6.0, 6.0, 6.0, 8.0, 9.0, 9.0, 18.0, 18.0 } | ||||
| 	}, | ||||
| 
 | ||||
| 	{ MODEL_CANONCCD1200, 2, 31, 6, 0x0100, | ||||
| 	{ MODEL_CANONCCD1200, 2, 31, 6, 0x0120, | ||||
| 		/* Motor settings (PWM and PWM_Duty) */ | ||||
| 		/* <=75dpi       <=100dpi      <=150dpi      <=200dpi      <=300dpi  */ | ||||
| 		{{ 2, 31, 1 }, { 2, 31, 1 }, { 2, 31, 1 }, { 2, 31, 1 }, { 2, 31, 1 }, | ||||
|  |  | |||
|  | @ -238,6 +238,7 @@ static SANE_Bool usb_SensorPaper( int handle ) | |||
|  */ | ||||
| static SANE_Bool usb_WaitPos( Plustek_Device *dev, u_long to, SANE_Bool stay ) | ||||
| { | ||||
| 	SANE_Bool      retval; | ||||
| 	u_char         value; | ||||
| 	u_short        ffs, step; | ||||
| 	long           dwTicks; | ||||
|  | @ -251,8 +252,7 @@ static SANE_Bool usb_WaitPos( Plustek_Device *dev, u_long to, SANE_Bool stay ) | |||
| 	step = 1; | ||||
| 	ffs  = a_bRegs[0x48] * 256 + a_bRegs[0x49]; | ||||
| 
 | ||||
| 	DBG( _DBG_INFO2, "# FSS=%u (0x%04x)\n", ffs, ffs ); | ||||
| 
 | ||||
| 	retval = SANE_FALSE; | ||||
| 	for(;;) { | ||||
| 
 | ||||
| 		usleep( 1000 ); | ||||
|  | @ -281,13 +281,16 @@ static SANE_Bool usb_WaitPos( Plustek_Device *dev, u_long to, SANE_Bool stay ) | |||
| 			sanei_lm983x_write(dev->fd, 0x48, &a_bRegs[0x48], 2, SANE_TRUE); | ||||
| 		} else { | ||||
| 		 | ||||
| 			if( !stay ) | ||||
| 				return SANE_TRUE; | ||||
| 			if( !stay ) { | ||||
| 				retval = SANE_TRUE; | ||||
| 				break; | ||||
| 			} | ||||
| 		} | ||||
| 		step++; | ||||
| 
 | ||||
| 	} | ||||
| 	return SANE_FALSE; | ||||
| 	DBG( _DBG_INFO2, "# FSS=%u (0x%04x) - %u steps\n", ffs, ffs, step ); | ||||
| 	return retval; | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  | @ -599,7 +602,7 @@ static SANE_Bool usb_ModuleToHome( Plustek_Device *dev, SANE_Bool fWait ) | |||
| 		 * assumptions: MCLK = 6, Lineratemode (CM=1) | ||||
| 		 */ | ||||
| 		wFastFeedStepSize = (u_short)(dwCrystalFrequency / (mclk_div * 8 * 1 * | ||||
| 									  hw->dMaxMotorSpeed * 4 * hw->wMotorDpi)); | ||||
| 		                              hw->dMaxMotorSpeed * 4 * hw->wMotorDpi)); | ||||
| 		a_bRegs[0x48] = (u_char)(wFastFeedStepSize >> 8); | ||||
| 		a_bRegs[0x49] = (u_char)(wFastFeedStepSize & 0xFF); | ||||
| 		a_bRegs[0x4a] = 0; | ||||
|  | @ -638,7 +641,7 @@ static SANE_Bool usb_ModuleToHome( Plustek_Device *dev, SANE_Bool fWait ) | |||
| 		/* 1 channel grayscale, green channel */ | ||||
| 		if( !usbio_WriteReg(dev->fd, 0x26, 0x8C)) | ||||
| 			return SANE_FALSE; | ||||
| 		 | ||||
| 
 | ||||
| 		_UIO(sanei_lm983x_write(dev->fd, 0x48, &a_bRegs[0x48], 4, SANE_TRUE)); | ||||
| 		_UIO(sanei_lm983x_write(dev->fd, 0x56, &a_bRegs[0x56], 3, SANE_TRUE)); | ||||
| 
 | ||||
|  | @ -652,7 +655,7 @@ static SANE_Bool usb_ModuleToHome( Plustek_Device *dev, SANE_Bool fWait ) | |||
| 
 | ||||
| 		if( !usbio_WriteReg(dev->fd, 0x07, 2)) | ||||
| 			return SANE_FALSE; | ||||
| 		 | ||||
| 
 | ||||
| #if 0 | ||||
| 		if( hw->motorModel == MODEL_Tokyo600) { | ||||
| 
 | ||||
|  |  | |||
										
											
												Plik diff jest za duży
												Load Diff
											
										
									
								
							|  | @ -18,7 +18,7 @@ | |||
|  * - 0.45 - no changes | ||||
|  * - 0.46 - no changes | ||||
|  * - 0.47 - cleanup work | ||||
|  * - 0.48 - no changes | ||||
|  * - 0.48 - added support for binary from color scans | ||||
|  * . | ||||
|  * <hr> | ||||
|  * This file is part of the SANE package. | ||||
|  | @ -126,16 +126,16 @@ static SANE_Bool usb_MapDownload( pPlustek_Device dev, u_char bDataType ) | |||
| 
 | ||||
| 	/* the maps are have been already set */ | ||||
| 	 | ||||
| 	/* do the brightness and contrast adjustment ... */			 | ||||
| 	if( scanning->sParam.bDataType != SCANDATATYPE_BW )	 | ||||
| 	/* do the brightness and contrast adjustment ... */ | ||||
| 	if( scanning->sParam.bDataType != SCANDATATYPE_BW ) | ||||
| 		usb_MapAdjust( dev ); | ||||
| 
 | ||||
| 	if( !usbio_WriteReg( dev->fd, 7, 0)) | ||||
| 		return SANE_FALSE; | ||||
| 
 | ||||
| 	/* we download all the time all three color maps, as we run
 | ||||
|      * into trouble elsewhere on CanoScan models using gray mode | ||||
|      */ | ||||
| 	 * into trouble elsewhere on CanoScan models using gray mode | ||||
| 	 */ | ||||
| #if 0 | ||||
| 	if( bDataType == SCANDATATYPE_Color ) { | ||||
| 		color    = 0; | ||||
|  | @ -155,17 +155,18 @@ static SANE_Bool usb_MapDownload( pPlustek_Device dev, u_char bDataType ) | |||
| 	 | ||||
| 		/* select color */ | ||||
| 		value = (color << 2)+2; | ||||
| 		 | ||||
| 
 | ||||
| 		/* set gamma color selector */ | ||||
| 		usbio_WriteReg( dev->fd, 0x03, value ); | ||||
| 		usbio_WriteReg( dev->fd, 0x04, 0 ); | ||||
| 		usbio_WriteReg( dev->fd, 0x05, 0 ); | ||||
| 		 | ||||
| 
 | ||||
| 		/* write the gamma table entry to merlin */ | ||||
| 		if( scanning->sParam.bDataType == SCANDATATYPE_BW )	{ | ||||
| 		 | ||||
| 		if((scanning->sParam.bDataType == SCANDATATYPE_BW) || | ||||
| 		   (scanning->fGrayFromColor > 7 )) { | ||||
| 
 | ||||
| 			iThreshold = (int)((double)scanning->sParam.siThreshold * | ||||
| 											(_MAP_SIZE/200.0)) + (_MAP_SIZE/2); | ||||
| 			                                (_MAP_SIZE/200.0)) + (_MAP_SIZE/2); | ||||
| 			iThreshold = _MAP_SIZE - iThreshold; | ||||
| 			if(iThreshold < 0) | ||||
| 				iThreshold = 0; | ||||
|  | @ -192,11 +193,6 @@ static SANE_Bool usb_MapDownload( pPlustek_Device dev, u_char bDataType ) | |||
| 			(sc->workaroundFlag &_WAF_INV_NEGATIVE_MAP)) { | ||||
| 			fInverse ^= 1; | ||||
| 		} | ||||
| 		 | ||||
| 		if((scanning->dwFlag & SCANFLAG_Invert) && | ||||
| 									!(scanning->dwFlag & SCANFLAG_Pseudo48)) { | ||||
| 			fInverse ^= 1; | ||||
| 		}	 | ||||
| 
 | ||||
| 		if( fInverse ) { | ||||
| 		 | ||||
|  |  | |||
|  | @ -89,7 +89,7 @@ static u_long     m_dwPauseLimit; | |||
| static SANE_Bool  m_fStart = SANE_FALSE; | ||||
| 
 | ||||
| /* Prototype... */ | ||||
| static SANE_Bool usb_DownloadShadingData( pPlustek_Device, u_char ); | ||||
| static SANE_Bool usb_DownloadShadingData( Plustek_Device*, u_char ); | ||||
| 
 | ||||
| /** returns the min of the two values val1 and val2
 | ||||
|  * @param val1 - first parameter | ||||
|  | @ -126,7 +126,7 @@ static u_long usb_max( u_long val1, u_long val2 ) | |||
|  * @param xdpi - user specified horizontal resolution | ||||
|  * @return - the function returns the "normalized" horizontal resolution. | ||||
|  */ | ||||
| static u_short usb_SetAsicDpiX( pPlustek_Device dev, u_short xdpi ) | ||||
| static u_short usb_SetAsicDpiX( Plustek_Device *dev, u_short xdpi ) | ||||
| { | ||||
| 	u_short   res; | ||||
|     pScanDef  scanning = &dev->scanning; | ||||
|  | @ -204,7 +204,7 @@ static u_short usb_SetAsicDpiX( pPlustek_Device dev, u_short xdpi ) | |||
|  * @param ydpi - user specified vertical resolution | ||||
|  * @return - | ||||
|  */ | ||||
| static u_short usb_SetAsicDpiY( pPlustek_Device dev, u_short ydpi ) | ||||
| static u_short usb_SetAsicDpiY( Plustek_Device *dev, u_short ydpi ) | ||||
| { | ||||
|     pScanDef  scanning = &dev->scanning; | ||||
| 	pDCapsDef sCaps    = &dev->usbDev.Caps; | ||||
|  | @ -256,7 +256,7 @@ static u_short usb_SetAsicDpiY( pPlustek_Device dev, u_short ydpi ) | |||
|  * @param pParam - pointer to the current scan parameters | ||||
|  * @return - Nothing | ||||
|  */ | ||||
| static void usb_SetColorAndBits( pPlustek_Device dev, pScanParam pParam ) | ||||
| static void usb_SetColorAndBits( Plustek_Device *dev, pScanParam pParam ) | ||||
| { | ||||
| 	pHWDef hw = &dev->usbDev.HwSetting; | ||||
| 
 | ||||
|  | @ -313,7 +313,7 @@ static void usb_SetColorAndBits( pPlustek_Device dev, pScanParam pParam ) | |||
|  * @param pParam - pointer to the current scan parameters | ||||
|  * @return - Nothing | ||||
|  */ | ||||
| static void usb_GetScanRect( pPlustek_Device dev, pScanParam pParam ) | ||||
| static void usb_GetScanRect( Plustek_Device *dev, pScanParam pParam ) | ||||
| { | ||||
| 	u_short   wDataPixelStart, wLineEnd; | ||||
| 
 | ||||
|  | @ -481,7 +481,7 @@ static void usb_GetScanRect( pPlustek_Device dev, pScanParam pParam ) | |||
| 
 | ||||
| /** preset scan stepsize and fastfeed stepsize
 | ||||
|  */ | ||||
| static void usb_PresetStepSize( pPlustek_Device dev, pScanParam pParam ) | ||||
| static void usb_PresetStepSize( Plustek_Device *dev, pScanParam pParam ) | ||||
| { | ||||
| 	u_short ssize; | ||||
| 	double  mclkdiv = pParam->dMCLK; | ||||
|  | @ -500,7 +500,7 @@ static void usb_PresetStepSize( pPlustek_Device dev, pScanParam pParam ) | |||
| 
 | ||||
| /** calculate default phase difference DPD
 | ||||
|  */ | ||||
| static void usb_GetDPD( pPlustek_Device dev  ) | ||||
| static void usb_GetDPD( Plustek_Device *dev  ) | ||||
| { | ||||
| 	int    qtcnt;	/* quarter speed count count reg 51 b2..3 */ | ||||
| 	int    hfcnt;	/* half speed count reg 51 b0..1          */ | ||||
|  | @ -550,7 +550,7 @@ static void usb_GetDPD( pPlustek_Device dev  ) | |||
|  * at least we give the master clock divider and adjust the step size | ||||
|  * and integration time (for 14/16 bit modes) | ||||
|  */ | ||||
| static double usb_GetMCLKDivider( pPlustek_Device dev, pScanParam pParam ) | ||||
| static double usb_GetMCLKDivider( Plustek_Device *dev, pScanParam pParam ) | ||||
| { | ||||
| 	double dMaxIntegrationTime; | ||||
| 	double dMaxMCLKDivider; | ||||
|  | @ -644,7 +644,7 @@ static double usb_GetMCLKDivider( pPlustek_Device dev, pScanParam pParam ) | |||
| 
 | ||||
| /** calculate the step size of each scan step
 | ||||
|  */ | ||||
| static void usb_GetStepSize( pPlustek_Device dev, pScanParam pParam ) | ||||
| static void usb_GetStepSize( Plustek_Device *dev, pScanParam pParam ) | ||||
| { | ||||
| 	pHWDef hw = &dev->usbDev.HwSetting; | ||||
| 
 | ||||
|  | @ -672,7 +672,7 @@ static void usb_GetStepSize( pPlustek_Device dev, pScanParam pParam ) | |||
| 
 | ||||
| /**
 | ||||
|  */ | ||||
| static void usb_GetLineLength( pPlustek_Device dev ) | ||||
| static void usb_GetLineLength( Plustek_Device *dev ) | ||||
| { | ||||
| /* [note]
 | ||||
|  *	The ITA in this moment is always 0, it will be changed later when we | ||||
|  | @ -776,7 +776,7 @@ static void usb_GetLineLength( pPlustek_Device dev ) | |||
| /** usb_GetMotorParam
 | ||||
|  * registers 0x56, 0x57 | ||||
|  */ | ||||
| static void usb_GetMotorParam( pPlustek_Device dev, pScanParam pParam ) | ||||
| static void usb_GetMotorParam( Plustek_Device *dev, pScanParam pParam ) | ||||
| { | ||||
| 	int       	 idx, i; | ||||
| 	pClkMotorDef clk; | ||||
|  | @ -926,14 +926,14 @@ static void usb_GetMotorParam( pPlustek_Device dev, pScanParam pParam ) | |||
| 
 | ||||
| /**
 | ||||
|  */ | ||||
| static void usb_GetPauseLimit( pPlustek_Device dev, pScanParam pParam ) | ||||
| static void usb_GetPauseLimit( Plustek_Device *dev, pScanParam pParam ) | ||||
| { | ||||
| 	int    coeffsize, scaler; | ||||
| 	pHWDef hw = &dev->usbDev.HwSetting; | ||||
| 
 | ||||
| 	scaler = 1; | ||||
| 	if( hw->bReg_0x26 & _ONE_CH_COLOR ) { | ||||
|    		if( pParam->bDataType == SCANDATATYPE_Color ) { | ||||
| 		if( pParam->bDataType == SCANDATATYPE_Color ) { | ||||
| 			scaler = 3; | ||||
| 		} | ||||
| 	} | ||||
|  | @ -986,19 +986,19 @@ static void usb_GetPauseLimit( pPlustek_Device dev, pScanParam pParam ) | |||
| 
 | ||||
| /** usb_GetScanLinesAndSize
 | ||||
|  */ | ||||
| static void usb_GetScanLinesAndSize( pPlustek_Device dev, pScanParam pParam ) | ||||
| static void usb_GetScanLinesAndSize( Plustek_Device *dev, pScanParam pParam ) | ||||
| { | ||||
| 	pDCapsDef sCaps = &dev->usbDev.Caps; | ||||
| 	pHWDef    hw    = &dev->usbDev.HwSetting; | ||||
| 
 | ||||
| 	pParam->Size.dwPhyLines = (u_long)ceil((double) pParam->Size.dwLines * | ||||
| 										pParam->PhyDpi.y / pParam->UserDpi.y); | ||||
| 	                                     pParam->PhyDpi.y / pParam->UserDpi.y); | ||||
| 
 | ||||
| 	/* Calculate color offset */ | ||||
| 	if (pParam->bCalibration == PARAM_Scan && pParam->bChannels == 3) { | ||||
| 
 | ||||
| 		dev->scanning.bLineDistance = sCaps->bSensorDistance * | ||||
| 								pParam->PhyDpi.y / sCaps->OpticDpi.x; | ||||
| 		                                  pParam->PhyDpi.y / sCaps->OpticDpi.x; | ||||
| 		pParam->Size.dwPhyLines += (dev->scanning.bLineDistance << 1); | ||||
| 	} | ||||
| 	else | ||||
|  | @ -1020,7 +1020,7 @@ static void usb_GetScanLinesAndSize( pPlustek_Device dev, pScanParam pParam ) | |||
| 
 | ||||
| /** function to preset/reset the merlin registers
 | ||||
|  */ | ||||
| static SANE_Bool usb_SetScanParameters( pPlustek_Device dev, pScanParam pParam ) | ||||
| static SANE_Bool usb_SetScanParameters( Plustek_Device *dev, pScanParam pParam ) | ||||
| { | ||||
| 	static u_char reg8, reg38[6], reg48[2]; | ||||
| 
 | ||||
|  | @ -1180,7 +1180,7 @@ static SANE_Bool usb_SetScanParameters( pPlustek_Device dev, pScanParam pParam ) | |||
| 
 | ||||
| /**
 | ||||
|  */ | ||||
| static SANE_Bool usb_ScanBegin( pPlustek_Device dev, SANE_Bool auto_park ) | ||||
| static SANE_Bool usb_ScanBegin( Plustek_Device *dev, SANE_Bool auto_park ) | ||||
| { | ||||
| 	u_char  value; | ||||
| 	u_short inches; | ||||
|  | @ -1260,7 +1260,7 @@ static SANE_Bool usb_ScanBegin( pPlustek_Device dev, SANE_Bool auto_park ) | |||
| /** usb_ScanEnd
 | ||||
|  * stop all the processing stuff and reposition sensor back home | ||||
|  */ | ||||
| static SANE_Bool usb_ScanEnd( pPlustek_Device dev ) | ||||
| static SANE_Bool usb_ScanEnd( Plustek_Device *dev ) | ||||
| { | ||||
| 	u_char value; | ||||
| 
 | ||||
|  | @ -1287,7 +1287,7 @@ static SANE_Bool usb_ScanEnd( pPlustek_Device dev ) | |||
| 
 | ||||
| /**
 | ||||
|  */ | ||||
| static SANE_Bool usb_IsDataAvailableInDRAM( pPlustek_Device dev ) | ||||
| static SANE_Bool usb_IsDataAvailableInDRAM( Plustek_Device *dev ) | ||||
| { | ||||
| 	/* Compute polling timeout
 | ||||
| 	 *	Height (Inches) / MaxScanSpeed (Inches/Second) = Seconds to move the | ||||
|  | @ -1339,7 +1339,7 @@ static SANE_Bool usb_IsDataAvailableInDRAM( pPlustek_Device dev ) | |||
| 
 | ||||
| /**
 | ||||
|  */ | ||||
| static SANE_Bool usb_ScanReadImage( pPlustek_Device dev, | ||||
| static SANE_Bool usb_ScanReadImage( Plustek_Device *dev, | ||||
|                                     void *pBuf, u_long dwSize ) | ||||
| { | ||||
| 	static u_long dwBytes = 0; | ||||
|  | @ -1427,7 +1427,7 @@ static SANE_Bool usb_ScanReadImage( pPlustek_Device dev, | |||
| 
 | ||||
| /**
 | ||||
|  */ | ||||
| static void usb_GetImageInfo( pImgDef pInfo, pWinInfo pSize ) | ||||
| static void usb_GetImageInfo( Plustek_Device *dev, pImgDef pInfo, pWinInfo pSize ) | ||||
| { | ||||
| 	DBG( _DBG_INFO, "usb_GetImageInfo()\n" ); | ||||
| 
 | ||||
|  | @ -1441,7 +1441,12 @@ static void usb_GetImageInfo( pImgDef pInfo, pWinInfo pSize ) | |||
| 			break; | ||||
| 			 | ||||
| 		case COLOR_TRUE24: | ||||
| 			pSize->dwBytes = pSize->dwPixels * 3UL; | ||||
| 			if( dev->scanning.fGrayFromColor > 7 ){ | ||||
| 				pSize->dwBytes  = (pSize->dwPixels + 7UL) >> 3; | ||||
| 				pSize->dwPixels = pSize->dwBytes * 8; | ||||
| 			} else { | ||||
| 				pSize->dwBytes = pSize->dwPixels * 3UL; | ||||
| 			} | ||||
| 			break; | ||||
| 
 | ||||
| 		case COLOR_GRAY16: | ||||
|  | @ -1461,7 +1466,7 @@ static void usb_GetImageInfo( pImgDef pInfo, pWinInfo pSize ) | |||
| 
 | ||||
| /**
 | ||||
|  */ | ||||
| static void usb_SaveImageInfo( pPlustek_Device dev, pImgDef pInfo ) | ||||
| static void usb_SaveImageInfo( Plustek_Device *dev, pImgDef pInfo ) | ||||
| { | ||||
| 	pHWDef     hw     = &dev->usbDev.HwSetting; | ||||
| 	pScanParam pParam = &dev->scanning.sParam; | ||||
|  |  | |||
		Ładowanie…
	
		Reference in New Issue
	
	 Gerhard Jaeger
						Gerhard Jaeger