757
757
SendScanEvent( hpaio->deviceuri, EVENT_END_SCAN_JOB);
760
static SANE_Status SetResolutionListSCL(hpaioScanner_t hpaio)
762
int supported_res[] = {50, 75, 100, 150, 200, 300, 600, 1200, 2400, 4800, 9600};
763
int i, len = sizeof(supported_res)/sizeof(int);
766
if (hpaio->currentAdfMode == ADF_MODE_ADF || hpaio->currentAdfMode == ADF_MODE_AUTO)
768
hpaio->resolutionRange.min = hpaio->scl.minResAdf;
769
hpaio->resolutionRange.max = hpaio->scl.maxResAdf;
773
hpaio->resolutionRange.min = hpaio->scl.minRes;
774
hpaio->resolutionRange.max = hpaio->scl.maxRes;
777
DBG(6,"minRes=%d maxRes=%d minResAdf=%d maxResAdf=%d\n", hpaio->scl.minRes, hpaio->scl.maxRes, hpaio->scl.minResAdf, hpaio->scl.maxResAdf);
779
NumListClear( hpaio->resolutionList );
780
NumListClear( hpaio->lineartResolutionList );
781
for (i = 0; i < len; i++)
783
if (supported_res[i] >= hpaio->resolutionRange.min &&
784
supported_res[i] <= hpaio->resolutionRange.max)
786
NumListAdd (hpaio->resolutionList, supported_res[i]);
787
NumListAdd (hpaio->lineartResolutionList, supported_res[i]);
790
hpaio->option[OPTION_SCAN_RESOLUTION].constraint_type = SANE_CONSTRAINT_WORD_LIST;
792
return SANE_STATUS_GOOD;
760
795
static SANE_Status hpaioSetDefaultValue( hpaioScanner_t hpaio, int option )
1941
1978
/* Determine the minimum and maximum resolution.
1942
1979
* Probe for both X and Y, and pick largest min and smallest max.
1943
1980
* For the 1150, set min to 50 to prevent scan head crashes (<42). */
1944
SclInquire( hpaio->deviceid, hpaio->scan_channelid,
1945
SCL_CMD_INQUIRE_MINIMUM_VALUE,
1946
SCL_CMD_SET_X_RESOLUTION,
1947
&hpaio->scl.minXRes,
1951
DBG6("min x resolution=%d\n", hpaio->scl.minXRes);
1953
SclInquire( hpaio->deviceid, hpaio->scan_channelid,
1954
SCL_CMD_INQUIRE_MINIMUM_VALUE,
1955
SCL_CMD_SET_Y_RESOLUTION,
1956
&hpaio->scl.minYRes,
1960
DBG6("min y resolution=%d\n", hpaio->scl.minYRes);
1981
int minXRes, minYRes, maxXRes, maxYRes;
1982
retcode = SclInquire( hpaio->deviceid, hpaio->scan_channelid,
1983
SCL_CMD_INQUIRE_MINIMUM_VALUE,
1984
SCL_CMD_SET_X_RESOLUTION,
1989
DBG(6, "minXRes=%d retcode=%d\n",minXRes, retcode);
1991
retcode = SclInquire( hpaio->deviceid, hpaio->scan_channelid,
1992
SCL_CMD_INQUIRE_MINIMUM_VALUE,
1993
SCL_CMD_SET_Y_RESOLUTION,
1998
DBG(6,"minYRes=%d retcode=%d\n", minYRes, retcode);
2000
retcode = SclInquire( hpaio->deviceid, hpaio->scan_channelid,
2001
SCL_CMD_INQUIRE_MAXIMUM_VALUE,
2002
SCL_CMD_SET_X_RESOLUTION,
2007
DBG(6,"maxXRes=%d retcode=%d\n", maxXRes, retcode);
2009
retcode = SclInquire( hpaio->deviceid, hpaio->scan_channelid,
2010
SCL_CMD_INQUIRE_MAXIMUM_VALUE,
2011
SCL_CMD_SET_Y_RESOLUTION,
2016
DBG(6,"maxYRes=%d retcode=%d\n", maxYRes, retcode);
1962
2018
if( hpaio->scl.compat & SCL_COMPAT_1150 &&
1963
hpaio->scl.minYRes < SCL_MIN_Y_RES_1150 )
1965
hpaio->scl.minYRes = SCL_MIN_Y_RES_1150;
1967
r = hpaio->scl.minXRes;
1968
if( r < hpaio->scl.minYRes )
1970
r = hpaio->scl.minYRes;
1973
hpaio->resolutionRange.min = r;
1975
SclInquire( hpaio->deviceid, hpaio->scan_channelid,
1976
SCL_CMD_INQUIRE_MAXIMUM_VALUE,
1977
SCL_CMD_SET_X_RESOLUTION,
1978
&hpaio->scl.maxXRes,
1982
DBG6("max x resolution=%d\n", hpaio->scl.maxXRes);
1984
SclInquire( hpaio->deviceid, hpaio->scan_channelid,
1985
SCL_CMD_INQUIRE_MAXIMUM_VALUE,
1986
SCL_CMD_SET_Y_RESOLUTION,
1987
&hpaio->scl.maxYRes,
1991
DBG6("max y resolution=%d\n", hpaio->scl.maxYRes);
1993
r = hpaio->scl.maxXRes;
1995
if( r > hpaio->scl.maxYRes )
1997
r = hpaio->scl.maxYRes;
2000
if( hpaio->scl.compat & ( SCL_COMPAT_1150 | SCL_COMPAT_1170 ) && r > SCL_MAX_RES_1150_1170 )
2002
r = SCL_MAX_RES_1150_1170;
2004
hpaio->resolutionRange.max = r;
2019
minYRes < SCL_MIN_Y_RES_1150 )
2021
minYRes = SCL_MIN_Y_RES_1150;
2023
hpaio->scl.minRes = minXRes;
2024
if( hpaio->scl.minRes < minYRes )
2026
hpaio->scl.minRes = minYRes;
2029
hpaio->resolutionRange.min = hpaio->scl.minRes;
2031
hpaio->scl.maxRes = maxXRes;
2033
if( hpaio->scl.maxRes > maxYRes )
2035
hpaio->scl.maxRes = maxYRes;
2038
if( hpaio->scl.compat & ( SCL_COMPAT_1150 | SCL_COMPAT_1170 )
2039
&& hpaio->scl.maxRes > SCL_MAX_RES_1150_1170 )
2041
hpaio->scl.maxRes = SCL_MAX_RES_1150_1170;
2043
hpaio->resolutionRange.max = hpaio->scl.maxRes;
2006
2045
/* Determine ADF/duplex capabilities. */
2008
int flatbedCapability = 1;
2010
SclInquire( hpaio->deviceid, hpaio->scan_channelid,
2011
SCL_CMD_INQUIRE_MAXIMUM_VALUE,
2012
SCL_PSEUDO_FLATBED_Y_RESOLUTION,
2017
SclInquire( hpaio->deviceid, hpaio->scan_channelid,
2047
retcode = SclInquire( hpaio->deviceid, hpaio->scan_channelid,
2018
2048
SCL_CMD_INQUIRE_DEVICE_PARAMETER,
2019
2049
SCL_INQ_ADF_CAPABILITY,
2020
2050
&hpaio->scl.adfCapability,
2024
DBG(6, "ADF capability=%d: %s %d\n", hpaio->scl.adfCapability, __FILE__, __LINE__);
2054
DBG(6, "ADF capability=%d retcode=%d: %s %d\n", hpaio->scl.adfCapability, retcode,__FILE__, __LINE__);
2056
if (hpaio->scl.adfCapability)
2058
retcode = SclInquire( hpaio->deviceid, hpaio->scan_channelid,
2059
SCL_CMD_INQUIRE_MINIMUM_VALUE,
2060
SCL_PSEUDO_ADF_X_RESOLUTION,
2064
DBG(6, "minXResAdf=%d retcode=%d\n", minXRes, retcode);
2065
retcode = SclInquire( hpaio->deviceid, hpaio->scan_channelid,
2066
SCL_CMD_INQUIRE_MINIMUM_VALUE,
2067
SCL_PSEUDO_ADF_Y_RESOLUTION,
2071
DBG(6, "minYResAdf=%d retcode=%d\n", minYRes, retcode);
2072
retcode = SclInquire( hpaio->deviceid, hpaio->scan_channelid,
2073
SCL_CMD_INQUIRE_MAXIMUM_VALUE,
2074
SCL_PSEUDO_ADF_X_RESOLUTION,
2078
DBG(6, "maxXResAdf=%d retcode=%d\n", maxXRes, retcode);
2079
retcode = SclInquire( hpaio->deviceid, hpaio->scan_channelid,
2080
SCL_CMD_INQUIRE_MAXIMUM_VALUE,
2081
SCL_PSEUDO_ADF_Y_RESOLUTION,
2085
DBG(6, "maxYResAdf=%d retcode=%d\n", maxYRes, retcode);
2086
if( hpaio->scl.compat & SCL_COMPAT_1150 &&
2087
minYRes < SCL_MIN_Y_RES_1150 )
2089
minYRes = SCL_MIN_Y_RES_1150;
2091
hpaio->scl.minResAdf = minXRes;
2092
if( hpaio->scl.minResAdf < minYRes )
2094
hpaio->scl.minResAdf = minYRes;
2097
hpaio->scl.maxResAdf = maxXRes;
2099
if( hpaio->scl.maxResAdf > maxYRes )
2101
hpaio->scl.maxResAdf = maxYRes;
2104
if( hpaio->scl.compat & ( SCL_COMPAT_1150 | SCL_COMPAT_1170 )
2105
&& hpaio->scl.maxResAdf > SCL_MAX_RES_1150_1170 )
2107
hpaio->scl.maxResAdf = SCL_MAX_RES_1150_1170;
2026
2111
if( !hpaio->scl.adfCapability )
2028
2113
hpaio->supportedAdfModes = ADF_MODE_FLATBED;
2030
else if( hpaio->scl.compat & SCL_COMPAT_K_SERIES ||
2031
!flatbedCapability )
2115
else if( hpaio->scl.compat & SCL_COMPAT_K_SERIES &&
2116
hpaio->scl.adfCapability )
2033
hpaio->supportedAdfModes = ADF_MODE_ADF;
2118
hpaio->supportedAdfModes = ADF_MODE_FLATBED | ADF_MODE_ADF;