Fixed bug in parport setup routine.

merge-requests/1/head
Gerhard Jaeger 2003-11-04 16:12:12 +00:00
rodzic 84c0a8797c
commit 4758f4dabc
2 zmienionych plików z 31 dodań i 20 usunięć

Wyświetl plik

@ -77,7 +77,7 @@
/* /*
* port modes * port modes
* (WARNING: never change these defines, as they´re used as entries * (WARNING: never change these defines, as they are used as entries
* to jump tables !!!) * to jump tables !!!)
*/ */
#define _PORT_EPP 0 #define _PORT_EPP 0
@ -85,6 +85,7 @@
#define _PORT_BIDI 2 #define _PORT_BIDI 2
#define _PORT_ECP 3 #define _PORT_ECP 3
#define _PORT_ESP 4 #define _PORT_ESP 4
#define _PORT_NONE 5
/* /*
* ScannerSize * ScannerSize

Wyświetl plik

@ -494,7 +494,7 @@ _LOC int MiscInitPorts( pScanData ps, int port )
ps->IO.pbEppDataPort = (UShort)port+4; ps->IO.pbEppDataPort = (UShort)port+4;
#else #else
int mode; int mode, mts;
if( NULL == ps ) if( NULL == ps )
return _E_NULLPTR; return _E_NULLPTR;
@ -504,21 +504,25 @@ _LOC int MiscInitPorts( pScanData ps, int port )
return _E_NO_PORT; return _E_NO_PORT;
} }
ps->IO.portMode = _PORT_NONE;
mts = -1;
if( mode & SANEI_PP_MODE_SPP ) { if( mode & SANEI_PP_MODE_SPP ) {
DBG( DBG_LOW, "Setting SPP-mode\n" ); DBG( DBG_LOW, "Setting SPP-mode\n" );
ps->IO.portMode = _PORT_SPP; ps->IO.portMode = _PORT_SPP;
mts = SANEI_PP_MODE_SPP;
} }
if( mode & SANEI_PP_MODE_BIDI ) { if( mode & SANEI_PP_MODE_BIDI ) {
DBG( DBG_LOW, "Setting PS/2-mode\n" ); DBG( DBG_LOW, "Setting PS/2-mode\n" );
ps->IO.portMode = _PORT_BIDI; ps->IO.portMode = _PORT_BIDI;
mts = SANEI_PP_MODE_BIDI;
} }
if( mode & SANEI_PP_MODE_EPP ) { if( mode & SANEI_PP_MODE_EPP ) {
DBG( DBG_LOW, "Setting EPP-mode\n" ); DBG( DBG_LOW, "Setting EPP-mode\n" );
ps->IO.portMode = _PORT_EPP; ps->IO.portMode = _PORT_EPP;
mts = SANEI_PP_MODE_EPP;
} }
if( mode & SANEI_PP_MODE_ECP ) { if( mode & SANEI_PP_MODE_ECP ) {
DBG( DBG_HIGH, "ECP detected --> not supported\n" ); DBG( DBG_HIGH, "ECP detected --> not supported\n" );
return _E_NOSUPP;
} }
if( sanei_pp_uses_directio()) { if( sanei_pp_uses_directio()) {
@ -527,6 +531,12 @@ _LOC int MiscInitPorts( pScanData ps, int port )
DBG( DBG_LOW, "We're using libIEEE1284 I/O\n" ); DBG( DBG_LOW, "We're using libIEEE1284 I/O\n" );
} }
if( ps->IO.portMode == _PORT_NONE ) {
DBG( DBG_HIGH, "None of the portmodes is supported.\n" );
return _E_NOSUPP;
}
sanei_pp_setmode( ps->pardev, mts );
_VAR_NOT_USED( port ); _VAR_NOT_USED( port );
#endif #endif
return _OK; return _OK;