kopia lustrzana https://gitlab.com/sane-project/backends
Fixed Kernel 2.6 compilation problems.
rodzic
d3551d4825
commit
5939553028
|
@ -34,6 +34,7 @@
|
|||
* - 0.41 - merged Kevins' patch to make EPP(ECP) work
|
||||
* - 0.42 - changed get_fast_time to _GET_TIME
|
||||
* - changed include names
|
||||
* - 0.43 - added LINUX_26 stuff
|
||||
* .
|
||||
* <hr>
|
||||
* This file is part of the SANE package.
|
||||
|
@ -94,11 +95,11 @@
|
|||
* the following correlations
|
||||
*/
|
||||
#if defined LINUX_24 || defined LINUX_26
|
||||
# define PARPORT_MODE_PCPS2 PARPORT_MODE_TRISTATE
|
||||
# define PARPORT_MODE_PCEPP PARPORT_MODE_EPP
|
||||
# define PARPORT_MODE_PCECPPS2 PARPORT_MODE_TRISTATE
|
||||
# define PARPORT_MODE_PCPS2 PARPORT_MODE_TRISTATE
|
||||
# define PARPORT_MODE_PCEPP PARPORT_MODE_EPP
|
||||
# define PARPORT_MODE_PCECPPS2 PARPORT_MODE_TRISTATE
|
||||
# define PARPORT_MODE_PCECPEPP PARPORT_MODE_EPP
|
||||
# define PARPORT_MODE_PCECR PARPORT_MODE_ECP
|
||||
# define PARPORT_MODE_PCECR PARPORT_MODE_ECP
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -124,6 +125,39 @@ static int portIsClaimed[_MAX_PTDEVS] = { 0, 0, 0, 0 };
|
|||
/*************************** local functions *********************************/
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#ifdef LINUX_26
|
||||
|
||||
static pScanData __ps = NULL;
|
||||
static int __pa = -1;
|
||||
|
||||
/** callback from parport driver
|
||||
*/
|
||||
static void misc_attach(struct parport *port)
|
||||
{
|
||||
DBG( DBG_LOW, "misc_attach\n" );
|
||||
|
||||
__ps->pp = NULL;
|
||||
if( port->base == (unsigned long)__pa ) {
|
||||
DBG( DBG_LOW, "Requested port (0x%02x) found\n", __pa );
|
||||
DBG( DBG_LOW, "Port mode reported: (0x%04x)\n", port->modes );
|
||||
__ps->pp = port;
|
||||
}
|
||||
|
||||
__ps = NULL;
|
||||
__pa = -1;
|
||||
}
|
||||
|
||||
static void misc_detach( struct parport *port )
|
||||
{
|
||||
DBG( DBG_LOW, "misc_detach\n" );
|
||||
}
|
||||
|
||||
static struct parport_driver pt_drv = {
|
||||
.name = "pt_drv",
|
||||
.attach = misc_attach,
|
||||
.detach = misc_detach,
|
||||
};
|
||||
#endif
|
||||
|
||||
/** display the avaialable port-modes
|
||||
*/
|
||||
|
@ -655,11 +689,24 @@ _LOC int MiscRegisterPort( pScanData ps, int portAddr )
|
|||
DBG( DBG_LOW, "Assigning port handle %i\n", portAddr );
|
||||
ps->pardev = portAddr;
|
||||
#else
|
||||
struct parport *pp;
|
||||
struct parport *pp = NULL;
|
||||
|
||||
DBG( DBG_LOW, "Requested port at 0x%02x\n", portAddr );
|
||||
|
||||
pp = parport_enumerate();
|
||||
#ifdef LINUX_26
|
||||
__ps = ps;
|
||||
__pa = portAddr;
|
||||
|
||||
if( parport_register_driver(&pt_drv)) {
|
||||
/* Failed; nothing we can do. */
|
||||
return _E_REGISTER;
|
||||
}
|
||||
if( NULL == pp ) {
|
||||
return _E_PORTSEARCH;
|
||||
}
|
||||
|
||||
#else
|
||||
pp = parport_enumerate();
|
||||
ps->pardev = NULL;
|
||||
|
||||
if( NULL == pp ) {
|
||||
|
@ -676,9 +723,9 @@ _LOC int MiscRegisterPort( pScanData ps, int portAddr )
|
|||
ps->pp = pp;
|
||||
break;
|
||||
}
|
||||
|
||||
pp = pp->next;
|
||||
}
|
||||
#endif
|
||||
|
||||
if( NULL == ps->pp ) {
|
||||
return _E_NO_PORT;
|
||||
|
@ -688,7 +735,7 @@ _LOC int MiscRegisterPort( pScanData ps, int portAddr )
|
|||
* register this device
|
||||
*/
|
||||
ps->pardev = parport_register_device( ps->pp, "Plustek Driver",
|
||||
miscPreemptionCallback, NULL, NULL, 0, (pVoid)ps );
|
||||
miscPreemptionCallback, NULL, NULL, 0, (pVoid)ps );
|
||||
|
||||
if( NULL == ps->pardev ) {
|
||||
return _E_REGISTER;
|
||||
|
@ -698,7 +745,6 @@ _LOC int MiscRegisterPort( pScanData ps, int portAddr )
|
|||
#endif
|
||||
|
||||
portIsClaimed[ps->devno] = 0;
|
||||
|
||||
return _OK;
|
||||
}
|
||||
|
||||
|
@ -711,6 +757,9 @@ _LOC void MiscUnregisterPort( pScanData ps )
|
|||
DBG( DBG_LOW, "Port unregistered\n" );
|
||||
parport_unregister_device( ps->pardev );
|
||||
}
|
||||
#ifdef LINUX_26
|
||||
parport_unregister_driver( &pt_drv );
|
||||
#endif
|
||||
#else
|
||||
sanei_pp_close( ps->pardev );
|
||||
#endif
|
||||
|
|
|
@ -101,6 +101,9 @@
|
|||
# include <linux/module.h>
|
||||
|
||||
# ifdef CONFIG_DEVFS_FS
|
||||
# ifdef LINUX_26
|
||||
# error "DEVFS not supported for this kernel-version"
|
||||
# endif
|
||||
# include <linux/devfs_fs_kernel.h>
|
||||
# endif
|
||||
#endif
|
||||
|
@ -270,11 +273,7 @@ static void ptdrvStartLampTimer( pScanData ps );
|
|||
*/
|
||||
static pScanData get_pt_from_inode(struct inode *ip)
|
||||
{
|
||||
#ifdef LINUX_26
|
||||
int minor = MINOR(kdev_t_to_nr(ip->i_rdev));
|
||||
#else
|
||||
int minor = MINOR(ip->i_rdev);
|
||||
#endif
|
||||
int minor = _MINOR(ip);
|
||||
|
||||
/*
|
||||
* unit out of range
|
||||
|
@ -476,7 +475,7 @@ static void ptdrvLampWarmup( pScanData ps )
|
|||
MiscStartTimer( &timer, _SECOND * ps->warmup );
|
||||
while( !MiscCheckTimer( &timer )) {
|
||||
|
||||
/* on break, we setup the initial timer again... */
|
||||
/* on break, we setup the initial timer again... */
|
||||
if( _FALSE == ps->fScanningStatus ) {
|
||||
MiscStartTimer( &toTimer[ps->devno], (_SECOND * ps->warmup));
|
||||
return;
|
||||
|
@ -1550,7 +1549,11 @@ ReadFinished:
|
|||
/*.............................................................................
|
||||
* gets called upon module initialization
|
||||
*/
|
||||
#ifdef LINUX_26
|
||||
static int __init ptdrv_init( void )
|
||||
#else
|
||||
int init_module( void )
|
||||
#endif
|
||||
{
|
||||
UInt devCount;
|
||||
UInt i;
|
||||
|
@ -1641,7 +1644,11 @@ int init_module( void )
|
|||
/*.............................................................................
|
||||
* cleanup the show
|
||||
*/
|
||||
#ifdef LINUX_26
|
||||
static void __exit ptdrv_exit( void )
|
||||
#else
|
||||
void cleanup_module( void )
|
||||
#endif
|
||||
{
|
||||
UInt i;
|
||||
pScanData ps;
|
||||
|
@ -1680,6 +1687,11 @@ void cleanup_module( void )
|
|||
DBG( DBG_HIGH, "*********************************************\n" );
|
||||
}
|
||||
|
||||
#ifdef LINUX_26
|
||||
module_init(ptdrv_init);
|
||||
module_exit(ptdrv_exit);
|
||||
#endif
|
||||
|
||||
#endif /*MODULE*/
|
||||
|
||||
|
||||
|
|
|
@ -80,7 +80,8 @@
|
|||
# include <sys/io.h>
|
||||
# endif
|
||||
#else
|
||||
|
||||
# include <linux/kernel.h>
|
||||
# include <linux/init.h>
|
||||
# include <linux/version.h>
|
||||
# include "plustek-pp_sysdep.h"
|
||||
# include <linux/delay.h>
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
* 0.41 - no changes
|
||||
* 0.42 - added _GET_TIME
|
||||
* - added LINUX_26 for new kernel
|
||||
* - added _MINOR
|
||||
* .
|
||||
* <hr>
|
||||
* This file is part of the SANE package.
|
||||
|
@ -298,6 +299,13 @@
|
|||
# define _GET_TIME do_gettimeofday
|
||||
#endif
|
||||
|
||||
#ifdef LINUX_26
|
||||
# define _MINOR(p) iminor(p)
|
||||
#else
|
||||
# define _MINOR(p) minor(p->i_rdev)
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* _SYSDEP_H_ */
|
||||
|
||||
/* END PLUSTEK-PP_SYSDEP.H ..................................................*/
|
||||
|
|
|
@ -87,7 +87,7 @@
|
|||
#include "../include/sane/sanei.h"
|
||||
#include "../include/sane/saneopts.h"
|
||||
|
||||
#define BACKEND_VERSION "0.01-7"
|
||||
#define BACKEND_VERSION "0.01-8"
|
||||
#define BACKEND_NAME plustek_pp
|
||||
#include "../include/sane/sanei_backend.h"
|
||||
#include "../include/sane/sanei_config.h"
|
||||
|
@ -124,8 +124,8 @@ MODELSTR;
|
|||
#endif
|
||||
|
||||
/* needed to statisfy the module code ... */
|
||||
#define _PTDRV_V0 0
|
||||
#define _PTDRV_V1 44
|
||||
#define _PTDRV_V0 0
|
||||
#define _PTDRV_V1 44
|
||||
|
||||
/* I know this is in general no good idea, but it works */
|
||||
# include "plustek-pp_io.c"
|
||||
|
@ -2114,12 +2114,13 @@ SANE_Status sane_read( SANE_Handle handle, SANE_Byte *data,
|
|||
if( 0 == nread ) {
|
||||
|
||||
drvclose( s->hw );
|
||||
s->exit_code = sanei_thread_get_status( s->reader_pid );
|
||||
s->exit_code = sanei_thread_get_status( s->reader_pid );
|
||||
|
||||
if( SANE_STATUS_GOOD != s->exit_code ) {
|
||||
close_pipe(s);
|
||||
return s->exit_code;
|
||||
}
|
||||
if( SANE_STATUS_GOOD != s->exit_code ) {
|
||||
close_pipe(s);
|
||||
return s->exit_code;
|
||||
}
|
||||
s->reader_pid = -1;
|
||||
return close_pipe(s);
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue