kopia lustrzana https://gitlab.com/sane-project/backends
major update, sanei_pp integration, compilation fixes.
rodzic
01d0486095
commit
fe555addac
|
@ -363,6 +363,7 @@ libsane-plustek.la: ../sanei/sanei_lm983x.lo
|
||||||
libsane-plustek.la: ../sanei/sanei_thread.lo
|
libsane-plustek.la: ../sanei/sanei_thread.lo
|
||||||
libsane-plustek_pp.la: ../sanei/sanei_constrain_value.lo
|
libsane-plustek_pp.la: ../sanei/sanei_constrain_value.lo
|
||||||
libsane-plustek_pp.la: ../sanei/sanei_thread.lo
|
libsane-plustek_pp.la: ../sanei/sanei_thread.lo
|
||||||
|
libsane-plustek_pp.la: ../sanei/sanei_pp.lo
|
||||||
libsane-pnm.la: ../sanei/sanei_constrain_value.lo
|
libsane-pnm.la: ../sanei/sanei_constrain_value.lo
|
||||||
libsane-qcam.la: ../sanei/sanei_constrain_value.lo
|
libsane-qcam.la: ../sanei/sanei_constrain_value.lo
|
||||||
libsane-ricoh.la: ../sanei/sanei_config2.lo
|
libsane-ricoh.la: ../sanei/sanei_config2.lo
|
||||||
|
|
|
@ -67,6 +67,8 @@
|
||||||
# ifndef __KERNEL__
|
# ifndef __KERNEL__
|
||||||
# include <assert.h>
|
# include <assert.h>
|
||||||
# define _ASSERT(x) assert(x)
|
# define _ASSERT(x) assert(x)
|
||||||
|
# else
|
||||||
|
# define _ASSERT(x)
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifndef DBG
|
# ifndef DBG
|
||||||
|
|
|
@ -101,13 +101,15 @@ static int detectScannerConnection( pScanData ps )
|
||||||
UChar data, control, status;
|
UChar data, control, status;
|
||||||
int retval = _E_NO_CONN;
|
int retval = _E_NO_CONN;
|
||||||
|
|
||||||
|
#ifdef __KERNEL__
|
||||||
DBG( DBG_LOW, "Dataport = 0x%04x\n", ps->IO.pbSppDataPort );
|
DBG( DBG_LOW, "Dataport = 0x%04x\n", ps->IO.pbSppDataPort );
|
||||||
DBG( DBG_LOW, "Ctrlport = 0x%04x\n", ps->IO.pbControlPort );
|
DBG( DBG_LOW, "Ctrlport = 0x%04x\n", ps->IO.pbControlPort );
|
||||||
|
#endif
|
||||||
|
|
||||||
detectResetPort( ps );
|
detectResetPort( ps );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* as we´re called during InitPorts, we can be sure
|
* as we're called during InitPorts, we can be sure
|
||||||
* to operate in EPP-mode (hopefuly ;-)
|
* to operate in EPP-mode (hopefuly ;-)
|
||||||
*/
|
*/
|
||||||
control = _INB_CTRL( ps );
|
control = _INB_CTRL( ps );
|
||||||
|
@ -151,7 +153,7 @@ static int detectScannerConnection( pScanData ps )
|
||||||
ps->CloseScanPath( ps );
|
ps->CloseScanPath( ps );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* so we´re done ´til now...
|
* so we're done 'til now...
|
||||||
*/
|
*/
|
||||||
DBG( DBG_HIGH, "Compare data=0x%x and status=0x%x, port=0x%x\n",
|
DBG( DBG_HIGH, "Compare data=0x%x and status=0x%x, port=0x%x\n",
|
||||||
data, status, ps->IO.portBase );
|
data, status, ps->IO.portBase );
|
||||||
|
@ -181,7 +183,11 @@ static int detectScannerConnection( pScanData ps )
|
||||||
* work on the result
|
* work on the result
|
||||||
*/
|
*/
|
||||||
if ( _OK == retval ) {
|
if ( _OK == retval ) {
|
||||||
|
#ifdef __KERNEL__
|
||||||
ps->sCaps.wIOBase = ps->IO.pbSppDataPort;
|
ps->sCaps.wIOBase = ps->IO.pbSppDataPort;
|
||||||
|
#else
|
||||||
|
ps->sCaps.wIOBase = ps->pardev;
|
||||||
|
#endif
|
||||||
ps->PutToIdleMode( ps );
|
ps->PutToIdleMode( ps );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -199,7 +205,6 @@ static int detectScannerConnection( pScanData ps )
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*.............................................................................
|
/*.............................................................................
|
||||||
* we need some memory...
|
* we need some memory...
|
||||||
*/
|
*/
|
||||||
|
@ -390,7 +395,6 @@ static int detectAsic98001( pScanData ps )
|
||||||
#else
|
#else
|
||||||
DBG( DBG_HIGH,
|
DBG( DBG_HIGH,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
"!!!! WARNING, have a look at function detectAsic98001() !!!!\n" );
|
"!!!! WARNING, have a look at function detectAsic98001() !!!!\n" );
|
||||||
ps->sCaps.AsicID = _ASIC_IS_98001;
|
ps->sCaps.AsicID = _ASIC_IS_98001;
|
||||||
ps->sCaps.wIOBase = ps->IO.pbSppDataPort;
|
ps->sCaps.wIOBase = ps->IO.pbSppDataPort;
|
||||||
|
|
|
@ -591,6 +591,7 @@ typedef struct
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
||||||
|
#ifdef __KERNEL__
|
||||||
pFnOut fnOut;
|
pFnOut fnOut;
|
||||||
pFnIn fnIn;
|
pFnIn fnIn;
|
||||||
|
|
||||||
|
@ -600,6 +601,7 @@ typedef struct {
|
||||||
UShort pbStatusPort;
|
UShort pbStatusPort;
|
||||||
UShort pbControlPort;
|
UShort pbControlPort;
|
||||||
UShort pbAddrOffsetPort;
|
UShort pbAddrOffsetPort;
|
||||||
|
#endif
|
||||||
|
|
||||||
UShort portBase;
|
UShort portBase;
|
||||||
UShort portMode;
|
UShort portMode;
|
||||||
|
|
|
@ -85,8 +85,7 @@ static pFnReadData ioReadFunc[3] = {
|
||||||
|
|
||||||
/*************************** local functions *********************************/
|
/*************************** local functions *********************************/
|
||||||
|
|
||||||
/*.............................................................................
|
/** we provide some functions to read data from SPP port according to
|
||||||
* we provide some functions to read data from SPP port according to
|
|
||||||
* the speed we have detected (ReadWriteTest!!)
|
* the speed we have detected (ReadWriteTest!!)
|
||||||
*/
|
*/
|
||||||
static Byte ioDataFromSPPFast( pScanData ps )
|
static Byte ioDataFromSPPFast( pScanData ps )
|
||||||
|
@ -579,7 +578,8 @@ static int ioP98ReadWriteTest( pScanData ps )
|
||||||
*/
|
*/
|
||||||
static void ioSPPWrite( pScanData ps, pUChar pBuffer, ULong size )
|
static void ioSPPWrite( pScanData ps, pUChar pBuffer, ULong size )
|
||||||
{
|
{
|
||||||
DBG( DBG_IO , "IODELAY = %u\n", ps->IO.delay );
|
DBG( DBG_IO , "Moving %lu bytes to scanner, IODELAY = %u...\n",
|
||||||
|
size, ps->IO.delay );
|
||||||
switch( ps->IO.delay ) {
|
switch( ps->IO.delay ) {
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -613,6 +613,7 @@ static void ioSPPWrite( pScanData ps, pUChar pBuffer, ULong size )
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
DBG( DBG_IO , "... done.\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*.............................................................................
|
/*.............................................................................
|
||||||
|
@ -954,8 +955,9 @@ _LOC void IOReadScannerImageData( pScanData ps, pUChar pBuf, ULong size )
|
||||||
ps->OpenScanPath( ps );
|
ps->OpenScanPath( ps );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*.............................................................................
|
#ifdef __KERNEL__
|
||||||
* the wrapper functions to support delayed and non-delayed I/O
|
|
||||||
|
/** the wrapper functions to support delayed and non-delayed I/O
|
||||||
*/
|
*/
|
||||||
_LOC void IOOut( Byte data, UShort port )
|
_LOC void IOOut( Byte data, UShort port )
|
||||||
{
|
{
|
||||||
|
@ -992,5 +994,6 @@ _LOC Byte IOInDelayed( UShort port )
|
||||||
return inb_p( port );
|
return inb_p( port );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* END PLUSTEK-PP_IO.C ......................................................*/
|
/* END PLUSTEK-PP_IO.C ......................................................*/
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
* - for selecting the port-mode this driver uses
|
* - for selecting the port-mode this driver uses
|
||||||
* - 0.33 - added code to use faster portmodes
|
* - 0.33 - added code to use faster portmodes
|
||||||
* - 0.34 - added sample code for changing from ECP to PS/2 bidi mode
|
* - 0.34 - added sample code for changing from ECP to PS/2 bidi mode
|
||||||
* - 0.35 - added Kevins´ changes (new function miscSetFastMode())
|
* - 0.35 - added Kevins' changes (new function miscSetFastMode())
|
||||||
* - moved function initPageSettings() to module models.c
|
* - moved function initPageSettings() to module models.c
|
||||||
* - 0.36 - added random generator
|
* - 0.36 - added random generator
|
||||||
* - added additional debug messages
|
* - added additional debug messages
|
||||||
|
@ -80,11 +80,11 @@
|
||||||
/*************************** some definitions ********************************/
|
/*************************** some definitions ********************************/
|
||||||
|
|
||||||
#ifndef __KERNEL__
|
#ifndef __KERNEL__
|
||||||
#define PPA_PROBE_SPP 0x0001
|
# define PPA_PROBE_SPP 0x0001
|
||||||
#define PPA_PROBE_PS2 0x0002
|
# define PPA_PROBE_PS2 0x0002
|
||||||
#define PPA_PROBE_ECR 0x0010
|
# define PPA_PROBE_ECR 0x0010
|
||||||
#define PPA_PROBE_EPP17 0x0100
|
# define PPA_PROBE_EPP17 0x0100
|
||||||
#define PPA_PROBE_EPP19 0x0200
|
# define PPA_PROBE_EPP19 0x0200
|
||||||
#else
|
#else
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -123,6 +123,8 @@ static int portIsClaimed[_MAX_PTDEVS] = { 0, 0, 0, 0 };
|
||||||
|
|
||||||
/*************************** local functions *********************************/
|
/*************************** local functions *********************************/
|
||||||
|
|
||||||
|
#ifdef __KERNEL__
|
||||||
|
|
||||||
/** display the avaialable port-modes
|
/** display the avaialable port-modes
|
||||||
*/
|
*/
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
@ -130,7 +132,6 @@ static void miscShowPortModes( int modes )
|
||||||
{
|
{
|
||||||
DBG( DBG_LOW, "parport-modi:" );
|
DBG( DBG_LOW, "parport-modi:" );
|
||||||
|
|
||||||
#ifdef __KERNEL__
|
|
||||||
if( modes & PARPORT_MODE_PCSPP )
|
if( modes & PARPORT_MODE_PCSPP )
|
||||||
DBG( DBG_LOW, " SPP" );
|
DBG( DBG_LOW, " SPP" );
|
||||||
|
|
||||||
|
@ -148,22 +149,6 @@ static void miscShowPortModes( int modes )
|
||||||
|
|
||||||
if( modes & PARPORT_MODE_PCECPPS2 )
|
if( modes & PARPORT_MODE_PCECPPS2 )
|
||||||
DBG( DBG_LOW, " PS/2(ECP)" );
|
DBG( DBG_LOW, " PS/2(ECP)" );
|
||||||
#else
|
|
||||||
if( modes & PPA_PROBE_SPP )
|
|
||||||
DBG( DBG_LOW, " SPP" );
|
|
||||||
|
|
||||||
if( modes & PPA_PROBE_PS2 )
|
|
||||||
DBG( DBG_LOW, " PS/2" );
|
|
||||||
|
|
||||||
if( modes & PPA_PROBE_EPP17 )
|
|
||||||
DBG( DBG_LOW, " EPP17" );
|
|
||||||
|
|
||||||
if( modes & PPA_PROBE_EPP19 )
|
|
||||||
DBG( DBG_LOW, " EPP19" );
|
|
||||||
|
|
||||||
if( modes & PPA_PROBE_ECR )
|
|
||||||
DBG( DBG_LOW, " ECP" );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
DBG( DBG_LOW, "\n" );
|
DBG( DBG_LOW, "\n" );
|
||||||
}
|
}
|
||||||
|
@ -174,199 +159,15 @@ static void miscShowPortModes( int modes )
|
||||||
static int initPortProbe( pScanData ps )
|
static int initPortProbe( pScanData ps )
|
||||||
{
|
{
|
||||||
int retv = 0;
|
int retv = 0;
|
||||||
#ifndef __KERNEL__
|
|
||||||
UShort port;
|
|
||||||
UChar a, b, c;
|
|
||||||
UInt i, j;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/* clear the controls */
|
||||||
* clear the controls
|
|
||||||
*/
|
|
||||||
ps->IO.lastPortMode = 0xFFFF;
|
ps->IO.lastPortMode = 0xFFFF;
|
||||||
|
|
||||||
#ifdef __KERNEL__
|
|
||||||
if( NULL != ps->pardev )
|
if( NULL != ps->pardev )
|
||||||
retv = ps->pardev->port->modes;
|
retv = ps->pardev->port->modes;
|
||||||
#else
|
|
||||||
port = ps->IO.portBase;
|
|
||||||
|
|
||||||
DBG(DBG_SCAN, "Probing port 0x%04x\n", port);
|
|
||||||
|
|
||||||
/* ##### ###### ######
|
|
||||||
* # # # # # #
|
|
||||||
* # # # # #
|
|
||||||
* ##### ###### ######
|
|
||||||
* # # #
|
|
||||||
* # # # #
|
|
||||||
* ##### # #
|
|
||||||
*/
|
|
||||||
|
|
||||||
outb(0x0c, port + 0x402);
|
|
||||||
outb(0x0c, port + 0x002);
|
|
||||||
outb(0x55, port);
|
|
||||||
a = inb(port);
|
|
||||||
if (a != 0x55)
|
|
||||||
return retv;
|
|
||||||
|
|
||||||
DBG(DBG_SCAN, " SPP port present\n");
|
|
||||||
|
|
||||||
retv += PPA_PROBE_SPP;
|
|
||||||
|
|
||||||
/* ####### ##### ######
|
|
||||||
* # # # # #
|
|
||||||
* # # # #
|
|
||||||
* ##### # ######
|
|
||||||
* # # #
|
|
||||||
* # # # #
|
|
||||||
* ####### ##### #
|
|
||||||
*/
|
|
||||||
|
|
||||||
for (i = 1024; i > 0; i--) { /* clear at most 1k of data from FIFO */
|
|
||||||
a = inb(port + 0x402);
|
|
||||||
if ((a & 0x03) == 0x03)
|
|
||||||
goto no_ecp;
|
|
||||||
if (a & 0x01)
|
|
||||||
break;
|
|
||||||
inb(port + 0x400); /* Remove byte from FIFO */
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i <= 0)
|
|
||||||
goto no_ecp;
|
|
||||||
|
|
||||||
b = a ^ 3;
|
|
||||||
outb(b, port + 0x402);
|
|
||||||
c = inb(port + 0x402);
|
|
||||||
|
|
||||||
if (a == c) {
|
|
||||||
outb(0xc0, port + 0x402); /* FIFO test */
|
|
||||||
j = 0;
|
|
||||||
while (!(inb(port + 0x402) & 0x01) && (j < 1024)) {
|
|
||||||
inb(port + 0x400);
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
if (j >= 1024)
|
|
||||||
goto no_ecp;
|
|
||||||
i = 0;
|
|
||||||
j = 0;
|
|
||||||
while (!(inb(port + 0x402) & 0x02) && (j < 1024)) {
|
|
||||||
outb(0x00, port + 0x400);
|
|
||||||
i++;
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
if (j >= 1024)
|
|
||||||
goto no_ecp;
|
|
||||||
j = 0;
|
|
||||||
while (!(inb(port + 0x402) & 0x01) && (j < 1024)) {
|
|
||||||
inb(port + 0x400);
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
if (j >= 1024)
|
|
||||||
goto no_ecp;
|
|
||||||
|
|
||||||
DBG(DBG_SCAN, " ECP with a %i byte FIFO present\n", i);
|
|
||||||
|
|
||||||
retv += PPA_PROBE_ECR;
|
|
||||||
}
|
|
||||||
/* ###### ##### #####
|
|
||||||
* # # # # # #
|
|
||||||
* # # # #
|
|
||||||
* ###### ##### #####
|
|
||||||
* # # #
|
|
||||||
* # # # #
|
|
||||||
* # ##### #######
|
|
||||||
*/
|
|
||||||
|
|
||||||
no_ecp:
|
|
||||||
if (retv & PPA_PROBE_ECR)
|
|
||||||
outb(0x20, port + 0x402);
|
|
||||||
|
|
||||||
outb(0x55, port);
|
|
||||||
outb(0x0c, port + 2);
|
|
||||||
a = inb(port);
|
|
||||||
outb(0x55, port);
|
|
||||||
outb(0x2c, port + 2);
|
|
||||||
b = inb(port);
|
|
||||||
if (a != b) {
|
|
||||||
DBG(DBG_SCAN, " PS/2 bidirectional port present\n");
|
|
||||||
retv += PPA_PROBE_PS2;
|
|
||||||
}
|
|
||||||
/* ####### ###### ######
|
|
||||||
* # # # # #
|
|
||||||
* # # # # #
|
|
||||||
* ##### ###### ######
|
|
||||||
* # # #
|
|
||||||
* # # #
|
|
||||||
* ####### # #
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (port & 0x007) {
|
|
||||||
DBG(DBG_SCAN, " EPP not supported at this address\n");
|
|
||||||
return retv;
|
|
||||||
}
|
|
||||||
if (retv & PPA_PROBE_ECR) {
|
|
||||||
for (i = 0x00; i < 0x80; i += 0x20) {
|
|
||||||
outb(i, port + 0x402);
|
|
||||||
|
|
||||||
a = inb(port + 1);
|
|
||||||
outb(a, port + 1);
|
|
||||||
outb(a & 0xfe, port + 1);
|
|
||||||
a = inb(port + 1);
|
|
||||||
if (!(a & 0x01)) {
|
|
||||||
DBG(DBG_SCAN, " Failed Intel bug check. (Phony EPP in ECP)\n");
|
|
||||||
return retv;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
DBG(DBG_SCAN, " Passed Intel bug check.\n");
|
|
||||||
outb(0x80, port + 0x402);
|
|
||||||
}
|
|
||||||
a = inb(port + 1);
|
|
||||||
outb(a, port + 1);
|
|
||||||
outb(a & 0xfe, port + 1);
|
|
||||||
a = inb(port + 1);
|
|
||||||
|
|
||||||
if (a & 0x01) {
|
|
||||||
outb(0x0c, port + 0x402);
|
|
||||||
outb(0x0c, port + 0x002);
|
|
||||||
return retv;
|
|
||||||
}
|
|
||||||
|
|
||||||
outb(0x04, port + 2);
|
|
||||||
inb(port + 4);
|
|
||||||
a = inb(port + 1);
|
|
||||||
outb(a, port + 1);
|
|
||||||
outb(a & 0xfe, port + 1);
|
|
||||||
|
|
||||||
if (a & 0x01) {
|
|
||||||
DBG(DBG_SCAN, " EPP 1.9 with hardware direction protocol\n");
|
|
||||||
retv += PPA_PROBE_EPP19;
|
|
||||||
} else {
|
|
||||||
/* The EPP timeout bit was not set, this could either be:
|
|
||||||
* EPP 1.7
|
|
||||||
* EPP 1.9 with software direction
|
|
||||||
*/
|
|
||||||
outb(0x24, port + 2);
|
|
||||||
inb(port + 4);
|
|
||||||
a = inb(port + 1);
|
|
||||||
outb(a, port + 1);
|
|
||||||
outb(a & 0xfe, port + 1);
|
|
||||||
if (a & 0x01) {
|
|
||||||
DBG(DBG_SCAN, " EPP 1.9 with software direction protocol\n");
|
|
||||||
retv += PPA_PROBE_EPP19;
|
|
||||||
} else {
|
|
||||||
DBG(DBG_SCAN, " EPP 1.7\n");
|
|
||||||
retv += PPA_PROBE_EPP17;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
outb(0x0c, port + 0x402);
|
|
||||||
outb(0x0c, port + 0x002);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return retv;
|
return retv;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __KERNEL__
|
|
||||||
/** will be called by the parport module when we already have access, but
|
/** will be called by the parport module when we already have access, but
|
||||||
* another module wants access to the port...
|
* another module wants access to the port...
|
||||||
*/
|
*/
|
||||||
|
@ -524,35 +325,25 @@ static int miscSetFastMode( pScanData ps )
|
||||||
|
|
||||||
return _OK;
|
return _OK;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/** check the state of the par-port and switch to EPP-mode if possible
|
/** check the state of the par-port and switch to EPP-mode if possible
|
||||||
*/
|
*/
|
||||||
static int miscSetPortMode( pScanData ps )
|
static int miscSetPortMode( pScanData ps )
|
||||||
{
|
{
|
||||||
#ifndef __KERNEL__
|
/* try to detect the port settings, SPP seems to work in any case ! */
|
||||||
if (iopl(3)) {
|
port_feature = initPortProbe( ps );
|
||||||
DBG( DBG_HIGH, "Could not unlock IO ports. Are you superuser?\n" );
|
|
||||||
return _E_LOCK;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* try to detect the port settings, SPP seems to work in any case !
|
|
||||||
*/
|
|
||||||
port_feature = initPortProbe( ps );
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
miscShowPortModes( port_feature );
|
miscShowPortModes( port_feature );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch( ps->IO.forceMode ) {
|
switch( ps->IO.forceMode ) {
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
DBG( DBG_LOW, "Use of SPP-mode enforced\n" );
|
DBG( DBG_LOW, "Use of SPP-mode enforced\n" );
|
||||||
ps->IO.portMode = _PORT_SPP;
|
ps->IO.portMode = _PORT_SPP;
|
||||||
return _OK;
|
return _OK;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
DBG( DBG_LOW, "Use of EPP-mode enforced\n" );
|
DBG( DBG_LOW, "Use of EPP-mode enforced\n" );
|
||||||
|
@ -564,7 +355,6 @@ static int miscSetPortMode( pScanData ps )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __KERNEL__
|
|
||||||
if( !(port_feature & PARPORT_MODE_PCEPP)) {
|
if( !(port_feature & PARPORT_MODE_PCEPP)) {
|
||||||
|
|
||||||
if( !(port_feature & PARPORT_MODE_PCSPP )) {
|
if( !(port_feature & PARPORT_MODE_PCSPP )) {
|
||||||
|
@ -575,32 +365,15 @@ static int miscSetPortMode( pScanData ps )
|
||||||
DBG(DBG_LOW, "Using SPP-mode\n" );
|
DBG(DBG_LOW, "Using SPP-mode\n" );
|
||||||
ps->IO.portMode = _PORT_SPP;
|
ps->IO.portMode = _PORT_SPP;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if (!(port_feature & (PPA_PROBE_EPP17 | PPA_PROBE_EPP19))){
|
|
||||||
|
|
||||||
if( !(port_feature & PPA_PROBE_SPP )) {
|
|
||||||
DBG(DBG_HIGH,"\nThis Port supports not the SPP- or EPP-Mode\n");
|
|
||||||
DBG(DBG_HIGH,"Please activate SPP-Mode, EPP-Mode or\n"
|
|
||||||
"EPP + ECP-Mode!\n");
|
|
||||||
return _E_NOSUPP;
|
|
||||||
} else {
|
|
||||||
DBG(DBG_LOW, "Using SPP-mode\n" );
|
|
||||||
ps->IO.portMode = _PORT_SPP;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
DBG(DBG_LOW, "Using EPP-mode\n" );
|
DBG(DBG_LOW, "Using EPP-mode\n" );
|
||||||
ps->IO.portMode = _PORT_EPP;
|
ps->IO.portMode = _PORT_EPP;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __KERNEL__
|
|
||||||
|
|
||||||
/* else try to set to a faster mode than SPP */
|
/* else try to set to a faster mode than SPP */
|
||||||
return miscSetFastMode( ps );
|
return miscSetFastMode( ps );
|
||||||
#else
|
|
||||||
return _OK;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/** miscNextLongRand() -- generate 2**31-2 random numbers
|
/** miscNextLongRand() -- generate 2**31-2 random numbers
|
||||||
**
|
**
|
||||||
|
@ -658,7 +431,6 @@ _LOC pScanData MiscAllocAndInitStruct( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
DBG( DBG_HIGH, "ScanData = 0x%08lx\n", (ULong)ps );
|
DBG( DBG_HIGH, "ScanData = 0x%08lx\n", (ULong)ps );
|
||||||
|
|
||||||
return ps;
|
return ps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -686,7 +458,6 @@ _LOC int MiscReinitStruct( pScanData ps )
|
||||||
miscSeedLongRand((Long)ps);
|
miscSeedLongRand((Long)ps);
|
||||||
|
|
||||||
DBG( DBG_HIGH, "Init settings done\n" );
|
DBG( DBG_HIGH, "Init settings done\n" );
|
||||||
|
|
||||||
return _OK;
|
return _OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -695,6 +466,7 @@ _LOC int MiscReinitStruct( pScanData ps )
|
||||||
*/
|
*/
|
||||||
_LOC int MiscInitPorts( pScanData ps, int port )
|
_LOC int MiscInitPorts( pScanData ps, int port )
|
||||||
{
|
{
|
||||||
|
#ifdef __KERNEL__
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
if( NULL == ps )
|
if( NULL == ps )
|
||||||
|
@ -720,6 +492,17 @@ _LOC int MiscInitPorts( pScanData ps, int port )
|
||||||
ps->IO.pbStatusPort = (UShort)port+1;
|
ps->IO.pbStatusPort = (UShort)port+1;
|
||||||
ps->IO.pbControlPort = (UShort)port+2;
|
ps->IO.pbControlPort = (UShort)port+2;
|
||||||
ps->IO.pbEppDataPort = (UShort)port+4;
|
ps->IO.pbEppDataPort = (UShort)port+4;
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
if( NULL == ps )
|
||||||
|
return _E_NULLPTR;
|
||||||
|
|
||||||
|
DBG(DBG_LOW, "Using EPP-mode\n" );
|
||||||
|
ps->IO.portMode = _PORT_EPP;
|
||||||
|
|
||||||
|
_VAR_NOT_USED( port );
|
||||||
|
#endif
|
||||||
|
|
||||||
return _OK;
|
return _OK;
|
||||||
}
|
}
|
||||||
|
@ -728,8 +511,10 @@ _LOC int MiscInitPorts( pScanData ps, int port )
|
||||||
*/
|
*/
|
||||||
_LOC void MiscRestorePort( pScanData ps )
|
_LOC void MiscRestorePort( pScanData ps )
|
||||||
{
|
{
|
||||||
|
#ifdef __KERNEL__
|
||||||
if( 0 == ps->IO.pbSppDataPort )
|
if( 0 == ps->IO.pbSppDataPort )
|
||||||
return;
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
DBG(DBG_LOW,"MiscRestorePort()\n");
|
DBG(DBG_LOW,"MiscRestorePort()\n");
|
||||||
|
|
||||||
|
@ -750,7 +535,7 @@ _LOC void MiscRestorePort( pScanData ps )
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (port_feature & PPA_PROBE_ECR ){
|
if (port_feature & PPA_PROBE_ECR ){
|
||||||
outb( ps->IO.lastPortMode, ps->IO.pbSppDataPort + 0x402);
|
_OUTB_ECTL(ps,ps->IO.lastPortMode);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -787,8 +572,9 @@ _LOC _INL int MiscCheckTimer( pTimerDef timer )
|
||||||
} else {
|
} else {
|
||||||
#ifdef __KERNEL__
|
#ifdef __KERNEL__
|
||||||
schedule();
|
schedule();
|
||||||
#else
|
/*#else
|
||||||
sched_yield();
|
sched_yield();
|
||||||
|
*/
|
||||||
#endif
|
#endif
|
||||||
return _OK;
|
return _OK;
|
||||||
}
|
}
|
||||||
|
@ -820,27 +606,8 @@ _LOC Bool MiscAllPointersSet( pScanData ps )
|
||||||
_LOC int MiscRegisterPort( pScanData ps, int portAddr )
|
_LOC int MiscRegisterPort( pScanData ps, int portAddr )
|
||||||
{
|
{
|
||||||
#ifndef __KERNEL__
|
#ifndef __KERNEL__
|
||||||
int i;
|
DBG( DBG_LOW, "Assigning port handle %i\n", portAddr );
|
||||||
Bool found;
|
ps->pardev = portAddr;
|
||||||
ULong pref[] = { 0x378, 0x278, 0x3bc, 0xFFFFFFFF };
|
|
||||||
|
|
||||||
DBG( DBG_LOW, "Requested port at 0x%02x\n", portAddr );
|
|
||||||
_VAR_NOT_USED( ps );
|
|
||||||
|
|
||||||
/*
|
|
||||||
* check the port address !!!!
|
|
||||||
*/
|
|
||||||
found = _FALSE;
|
|
||||||
for( i = 0; 0xFFFFFFFF != pref[i]; i++ ) {
|
|
||||||
|
|
||||||
if(((ULong)portAddr != 0xFFFFFFFF) && (pref[i] == (ULong)portAddr)) {
|
|
||||||
found = _TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !found )
|
|
||||||
return _E_INVALID;
|
|
||||||
#else
|
#else
|
||||||
struct parport *pp;
|
struct parport *pp;
|
||||||
|
|
||||||
|
@ -858,7 +625,7 @@ _LOC int MiscRegisterPort( pScanData ps, int portAddr )
|
||||||
*/
|
*/
|
||||||
for( ps->pp = NULL; NULL != pp; ) {
|
for( ps->pp = NULL; NULL != pp; ) {
|
||||||
|
|
||||||
if( pp->base == portAddr ) {
|
if( pp->base == (unsigned long)portAddr ) {
|
||||||
DBG( DBG_LOW, "Requested port (0x%02x) found\n", portAddr );
|
DBG( DBG_LOW, "Requested port (0x%02x) found\n", portAddr );
|
||||||
DBG( DBG_LOW, "Port mode reported: (0x%04x)\n", pp->modes );
|
DBG( DBG_LOW, "Port mode reported: (0x%04x)\n", pp->modes );
|
||||||
ps->pp = pp;
|
ps->pp = pp;
|
||||||
|
@ -900,12 +667,11 @@ _LOC void MiscUnregisterPort( pScanData ps )
|
||||||
parport_unregister_device( ps->pardev );
|
parport_unregister_device( ps->pardev );
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
_VAR_NOT_USED( ps );
|
sanei_pp_close( ps->pardev );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*.............................................................................
|
/** try to claim the port (KERNEL-Mode only)
|
||||||
* try to claim the port (KERNEL-Mode only)
|
|
||||||
*/
|
*/
|
||||||
_LOC int MiscClaimPort( pScanData ps )
|
_LOC int MiscClaimPort( pScanData ps )
|
||||||
{
|
{
|
||||||
|
@ -916,26 +682,29 @@ _LOC int MiscClaimPort( pScanData ps )
|
||||||
if( 0 != parport_claim( ps->pardev ))
|
if( 0 != parport_claim( ps->pardev ))
|
||||||
return _E_BUSY;
|
return _E_BUSY;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
sanei_pp_claim( ps->pardev );
|
||||||
#endif
|
#endif
|
||||||
portIsClaimed[ps->devno]++;
|
portIsClaimed[ps->devno]++;
|
||||||
|
|
||||||
return _OK;
|
return _OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*.............................................................................
|
/** release previously claimed port (KERNEL-Mode only)
|
||||||
* release previously claimed port (KERNEL-Mode only)
|
|
||||||
*/
|
*/
|
||||||
_LOC void MiscReleasePort( pScanData ps )
|
_LOC void MiscReleasePort( pScanData ps )
|
||||||
{
|
{
|
||||||
if( portIsClaimed[ps->devno] > 0 ) {
|
if( portIsClaimed[ps->devno] > 0 ) {
|
||||||
portIsClaimed[ps->devno]--;
|
portIsClaimed[ps->devno]--;
|
||||||
|
|
||||||
#ifdef __KERNEL__
|
|
||||||
if( 0 == portIsClaimed[ps->devno] ) {
|
if( 0 == portIsClaimed[ps->devno] ) {
|
||||||
DBG( DBG_HIGH, "Releasing parport\n" );
|
DBG( DBG_HIGH, "Releasing parport\n" );
|
||||||
|
#ifdef __KERNEL__
|
||||||
parport_release( ps->pardev );
|
parport_release( ps->pardev );
|
||||||
}
|
#else
|
||||||
|
sanei_pp_release( ps->pardev );
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1526,7 +1526,7 @@ static void motorP96FillHalfStepTable( pScanData ps )
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#if DEBUG
|
#ifdef DEBUG
|
||||||
if( 0 == wP96BaseDpi )
|
if( 0 == wP96BaseDpi )
|
||||||
DBG( DBG_HIGH, "!!!! WARNING - motorP96FillHalfStepTable(), "
|
DBG( DBG_HIGH, "!!!! WARNING - motorP96FillHalfStepTable(), "
|
||||||
"wP96BaseDpi == 0 !!!!\n" );
|
"wP96BaseDpi == 0 !!!!\n" );
|
||||||
|
|
|
@ -843,7 +843,6 @@ static void p9636PutToIdleMode( pScanData ps )
|
||||||
|
|
||||||
DBG( DBG_IO, "CCD-Stop\n" );
|
DBG( DBG_IO, "CCD-Stop\n" );
|
||||||
|
|
||||||
|
|
||||||
for( i = 0; i < 12; i++ ) {
|
for( i = 0; i < 12; i++ ) {
|
||||||
|
|
||||||
DBG(DBG_IO, "*[0x%02x] = 0x%02x\n",ccdStop[i].bReg, ccdStop[i].bParam);
|
DBG(DBG_IO, "*[0x%02x] = 0x%02x\n",ccdStop[i].bReg, ccdStop[i].bParam);
|
||||||
|
@ -1058,7 +1057,7 @@ _LOC int P9636InitAsic( pScanData ps )
|
||||||
return _E_INTERNAL;
|
return _E_INTERNAL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DBG( DBG_LOW, "0x%02x\n", ps->sCaps.AsicID );
|
DBG( DBG_LOW, "0x%02x\n", ps->sCaps.AsicID );
|
||||||
|
|
||||||
if( _FALSE == ps->OpenScanPath( ps )) {
|
if( _FALSE == ps->OpenScanPath( ps )) {
|
||||||
DBG( DBG_LOW, "P9636InitAsic() failed.\n" );
|
DBG( DBG_LOW, "P9636InitAsic() failed.\n" );
|
||||||
|
|
|
@ -226,10 +226,12 @@ _LOC void IORegisterDirectToScanner( pScanData, Byte bReg );
|
||||||
_LOC void IOSoftwareReset ( pScanData ps );
|
_LOC void IOSoftwareReset ( pScanData ps );
|
||||||
_LOC void IOReadScannerImageData ( pScanData ps, pUChar pBuf, ULong size );
|
_LOC void IOReadScannerImageData ( pScanData ps, pUChar pBuf, ULong size );
|
||||||
|
|
||||||
|
#ifdef __KERNEL__
|
||||||
_LOC void IOOut ( Byte data, UShort port );
|
_LOC void IOOut ( Byte data, UShort port );
|
||||||
_LOC void IOOutDelayed( Byte data, UShort port );
|
_LOC void IOOutDelayed( Byte data, UShort port );
|
||||||
_LOC Byte IOIn ( UShort port );
|
_LOC Byte IOIn ( UShort port );
|
||||||
_LOC Byte IOInDelayed ( UShort port );
|
_LOC Byte IOInDelayed ( UShort port );
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* implementation in plustek-pp_tpa.c
|
* implementation in plustek-pp_tpa.c
|
||||||
|
|
|
@ -113,35 +113,49 @@
|
||||||
|
|
||||||
/****************************** static vars **********************************/
|
/****************************** static vars **********************************/
|
||||||
|
|
||||||
static pScanData PtDrvDevices[_MAX_PTDEVS] = { [0 ... (_MAX_PTDEVS-1)] = NULL};
|
|
||||||
|
|
||||||
/* default port is at 0x378 */
|
/* default port is at 0x378 */
|
||||||
static int port[_MAX_PTDEVS] = { 0x378, 0, 0, 0 };
|
static int port[_MAX_PTDEVS] = { 0x378, 0, 0, 0 };
|
||||||
|
|
||||||
|
#ifdef __KERNEL__
|
||||||
|
static pScanData PtDrvDevices[_MAX_PTDEVS] = { [0 ... (_MAX_PTDEVS-1)] = NULL};
|
||||||
|
|
||||||
/* default is 180 secs for lamp switch off */
|
/* default is 180 secs for lamp switch off */
|
||||||
static int lampoff[_MAX_PTDEVS] = { [0 ... (_MAX_PTDEVS-1)] = 180 };
|
static int lampoff[_MAX_PTDEVS] = { [0 ... (_MAX_PTDEVS-1)] = 180 };
|
||||||
|
|
||||||
/* warmup period for lamp (30 secs) */
|
/* warmup period for lamp (30 secs) */
|
||||||
static int warmup[_MAX_PTDEVS] = { [0 ... (_MAX_PTDEVS-1)] = 30 };
|
static int warmup[_MAX_PTDEVS] = { [0 ... (_MAX_PTDEVS-1)] = 30 };
|
||||||
|
|
||||||
/* switch lamp off on unload (default = no)*/
|
/* switch lamp off on unload (default = no)*/
|
||||||
static int lOffonEnd[_MAX_PTDEVS] = { [0 ... (_MAX_PTDEVS-1)] = 0 };
|
static int lOffonEnd[_MAX_PTDEVS] = { [0 ... (_MAX_PTDEVS-1)] = 0 };
|
||||||
|
|
||||||
/* model override (0-->none) */
|
/* model override (0-->none) */
|
||||||
static UShort mov[_MAX_PTDEVS] = { [0 ... (_MAX_PTDEVS-1)] = 0 };
|
static UShort mov[_MAX_PTDEVS] = { [0 ... (_MAX_PTDEVS-1)] = 0 };
|
||||||
|
|
||||||
/* forceMode (0--> auto, 1: SPP, 2:EPP, others: auto) */
|
/* forceMode (0--> auto, 1: SPP, 2:EPP, others: auto) */
|
||||||
static UShort forceMode[_MAX_PTDEVS] = { [0 ... (_MAX_PTDEVS-1)] = 0 };
|
static UShort forceMode[_MAX_PTDEVS] = { [0 ... (_MAX_PTDEVS-1)] = 0 };
|
||||||
|
|
||||||
/* to use delayed I/O for each device */
|
/* to use delayed I/O for each device */
|
||||||
static Bool slowIO[_MAX_PTDEVS] = { [0 ... (_MAX_PTDEVS-1)] = _FALSE };
|
static Bool slowIO[_MAX_PTDEVS] = { [0 ... (_MAX_PTDEVS-1)] = _FALSE };
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
static pScanData PtDrvDevices[_MAX_PTDEVS]= { NULL, NULL, NULL, NULL };
|
||||||
|
static int lampoff[_MAX_PTDEVS] = { 180, 180, 180, 180 };
|
||||||
|
static int warmup[_MAX_PTDEVS] = { 30, 30, 30, 30 };
|
||||||
|
static int lOffonEnd[_MAX_PTDEVS] = { 0, 0, 0, 0 };
|
||||||
|
static UShort mov[_MAX_PTDEVS] = { 0, 0, 0, 0 };
|
||||||
|
static UShort forceMode[_MAX_PTDEVS] = { 0, 0, 0, 0 };
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/* timers for warmup checks */
|
/* timers for warmup checks */
|
||||||
static TimerDef toTimer[_MAX_PTDEVS];
|
static TimerDef toTimer[_MAX_PTDEVS];
|
||||||
|
|
||||||
#ifndef __KERNEL__
|
#ifndef __KERNEL__
|
||||||
static Bool PtDrvInitialized = _FALSE;
|
static Bool PtDrvInitialized = _FALSE;
|
||||||
|
#ifdef HAVE_SETITIMER
|
||||||
static struct itimerval saveSettings;
|
static struct itimerval saveSettings;
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
static Bool deviceScanning = _FALSE;
|
static Bool deviceScanning = _FALSE;
|
||||||
|
|
||||||
|
@ -154,7 +168,7 @@ extern volatile ULong jiffies;
|
||||||
* the parameter interface
|
* the parameter interface
|
||||||
*/
|
*/
|
||||||
#if ((LINUX_VERSION_CODE > 0x020111) && defined(MODULE))
|
#if ((LINUX_VERSION_CODE > 0x020111) && defined(MODULE))
|
||||||
MODULE_AUTHOR("Gerhard Jaeger");
|
MODULE_AUTHOR("Gerhard Jaeger <gerhard@gjaeger.de>");
|
||||||
MODULE_DESCRIPTION("Plustek parallelport-scanner driver");
|
MODULE_DESCRIPTION("Plustek parallelport-scanner driver");
|
||||||
|
|
||||||
/* addresses this 'new' license feature... */
|
/* addresses this 'new' license feature... */
|
||||||
|
@ -181,7 +195,8 @@ MODULE_PARM(slowIO,"1-" __MODULE_STRING(_MAX_PTDEVS) "i");
|
||||||
MODULE_PARM_DESC(slowIO, "0 = Fast I/O, 1 = Delayed I/O");
|
MODULE_PARM_DESC(slowIO, "0 = Fast I/O, 1 = Delayed I/O");
|
||||||
|
|
||||||
MODULE_PARM(forceMode,"1-" __MODULE_STRING(_MAX_PTDEVS) "i");
|
MODULE_PARM(forceMode,"1-" __MODULE_STRING(_MAX_PTDEVS) "i");
|
||||||
MODULE_PARM_DESC(forceMode, "0 = use auto detection, 1 = use SPP mode, 2 = use EPP mode");
|
MODULE_PARM_DESC(forceMode, "0 = use auto detection, "
|
||||||
|
"1 = use SPP mode, 2 = use EPP mode");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_DEVFS_FS
|
#ifdef CONFIG_DEVFS_FS
|
||||||
|
@ -251,8 +266,7 @@ static void ptdrvStartLampTimer( pScanData ps );
|
||||||
/****************************** local functions ******************************/
|
/****************************** local functions ******************************/
|
||||||
|
|
||||||
#ifdef __KERNEL__
|
#ifdef __KERNEL__
|
||||||
/*.............................................................................
|
/** depending on the device, return the data structure
|
||||||
* depending on the device, return the data structure
|
|
||||||
*/
|
*/
|
||||||
static pScanData get_pt_from_inode(struct inode *ip)
|
static pScanData get_pt_from_inode(struct inode *ip)
|
||||||
{
|
{
|
||||||
|
@ -272,8 +286,7 @@ static pScanData get_pt_from_inode(struct inode *ip)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*.............................................................................
|
/** copy user-space data into kernel memory
|
||||||
* copy user-space data into kernel memory
|
|
||||||
*/
|
*/
|
||||||
static int getUserPtr(const pVoid useraddr, pVoid where, UInt size )
|
static int getUserPtr(const pVoid useraddr, pVoid where, UInt size )
|
||||||
{
|
{
|
||||||
|
@ -328,8 +341,7 @@ static int getUserPtr(const pVoid useraddr, pVoid where, UInt size )
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*.............................................................................
|
/** copy kernel data into user mode address space
|
||||||
* copy kernel data into user mode address space
|
|
||||||
*/
|
*/
|
||||||
static int putUserPtr( const pVoid ptr, pVoid useraddr, UInt size )
|
static int putUserPtr( const pVoid ptr, pVoid useraddr, UInt size )
|
||||||
{
|
{
|
||||||
|
@ -362,8 +374,7 @@ static void copy_to_user( pVoid dest, pVoid src, int len )
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*.............................................................................
|
/**
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
static int putUserVal(const ULong value, pVoid useraddr, UInt size)
|
static int putUserVal(const ULong value, pVoid useraddr, UInt size)
|
||||||
{
|
{
|
||||||
|
@ -409,8 +420,7 @@ static int putUserVal(const ULong value, pVoid useraddr, UInt size)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*.............................................................................
|
/** switch lamp 0 on
|
||||||
* switch lamp 0 on
|
|
||||||
*/
|
*/
|
||||||
static void ptDrvSwitchLampOn( pScanData ps )
|
static void ptDrvSwitchLampOn( pScanData ps )
|
||||||
{
|
{
|
||||||
|
@ -431,8 +441,7 @@ static void ptDrvSwitchLampOn( pScanData ps )
|
||||||
IOCmdRegisterToScanner(ps, ps->RegScanControl, ps->AsicReg.RD_ScanControl);
|
IOCmdRegisterToScanner(ps, ps->RegScanControl, ps->AsicReg.RD_ScanControl);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*.............................................................................
|
/** check the lamp warmup
|
||||||
* check the lamp warmup
|
|
||||||
*/
|
*/
|
||||||
static void ptdrvLampWarmup( pScanData ps )
|
static void ptdrvLampWarmup( pScanData ps )
|
||||||
{
|
{
|
||||||
|
@ -488,8 +497,7 @@ static void ptdrvLampWarmup( pScanData ps )
|
||||||
MiscStartTimer( &toTimer[ps->devno], _SECOND );
|
MiscStartTimer( &toTimer[ps->devno], _SECOND );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*.............................................................................
|
/**
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
#ifdef __KERNEL__
|
#ifdef __KERNEL__
|
||||||
static void ptdrvLampTimerIrq( ULong ptr )
|
static void ptdrvLampTimerIrq( ULong ptr )
|
||||||
|
@ -540,15 +548,16 @@ static void ptdrvLampTimerIrq( int sig_num )
|
||||||
MiscReleasePort(ps);
|
MiscReleasePort(ps);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*.............................................................................
|
/**
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
static void ptdrvStartLampTimer( pScanData ps )
|
static void ptdrvStartLampTimer( pScanData ps )
|
||||||
{
|
{
|
||||||
#ifndef __KERNEL__
|
#ifndef __KERNEL__
|
||||||
sigset_t block, pause_mask;
|
sigset_t block, pause_mask;
|
||||||
struct sigaction s;
|
struct sigaction s;
|
||||||
|
#ifdef HAVE_SETITIMER
|
||||||
struct itimerval interval;
|
struct itimerval interval;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* block SIGALRM */
|
/* block SIGALRM */
|
||||||
sigemptyset( &block );
|
sigemptyset( &block );
|
||||||
|
@ -567,6 +576,7 @@ static void ptdrvStartLampTimer( pScanData ps )
|
||||||
|
|
||||||
sigprocmask( SIG_UNBLOCK, &block, &pause_mask );
|
sigprocmask( SIG_UNBLOCK, &block, &pause_mask );
|
||||||
|
|
||||||
|
#ifdef HAVE_SETITIMER
|
||||||
/*
|
/*
|
||||||
* define a one-shot timer
|
* define a one-shot timer
|
||||||
*/
|
*/
|
||||||
|
@ -577,6 +587,9 @@ static void ptdrvStartLampTimer( pScanData ps )
|
||||||
|
|
||||||
if( 0 != ps->lampoff )
|
if( 0 != ps->lampoff )
|
||||||
setitimer( ITIMER_REAL, &interval, &saveSettings );
|
setitimer( ITIMER_REAL, &interval, &saveSettings );
|
||||||
|
#else
|
||||||
|
alarm( ps->lampoff );
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
init_timer( &tl[ps->devno] );
|
init_timer( &tl[ps->devno] );
|
||||||
|
|
||||||
|
@ -592,8 +605,7 @@ static void ptdrvStartLampTimer( pScanData ps )
|
||||||
DBG( DBG_HIGH, "Lamp-Timer started!\n" );
|
DBG( DBG_HIGH, "Lamp-Timer started!\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*.............................................................................
|
/**
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
static void ptdrvStopLampTimer( pScanData ps )
|
static void ptdrvStopLampTimer( pScanData ps )
|
||||||
{
|
{
|
||||||
|
@ -604,8 +616,13 @@ static void ptdrvStopLampTimer( pScanData ps )
|
||||||
sigemptyset( &block );
|
sigemptyset( &block );
|
||||||
sigaddset ( &block, SIGALRM );
|
sigaddset ( &block, SIGALRM );
|
||||||
sigprocmask( SIG_BLOCK, &block, &pause_mask );
|
sigprocmask( SIG_BLOCK, &block, &pause_mask );
|
||||||
|
#ifdef HAVE_SETITIMER
|
||||||
if( 0 != ps->lampoff )
|
if( 0 != ps->lampoff )
|
||||||
setitimer( ITIMER_REAL, &saveSettings, NULL );
|
setitimer( ITIMER_REAL, &saveSettings, NULL );
|
||||||
|
#else
|
||||||
|
_VAR_NOT_USED( ps );
|
||||||
|
alarm(0);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
if( 0 != ps->lampoff )
|
if( 0 != ps->lampoff )
|
||||||
del_timer( &tl[ps->devno] );
|
del_timer( &tl[ps->devno] );
|
||||||
|
@ -614,8 +631,7 @@ static void ptdrvStopLampTimer( pScanData ps )
|
||||||
DBG( DBG_HIGH, "Lamp-Timer stopped!\n" );
|
DBG( DBG_HIGH, "Lamp-Timer stopped!\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*.............................................................................
|
/** claim and initialize the requested port
|
||||||
* claim and initialize the requested port
|
|
||||||
*/
|
*/
|
||||||
static int ptdrvOpen( pScanData ps, int portBase )
|
static int ptdrvOpen( pScanData ps, int portBase )
|
||||||
{
|
{
|
||||||
|
@ -636,8 +652,7 @@ static int ptdrvOpen( pScanData ps, int portBase )
|
||||||
return MiscInitPorts( ps, portBase );
|
return MiscInitPorts( ps, portBase );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*.............................................................................
|
/** free used memory (if necessary)
|
||||||
* free used memory (if necessary)
|
|
||||||
* restore the parallel port settings and release the port
|
* restore the parallel port settings and release the port
|
||||||
*/
|
*/
|
||||||
static int ptdrvClose( pScanData ps )
|
static int ptdrvClose( pScanData ps )
|
||||||
|
@ -669,8 +684,7 @@ static int ptdrvClose( pScanData ps )
|
||||||
return _OK;
|
return _OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*.............................................................................
|
/** will be called during OPEN_DEVICE ioctl call
|
||||||
* will be called during OPEN_DEVICE ioctl call
|
|
||||||
*/
|
*/
|
||||||
static int ptdrvOpenDevice( pScanData ps )
|
static int ptdrvOpenDevice( pScanData ps )
|
||||||
{
|
{
|
||||||
|
@ -681,10 +695,10 @@ static int ptdrvOpenDevice( pScanData ps )
|
||||||
ULong devno;
|
ULong devno;
|
||||||
|
|
||||||
#ifdef __KERNEL__
|
#ifdef __KERNEL__
|
||||||
UShort flags;
|
UShort flags;
|
||||||
struct pardevice *pd;
|
struct pardevice *pd;
|
||||||
struct parport *pp;
|
struct parport *pp;
|
||||||
ProcDirDef procDir;
|
ProcDirDef procDir;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -692,8 +706,8 @@ static int ptdrvOpenDevice( pScanData ps )
|
||||||
*/
|
*/
|
||||||
#ifdef __KERNEL__
|
#ifdef __KERNEL__
|
||||||
flags = ps->flags;
|
flags = ps->flags;
|
||||||
pd = ps->pardev;
|
pd = ps->pardev;
|
||||||
pp = ps->pp;
|
pp = ps->pp;
|
||||||
procDir = ps->procDir;
|
procDir = ps->procDir;
|
||||||
#endif
|
#endif
|
||||||
iobase = ps->sCaps.wIOBase;
|
iobase = ps->sCaps.wIOBase;
|
||||||
|
@ -721,6 +735,7 @@ static int ptdrvOpenDevice( pScanData ps )
|
||||||
ps->IO.lastPortMode = lastMode;
|
ps->IO.lastPortMode = lastMode;
|
||||||
ps->devno = devno;
|
ps->devno = devno;
|
||||||
|
|
||||||
|
#ifdef __KERNEL__
|
||||||
if( _TRUE == slowIO[devno] ) {
|
if( _TRUE == slowIO[devno] ) {
|
||||||
DBG( DBG_LOW, "Using slow I/O\n" );
|
DBG( DBG_LOW, "Using slow I/O\n" );
|
||||||
ps->IO.slowIO = _TRUE;
|
ps->IO.slowIO = _TRUE;
|
||||||
|
@ -732,6 +747,7 @@ static int ptdrvOpenDevice( pScanData ps )
|
||||||
ps->IO.fnOut = IOOut;
|
ps->IO.fnOut = IOOut;
|
||||||
ps->IO.fnIn = IOIn;
|
ps->IO.fnIn = IOIn;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
ps->ModelOverride = mov[devno];
|
ps->ModelOverride = mov[devno];
|
||||||
ps->warmup = warmup[devno];
|
ps->warmup = warmup[devno];
|
||||||
ps->lampoff = lampoff[devno];
|
ps->lampoff = lampoff[devno];
|
||||||
|
@ -757,8 +773,8 @@ static int ptdrvOpenDevice( pScanData ps )
|
||||||
*/
|
*/
|
||||||
static int ptdrvInit( int devno )
|
static int ptdrvInit( int devno )
|
||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
pScanData ps;
|
pScanData ps;
|
||||||
|
|
||||||
DBG( DBG_HIGH, "ptdrvInit(%u)\n", devno );
|
DBG( DBG_HIGH, "ptdrvInit(%u)\n", devno );
|
||||||
|
|
||||||
|
@ -773,6 +789,7 @@ static int ptdrvInit( int devno )
|
||||||
return _E_ALLOC;
|
return _E_ALLOC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __KERNEL__
|
||||||
if( _TRUE == slowIO[devno] ) {
|
if( _TRUE == slowIO[devno] ) {
|
||||||
DBG( DBG_LOW, "Using slow I/O\n" );
|
DBG( DBG_LOW, "Using slow I/O\n" );
|
||||||
ps->IO.slowIO = _TRUE;
|
ps->IO.slowIO = _TRUE;
|
||||||
|
@ -784,7 +801,7 @@ static int ptdrvInit( int devno )
|
||||||
ps->IO.fnOut = IOOut;
|
ps->IO.fnOut = IOOut;
|
||||||
ps->IO.fnIn = IOIn;
|
ps->IO.fnIn = IOIn;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
ps->ModelOverride = mov[devno];
|
ps->ModelOverride = mov[devno];
|
||||||
ps->warmup = warmup[devno];
|
ps->warmup = warmup[devno];
|
||||||
ps->lampoff = lampoff[devno];
|
ps->lampoff = lampoff[devno];
|
||||||
|
@ -820,12 +837,12 @@ static int ptdrvInit( int devno )
|
||||||
if( _OK == retval ) {
|
if( _OK == retval ) {
|
||||||
|
|
||||||
#ifdef __KERNEL__
|
#ifdef __KERNEL__
|
||||||
_PRINT(
|
_PRINT( "pt_drv%u: %s found on port 0x%04x\n",
|
||||||
#else
|
|
||||||
DBG( DBG_LOW,
|
|
||||||
#endif
|
|
||||||
"pt_drv%u: %s found on port 0x%04x\n",
|
|
||||||
devno, MiscGetModelName(ps->sCaps.Model), ps->IO.pbSppDataPort );
|
devno, MiscGetModelName(ps->sCaps.Model), ps->IO.pbSppDataPort );
|
||||||
|
#else
|
||||||
|
DBG( DBG_LOW, "pt_drv%u: %s found\n",
|
||||||
|
devno, MiscGetModelName(ps->sCaps.Model));
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* initialize the timespan timer
|
* initialize the timespan timer
|
||||||
|
@ -1468,8 +1485,9 @@ static int ptdrvRead( pScanData ps, pUChar buffer, int count )
|
||||||
/* needed, esp. to avoid freezing the system in SPP mode */
|
/* needed, esp. to avoid freezing the system in SPP mode */
|
||||||
#ifdef __KERNEL__
|
#ifdef __KERNEL__
|
||||||
schedule();
|
schedule();
|
||||||
#else
|
/*#else
|
||||||
sched_yield();
|
sched_yield();
|
||||||
|
*/
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1811,20 +1829,27 @@ static int pt_drv_ioctl( struct inode *inode, struct file *file,
|
||||||
/*.............................................................................
|
/*.............................................................................
|
||||||
* here we only have wrapper functions
|
* here we only have wrapper functions
|
||||||
*/
|
*/
|
||||||
static int PtDrvInit( int portAddr, UShort model_override )
|
static int PtDrvInit( const char *dev_name, UShort model_override )
|
||||||
{
|
{
|
||||||
|
int fd;
|
||||||
int result = _OK;
|
int result = _OK;
|
||||||
|
|
||||||
if( _TRUE == PtDrvInitialized )
|
if( _TRUE == PtDrvInitialized )
|
||||||
return _E_INIT;
|
return _OK;
|
||||||
|
|
||||||
port[0] = portAddr;
|
result = sanei_pp_open( dev_name, &fd );
|
||||||
|
if( SANE_STATUS_GOOD != result )
|
||||||
|
return result;
|
||||||
|
|
||||||
|
port[0] = fd;
|
||||||
mov[0] = model_override;
|
mov[0] = model_override;
|
||||||
|
|
||||||
result = ptdrvInit( 0 );
|
result = ptdrvInit( 0 );
|
||||||
|
|
||||||
if( _OK == result ) {
|
if( _OK == result ) {
|
||||||
PtDrvInitialized = _TRUE;
|
PtDrvInitialized = _TRUE;
|
||||||
|
} else {
|
||||||
|
ptdrvShutdown( PtDrvDevices[0] );
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -73,12 +73,13 @@
|
||||||
# include <string.h>
|
# include <string.h>
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# include <sched.h>
|
/*# include <sched.h>*/
|
||||||
# include <sys/time.h>
|
# include <sys/time.h>
|
||||||
# include <sys/signal.h>
|
# include <sys/signal.h>
|
||||||
# include <sys/ioctl.h>
|
# include <sys/ioctl.h>
|
||||||
# include <sys/io.h>
|
# ifdef HAVE_SYS_IO_H
|
||||||
|
# include <sys/io.h>
|
||||||
|
# endif
|
||||||
#else
|
#else
|
||||||
|
|
||||||
# include <linux/version.h>
|
# include <linux/version.h>
|
||||||
|
@ -106,12 +107,11 @@
|
||||||
# define _OPF ps->IO.fnOut
|
# define _OPF ps->IO.fnOut
|
||||||
# define _IPF ps->IO.fnIn
|
# define _IPF ps->IO.fnIn
|
||||||
|
|
||||||
#if 1
|
#ifdef __KERNEL__
|
||||||
|
|
||||||
#define _OUTB_CTRL(pSD,port_value) _OPF(port_value,pSD->IO.pbControlPort)
|
#define _OUTB_CTRL(pSD,port_value) _OPF(port_value,pSD->IO.pbControlPort)
|
||||||
#define _OUTB_DATA(pSD,port_value) _OPF(port_value,pSD->IO.pbSppDataPort)
|
#define _OUTB_DATA(pSD,port_value) _OPF(port_value,pSD->IO.pbSppDataPort)
|
||||||
#define _OUTB_ECTL(pSD,port_value) _OPF(port_value,(pSD->IO.portBase+0x402))
|
#define _OUTB_ECTL(pSD,port_value) _OPF(port_value,(pSD->IO.portBase+0x402))
|
||||||
#define _OUTB_STATUS(pSD,port_value) _OPF(port_value,pSD->IO.pbStatusPort)
|
|
||||||
|
|
||||||
#define _INB_CTRL(pSD) _IPF(pSD->IO.pbControlPort)
|
#define _INB_CTRL(pSD) _IPF(pSD->IO.pbControlPort)
|
||||||
#define _INB_DATA(pSD) _IPF(pSD->IO.pbSppDataPort)
|
#define _INB_DATA(pSD) _IPF(pSD->IO.pbSppDataPort)
|
||||||
|
@ -121,23 +121,14 @@
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define _OUTB_CTRL(pSD,port_value) parport_pc_write_control(pSD->pp, port_value)
|
#define _OUTB_CTRL(pSD,port_value) sanei_pp_outb_ctrl(pSD->pardev, port_value)
|
||||||
#define _OUTB_DATA(pSD,port_value) parport_pc_write_data(pSD->pp, port_value)
|
#define _OUTB_DATA(pSD,port_value) sanei_pp_outb_data(pSD->pardev, port_value)
|
||||||
#define _OUTB_STATUS(pSD,port_value) parport_pc_write_status(pSD->pp, port_value)
|
#define _OUTB_ECTL(pSD,port_value)
|
||||||
|
|
||||||
#define _INB_CTRL(pSD) parport_pc_read_control(pSD->pp)
|
#define _INB_CTRL(pSD) sanei_pp_inb_ctrl(pSD->pardev)
|
||||||
#define _INB_DATA(pSD) parport_pc_read_data(pSD->pp)
|
#define _INB_DATA(pSD) sanei_pp_inb_data(pSD->pardev)
|
||||||
#define _INB_STATUS(pSD) parport_pc_read_status(pSD->pp)
|
#define _INB_EPPDATA(pSD) sanei_pp_inb_epp(pSD->pardev)
|
||||||
|
#define _INB_STATUS(pSD) sanei_pp_inb_stat(pSD->pardev)
|
||||||
#ifdef LINUX_24
|
|
||||||
# define _OUTB_ECTL(pSD,port_value) outb_p(port_value,(pSD->IO.portBase+0x402))
|
|
||||||
# define _INB_EPPDATA(pSD) inb_p(pSD->IO.pbEppDataPort)
|
|
||||||
# define _INB_ECTL(pSD) inb_p((pSD->IO.portBase+0x402))
|
|
||||||
#else
|
|
||||||
# define _OUTB_ECTL(pSD,port_value) parport_pc_write_econtrol(pSD->pp, port_value)
|
|
||||||
# define _INB_EPPDATA(pSD) parport_pc_read_epp(pSD->pp)
|
|
||||||
# define _INB_ECTL(pSD) parport_pc_read_econtrol(pSD->pp)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -174,11 +165,11 @@ typedef long long TimerDef, *pTimerDef;
|
||||||
* timer topics
|
* timer topics
|
||||||
*/
|
*/
|
||||||
#ifndef __KERNEL__
|
#ifndef __KERNEL__
|
||||||
#define _DO_UDELAY(usecs) { int i; for( i = usecs; i--; ) outb(0x80,0); }
|
# define _DO_UDELAY(usecs) { int i,j; for( i = usecs; i--; ) j+=i*3; }
|
||||||
#define _DODELAY(msecs) { int i; for( i = msecs; i--; ) _DO_UDELAY(1000); }
|
# define _DODELAY(msecs) { int i; for( i = msecs; i--; ) usleep(1000); }
|
||||||
#else
|
#else
|
||||||
#define _DO_UDELAY(usecs) udelay(usecs)
|
# define _DO_UDELAY(usecs) udelay(usecs)
|
||||||
#define _DODELAY(msecs) mdelay(msecs)
|
# define _DODELAY(msecs) mdelay(msecs)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*.............................................................................
|
/*.............................................................................
|
||||||
|
|
|
@ -117,16 +117,16 @@ typedef struct _IMAGESIZE
|
||||||
|
|
||||||
typedef struct _IMAGEDEF
|
typedef struct _IMAGEDEF
|
||||||
{
|
{
|
||||||
IMAGESIZE Image;
|
IMAGESIZE Image;
|
||||||
DWORD dwVxDFlag;
|
DWORD dwVxDFlag;
|
||||||
DWORD dwScanFlag;
|
DWORD dwScanFlag;
|
||||||
CROPRECT Area;
|
CROPRECT Area;
|
||||||
XY Dpi;
|
XY Dpi;
|
||||||
WORD wDataType;
|
WORD wDataType;
|
||||||
WORD wBrightness;
|
WORD wBrightness;
|
||||||
WORD wPhyDpiY;
|
WORD wPhyDpiY;
|
||||||
WORD wResult;
|
WORD wResult;
|
||||||
WORD Reserved;
|
WORD Reserved;
|
||||||
} IMAGEDEF, *PIMAGEDEF;
|
} IMAGEDEF, *PIMAGEDEF;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -182,6 +182,8 @@ typedef struct scandata
|
||||||
struct pardevice *pardev; /* for accessing parport... */
|
struct pardevice *pardev; /* for accessing parport... */
|
||||||
struct parport *pp;
|
struct parport *pp;
|
||||||
ProcDirDef procDir;
|
ProcDirDef procDir;
|
||||||
|
#else
|
||||||
|
int pardev; /* parport handle in user-space */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -62,22 +62,11 @@
|
||||||
|
|
||||||
/******************* wrapper functions for parport device ********************/
|
/******************* wrapper functions for parport device ********************/
|
||||||
|
|
||||||
/** stuff needed for user space stuff
|
|
||||||
*/
|
|
||||||
#if 0
|
|
||||||
int PtDrvInit ( int portAddr, unsigned short model_override );
|
|
||||||
int PtDrvShutdown( void );
|
|
||||||
int PtDrvOpen ( void );
|
|
||||||
int PtDrvClose ( void );
|
|
||||||
int PtDrvIoctl ( unsigned int cmd, void *arg );
|
|
||||||
int PtDrvRead ( unsigned char *buffer, int count );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _BACKEND_ENABLED
|
#ifndef _BACKEND_ENABLED
|
||||||
|
|
||||||
static int PtDrvInit( int portAddr, unsigned short model_override )
|
static int PtDrvInit( char *dev_name, unsigned short model_override )
|
||||||
{
|
{
|
||||||
_VAR_NOT_USED( portAddr );
|
_VAR_NOT_USED( dev_name );
|
||||||
_VAR_NOT_USED( model_override );
|
_VAR_NOT_USED( model_override );
|
||||||
DBG( _DBG_ERROR, "Backend does not support direct I/O!\n" );
|
DBG( _DBG_ERROR, "Backend does not support direct I/O!\n" );
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -131,11 +120,11 @@ static int ppDev_open( const char *dev_name, void *misc )
|
||||||
Plustek_Device *dev = (Plustek_Device *)misc;
|
Plustek_Device *dev = (Plustek_Device *)misc;
|
||||||
|
|
||||||
if( dev->adj.direct_io ) {
|
if( dev->adj.direct_io ) {
|
||||||
|
result = PtDrvInit( dev_name, dev->adj.mov );
|
||||||
/* convert device name to port-address... */
|
if( 0 != result ) {
|
||||||
long portaddr = strtol( dev_name, 0, 0 );
|
DBG( _DBG_ERROR, "open: PtDrvInit failed: %d\n", result );
|
||||||
|
return -1;
|
||||||
PtDrvInit((int)portaddr, dev->adj.mov );
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( dev->adj.direct_io )
|
if( dev->adj.direct_io )
|
||||||
|
@ -144,7 +133,7 @@ static int ppDev_open( const char *dev_name, void *misc )
|
||||||
handle = open( dev_name, O_RDONLY );
|
handle = open( dev_name, O_RDONLY );
|
||||||
|
|
||||||
if ( handle < 0 ) {
|
if ( handle < 0 ) {
|
||||||
DBG(_DBG_ERROR, "open: can't open %s as a device\n", dev_name);
|
DBG( _DBG_ERROR, "open: can't open %s as a device\n", dev_name );
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,11 +62,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef _AIX
|
#ifdef _AIX
|
||||||
# include <lalloca.h> /* MUST come first for AIX! */
|
# include "../include/lalloca.h" /* MUST come first for AIX! */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "sane/config.h"
|
#include "../include/sane/config.h"
|
||||||
#include <lalloca.h>
|
#include "../include/lalloca.h"
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
@ -83,15 +83,16 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
|
||||||
#include "sane/sane.h"
|
#include "../include/sane/sane.h"
|
||||||
#include "sane/sanei.h"
|
#include "../include/sane/sanei.h"
|
||||||
#include "sane/saneopts.h"
|
#include "../include/sane/saneopts.h"
|
||||||
|
|
||||||
#define BACKEND_VERSION "0.01-2"
|
#define BACKEND_VERSION "0.01-3"
|
||||||
#define BACKEND_NAME plustek_pp
|
#define BACKEND_NAME plustek_pp
|
||||||
#include "sane/sanei_backend.h"
|
#include "../include/sane/sanei_backend.h"
|
||||||
#include "sane/sanei_config.h"
|
#include "../include/sane/sanei_config.h"
|
||||||
#include "sane/sanei_thread.h"
|
#include "../include/sane/sanei_thread.h"
|
||||||
|
#include "../include/sane/sanei_pp.h"
|
||||||
|
|
||||||
#ifdef HAVE_IOPERM
|
#ifdef HAVE_IOPERM
|
||||||
# define _BACKEND_ENABLED
|
# define _BACKEND_ENABLED
|
||||||
|
@ -120,6 +121,9 @@
|
||||||
MODELSTR;
|
MODELSTR;
|
||||||
|
|
||||||
#ifdef _BACKEND_ENABLED
|
#ifdef _BACKEND_ENABLED
|
||||||
|
#ifndef NDEBUG
|
||||||
|
# define DEBUG
|
||||||
|
#endif
|
||||||
|
|
||||||
/* needed to statisfy the module code ... */
|
/* needed to statisfy the module code ... */
|
||||||
#define _PTDRV_V0 0
|
#define _PTDRV_V0 0
|
||||||
|
|
Ładowanie…
Reference in New Issue