* doc/plustek/Plustek-PARPORT.changes: update.

* backend/plustek-pp.h backend/plustek-pp_ptdrv.c backend/plustek_pp.c:
  fixed "not homing" problem, the sensor did not return when
  the driver gets the _IOCTL_STOP command
  fixed compilation issue for kernels > 2.6.15
  fixed compiler warning conditions
merge-requests/1/head
Gerhard Jaeger 2006-08-29 08:57:02 +00:00
rodzic 5bbc2fef6c
commit e44b51c218
5 zmienionych plików z 172 dodań i 130 usunięć

Wyświetl plik

@ -1,3 +1,12 @@
2006-08-29 Gerhard Jaeger <gerhard@gjaeger.de>
* doc/plustek/Plustek-PARPORT.changes: update.
* backend/plustek-pp.h backend/plustek-pp_ptdrv.c backend/plustek_pp.c:
fixed "not homing" problem, the sensor did not return when
the driver gets the _IOCTL_STOP command
fixed compilation issue for kernels > 2.6.15
fixed compiler warning conditions
2006-08-28 m. allan noah <anoah AT pfeiffer DOT edu>
* backend/fujitsu.c backend/fujitsu-scsi.h: update to v1.0.41,

Wyświetl plik

@ -12,6 +12,7 @@
* - 0.01 - initial version
* - 0.43 - bumped up version to reflect the former module code version
* - removed Version from ScannerCaps
* - added _E_FAULT
* .
* <hr>
* This file is part of the SANE package.
@ -235,6 +236,12 @@ typedef const struct mode_param
#define _E_SEQUENCE (_FIRST_ERR-30) /* caller sequence does not match */
#define _E_NO_ASIC (_FIRST_ERR-31) /* can't detect ASIC */
#ifdef __KERNEL__
# define _E_FAULT (-EFAULT)
#else
# define _E_FAULT (_E_INTERNAL) /* should never happen in userspace */
#endif
#define _E_LAMP_NOT_IN_POS (_FIRST_ERR-40)
#define _E_LAMP_NOT_STABLE (_FIRST_ERR-41)
#define _E_NODATA (_FIRST_ERR-42)

Wyświetl plik

@ -175,25 +175,36 @@ MODULE_DESCRIPTION("Plustek parallelport-scanner driver");
MODULE_LICENSE("GPL");
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13))
MODULE_PARM(port, "1-" __MODULE_STRING(_MAX_PTDEVS) "i");
MODULE_PARM_DESC(port, "I/O base address of parport");
MODULE_PARM(lampoff, "1-" __MODULE_STRING(_MAX_PTDEVS) "i");
MODULE_PARM_DESC(lampoff, "Lamp-Off timer preset in seconds");
MODULE_PARM(warmup,"1-" __MODULE_STRING(_MAX_PTDEVS) "i");
MODULE_PARM_DESC(warmup, "Minimum warmup time in seconds");
MODULE_PARM(lOffonEnd, "1-" __MODULE_STRING(_MAX_PTDEVS) "i");
MODULE_PARM_DESC(lOffonEnd, "1 - switchoff lamp on unload");
MODULE_PARM(mov, "1-" __MODULE_STRING(_MAX_PTDEVS) "i");
MODULE_PARM_DESC(mov, "Modell-override switch");
MODULE_PARM(slowIO,"1-" __MODULE_STRING(_MAX_PTDEVS) "i");
MODULE_PARM_DESC(slowIO, "0 = Fast I/O, 1 = Delayed I/O");
MODULE_PARM(forceMode,"1-" __MODULE_STRING(_MAX_PTDEVS) "i");
#else
static int array_len = _MAX_PTDEVS;
module_param_array(port, int, &array_len, 0);
module_param_array(lampoff, int, &array_len, 0);
module_param_array(warmup, int, &array_len, 0);
module_param_array(lOffonEnd, int, &array_len, 0);
module_param_array(mov, int, &array_len, 0);
module_param_array(slowIO, int, &array_len, 0);
module_param_array(forceMode, int, &array_len, 0);
#endif
MODULE_PARM_DESC(port, "I/O base address of parport");
MODULE_PARM_DESC(lampoff, "Lamp-Off timer preset in seconds");
MODULE_PARM_DESC(warmup, "Minimum warmup time in seconds");
MODULE_PARM_DESC(lOffonEnd, "1 - switchoff lamp on unload");
MODULE_PARM_DESC(mov, "Modell-override switch");
MODULE_PARM_DESC(slowIO, "0 = Fast I/O, 1 = Delayed I/O");
MODULE_PARM_DESC(forceMode, "0 = use auto detection, "
"1 = use SPP mode, 2 = use EPP mode");
#endif
@ -287,9 +298,7 @@ static int getUserPtr(const pVoid useraddr, pVoid where, UInt size )
{
int err = _OK;
/*
* do a parameter check
*/
/* do parameter checks */
if((NULL == useraddr) || ( 0 == size))
return _E_INVALID;
@ -298,8 +307,7 @@ static int getUserPtr(const pVoid useraddr, pVoid where, UInt size )
return err;
#endif
switch (size)
{
switch (size) {
#ifdef __KERNEL__
case sizeof(u_char):
GET_USER_RET(*(u_char *)where, (u_char *) useraddr, -EFAULT);
@ -314,7 +322,8 @@ static int getUserPtr(const pVoid useraddr, pVoid where, UInt size )
break;
default:
copy_from_user(where, useraddr, size);
if (copy_from_user(where, useraddr, size))
return -EFAULT;
#else
case sizeof(UChar):
*(pUChar)where = *(pUChar)useraddr;
@ -332,7 +341,6 @@ static int getUserPtr(const pVoid useraddr, pVoid where, UInt size )
memcpy( where, useraddr, size );
#endif
}
return err;
}
@ -349,7 +357,8 @@ static int putUserPtr( const pVoid ptr, pVoid useraddr, UInt size )
if ((err = verify_area_20(VERIFY_WRITE, useraddr, size)))
return err;
copy_to_user(useraddr, ptr, size );
if (copy_to_user(useraddr, ptr, size ))
return -EFAULT;
#else
memcpy( useraddr, ptr, size );
#endif
@ -358,14 +367,16 @@ static int putUserPtr( const pVoid ptr, pVoid useraddr, UInt size )
}
#ifndef __KERNEL__
static void copy_from_user( pVoid dest, pVoid src, int len )
static unsigned long copy_from_user( pVoid dest, pVoid src, unsigned long len )
{
memcpy( dest, src, len );
return 0;
}
static void copy_to_user( pVoid dest, pVoid src, int len )
static unsigned long copy_to_user( pVoid dest, pVoid src, unsigned long len )
{
memcpy( dest, src, len );
return 0;
}
#endif
@ -981,7 +992,8 @@ static int ptdrvIoctl( pScanData ps, UInt cmd, pVoid arg )
/* open */
case _PTDRV_OPEN_DEVICE:
DBG( DBG_LOW, "ioctl(_PTDRV_OPEN_DEVICE)\n" );
copy_from_user(&version, arg, sizeof(UShort));
if (copy_from_user(&version, arg, sizeof(UShort)))
return _E_FAULT;
if( _PTDRV_IOCTL_VERSION != version ) {
DBG( DBG_HIGH, "Version mismatch: Backend=0x%04X(0x%04X)",
@ -1032,7 +1044,8 @@ static int ptdrvIoctl( pScanData ps, UInt cmd, pVoid arg )
ImgDef img;
DBG( DBG_LOW, "ioctl(_PTDRV_PUT_IMAGEINFO)\n" );
copy_from_user( &img, (pImgDef)arg, size);
if (copy_from_user( &img, (pImgDef)arg, size))
return _E_FAULT;
tmpcx = (short)img.crArea.cx;
tmpcy = (short)img.crArea.cy;
@ -1071,7 +1084,8 @@ static int ptdrvIoctl( pScanData ps, UInt cmd, pVoid arg )
DBG( DBG_LOW, "ioctl(_PTDRV_ADJUST)\n" );
copy_from_user(&adj, (pPPAdjDef)arg, sizeof(PPAdjDef));
if (copy_from_user(&adj, (pPPAdjDef)arg, sizeof(PPAdjDef)))
return _E_FAULT;
DBG( DBG_LOW, "Adjusting device %lu\n", ps->devno );
DBG( DBG_LOW, "warmup: %i\n", adj.warmup );
@ -1106,7 +1120,8 @@ static int ptdrvIoctl( pScanData ps, UInt cmd, pVoid arg )
DBG( DBG_LOW, "ioctl(_PTDRV_SETMAP)\n" );
copy_from_user( &map, (pMapDef)arg, sizeof(MapDef));
if (copy_from_user( &map, (pMapDef)arg, sizeof(MapDef)))
return _E_FAULT;
DBG( DBG_LOW, "maplen=%u, mapid=%u, addr=0x%08lx\n",
map.len, map.map_id, (u_long)map.map );
@ -1124,8 +1139,10 @@ static int ptdrvIoctl( pScanData ps, UInt cmd, pVoid arg )
if( _MAP_MASTER == map.map_id ) {
for( i = 0; i < 3; i++ ) {
copy_from_user((pVoid)&ps->a_bMapTable[x_len * i],
map.map, x_len );
if (copy_from_user((pVoid)&ps->a_bMapTable[x_len * i],
map.map, x_len )) {
return _E_FAULT;
}
}
} else {
@ -1135,8 +1152,10 @@ static int ptdrvIoctl( pScanData ps, UInt cmd, pVoid arg )
if( map.map_id == _MAP_BLUE )
idx = 2;
copy_from_user((pVoid)&ps->a_bMapTable[x_len * idx],
map.map, x_len );
if (copy_from_user((pVoid)&ps->a_bMapTable[x_len * idx],
map.map, x_len )) {
return _E_FAULT;
}
}
/* here we adjust the maps according to
@ -1153,7 +1172,8 @@ static int ptdrvIoctl( pScanData ps, UInt cmd, pVoid arg )
DBG( DBG_LOW, "ioctl(_PTDRV_SET_ENV)\n" );
copy_from_user(&sInf, (pScanInfo)arg, sizeof(ScanInfo));
if (copy_from_user(&sInf, (pScanInfo)arg, sizeof(ScanInfo)))
return _E_FAULT;
/*
* to make the OpticPro 4800P work, we need to invert the
@ -1176,7 +1196,8 @@ static int ptdrvIoctl( pScanData ps, UInt cmd, pVoid arg )
ps->DataInf.dwVxdFlag |= _VF_ENVIRONMENT_READY;
copy_to_user((pScanInfo)arg, &sInf, sizeof(ScanInfo));
if (copy_to_user((pScanInfo)arg, &sInf, sizeof(ScanInfo)))
return _E_FAULT;
}
}
break;
@ -1201,7 +1222,8 @@ static int ptdrvIoctl( pScanData ps, UInt cmd, pVoid arg )
ps->DataInf.dwVxdFlag |= _VF_FIRSTSCANLINE;
ps->DataInf.dwScanFlag&=~(_SCANNER_SCANNING|_SCANNER_PAPEROUT);
copy_to_user((pStartScan)arg, pstart, sizeof(StartScan));
if (copy_to_user((pStartScan)arg, pstart, sizeof(StartScan)))
return _E_FAULT;
}
}
break;
@ -1211,7 +1233,8 @@ static int ptdrvIoctl( pScanData ps, UInt cmd, pVoid arg )
DBG( DBG_LOW, "ioctl(_PTDRV_STOP_SCAN)\n" );
copy_from_user(&cancel, arg, sizeof(int));
if (copy_from_user(&cancel, arg, sizeof(short)))
return _E_FAULT;
/* we may use this to abort scanning! */
ps->fScanningStatus = _FALSE;
@ -1468,11 +1491,15 @@ static int ptdrvRead( pScanData ps, pUChar buffer, int count )
*/
if( NULL != scaleBuf ) {
ScaleX( ps, ps->Scan.bp.pMonoBuf, scaleBuf );
copy_to_user( buffer, scaleBuf,
ps->DataInf.dwAppPhyBytesPerLine);
if (copy_to_user( buffer, scaleBuf,
ps->DataInf.dwAppPhyBytesPerLine)) {
return _E_FAULT;
}
} else {
copy_to_user( buffer, ps->Scan.bp.pMonoBuf,
ps->DataInf.dwAppPhyBytesPerLine);
if (copy_to_user( buffer, ps->Scan.bp.pMonoBuf,
ps->DataInf.dwAppPhyBytesPerLine)) {
return _E_FAULT;
}
}
buffer += ps->Scan.lBufferAdjust;
@ -1605,7 +1632,6 @@ int init_module( void )
"scanner/pt_drv%d", devCount);
# endif
#endif
ProcFsRegisterDevice( PtDrvDevices[i] );
devCount++;
} else {
@ -1616,9 +1642,7 @@ int init_module( void )
}
}
/*
* if something went wrong, shutdown all...
*/
/* * if something went wrong, shutdown all... */
if( devCount == 0 ) {
#if (defined(CONFIG_DEVFS_FS) && !defined(DEVFS_26_STYLE))
@ -1716,16 +1740,12 @@ static int pt_drv_open(struct inode *inode, struct file *file)
return(-ENXIO);
}
/*
* device not found ?
*/
/* device not found ? */
if (!(ps->flags & _PTDRV_INITALIZED)) {
return(-ENXIO);
}
/*
* device is busy ?
*/
/* device is busy ? */
if (ps->flags & _PTDRV_OPEN) {
return(-EBUSY);
}
@ -1778,7 +1798,7 @@ static int pt_drv_read(struct inode *inode, struct file *file,
int result;
pScanData ps;
if ( !(ps = get_pt_from_inode(inode)) )
if ( !(ps = get_pt_from_inode(inode)))
return(-ENXIO);
#else
static ssize_t pt_drv_read( struct file *file,

Wyświetl plik

@ -83,7 +83,7 @@
#include "../include/sane/sanei.h"
#include "../include/sane/saneopts.h"
#define BACKEND_VERSION "0.43-11"
#define BACKEND_VERSION "0.43-12"
#define BACKEND_NAME plustek_pp
#include "../include/sane/sanei_backend.h"
#include "../include/sane/sanei_config.h"

Wyświetl plik

@ -80,7 +80,7 @@ Version 0.37 11/09/2000
2.0 Added file procfs.c for proc-filesystem support
3.0 Code cleanup
4.0 Added A3I support
5.0 Added Michael´s backend patches
5.0 Added Michaels backend patches
Version 0.38 11/30/2000
1.0 Started integration of ASIC98003 specific stuff
@ -163,3 +163,9 @@ Version 0.43-10 02/16/2006
Version 0.43-11 08/09/2006
1.0 Changed sane.type to "flatbed scanner" only
Version 0.43-12 08/29/2006
1.0 Fixed "not homing" problem, the sensor did not
return when the driver gets the _IOCTL_STOP command
2.0 Fixed compilation issue for kernels > 2.6.15
3.0 Fixed compiler warning conditions