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
* (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 !!!)
*/
#define _PORT_EPP 0
@ -85,6 +85,7 @@
#define _PORT_BIDI 2
#define _PORT_ECP 3
#define _PORT_ESP 4
#define _PORT_NONE 5
/*
* ScannerSize

Wyświetl plik

@ -494,31 +494,35 @@ _LOC int MiscInitPorts( pScanData ps, int port )
ps->IO.pbEppDataPort = (UShort)port+4;
#else
int mode;
int mode, mts;
if( NULL == ps )
return _E_NULLPTR;
if( SANE_STATUS_GOOD != sanei_pp_getmodes( ps->pardev, &mode )) {
DBG(DBG_HIGH, "Cannot get port mode!\n" );
DBG( DBG_HIGH, "Cannot get port mode!\n" );
return _E_NO_PORT;
}
ps->IO.portMode = _PORT_NONE;
mts = -1;
if( mode & SANEI_PP_MODE_SPP ) {
DBG( DBG_LOW, "Setting SPP-mode\n" );
ps->IO.portMode = _PORT_SPP;
mts = SANEI_PP_MODE_SPP;
}
if( mode & SANEI_PP_MODE_BIDI ) {
DBG( DBG_LOW, "Setting PS/2-mode\n" );
ps->IO.portMode = _PORT_BIDI;
mts = SANEI_PP_MODE_BIDI;
}
if( mode & SANEI_PP_MODE_EPP ) {
DBG( DBG_LOW, "Setting EPP-mode\n" );
ps->IO.portMode = _PORT_EPP;
mts = SANEI_PP_MODE_EPP;
}
if( mode & SANEI_PP_MODE_ECP ) {
DBG( DBG_HIGH, "ECP detected --> not supported\n" );
return _E_NOSUPP;
}
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" );
}
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 );
#endif
return _OK;