diff --git a/backend/plustek-share.h b/backend/plustek-share.h index 6a2306cfc..e4a9471c6 100644 --- a/backend/plustek-share.h +++ b/backend/plustek-share.h @@ -11,6 +11,9 @@ * 0.36 - initial version * 0.37 - updated scanner info list * removed override switches + * 0.38 - changed the dwFlag entry in ScannerCaps and its meaning + * changed _NO_BASE + * fixed model list * *............................................................................. * @@ -213,7 +216,8 @@ typedef struct { "12000P/96000P", \ "9636P+/Turbo", \ "9636T/12000T", \ - "P12" \ + "P8", \ + "P12", \ "PT12" \ } @@ -247,15 +251,16 @@ typedef struct { #define _BITS_12 0x00000003 /* (1.2): SCANNERINFO.dwFlag */ -#define SFLAG_ADF 0x00000001 -#define SFLAG_Calibrate 0x00000002 -#define SFLAG_MultiFunction 0x00000004 /* Keypad support */ -#define SFLAG_SheetFed 0x00000008 -#define SFLAG_HardwareMap 0x00000010 -#define SFLAG_Transparency 0x00000020 /* supports transparency */ -#define SFLAG_Negative 0x00000040 /* supports negative */ -#define SFLAG_QualityScan 0x00000080 /* has quality scan mode */ -#define SFLAG_MessageVxD 0x00000080 /* has quality scan mode */ +#define SFLAG_MULTIFUNC 0x00000001 /* is multifunction device */ +#define SFLAG_SCANNERDEV 0x00000002 /* is scannerdevice */ +#define SFLAG_FLATBED 0x00000004 /* is flatbed scanner */ +#define SFLAG_PRINTEROPT 0x00000008 /* has printer option */ + +#define SFLAG_ADF 0x00000010 /* Automatic document feeder */ +#define SFLAG_MFP 0x00000020 /* MF-Keypad support */ +#define SFLAG_SheetFed 0x00000040 /* Sheetfed support */ +#define SFLAG_TPA 0x00000080 /* has transparency adapter */ +#define SFLAG_BUTTONOPT 0x00000100 /* has buttons */ /* * (1.2.1) Provide the scanner ID. This field is valid when the wIOBase @@ -265,7 +270,7 @@ typedef struct { #define SFLAG_IDMask 0x00f00000 /* Scanner ID */ /* (1.3): SCANNERINFO.wIOBase */ -#define _NO_BASE 0 +#define _NO_BASE 0xFFFF /****************************************************************************** * Section 2 @@ -295,6 +300,7 @@ typedef struct { #define SCANDEF_RightAlign 0x00008000 /* 12-bit */ #define SCANDEF_WindowStyle 0x00000038 +#define SCANDEF_TPA (SCANDEF_Transparency | SCANDEF_Negative) /* these values will be combined with ScannerInfo.dwFlag */ #define _SCANNER_SCANNING 0x8000000 @@ -354,6 +360,7 @@ typedef struct { /****************************************************************************** * Section 5 - Scanmodes */ +#define _ScanMode_Color 0 #define _ScanMode_AverageOut 1 /* CCD averaged 2 pixels value for output*/ #define _ScanMode_Mono 2 /* not color mode */ #define _FastScanMode _ScanMode_AverageOut diff --git a/backend/plustek.c b/backend/plustek.c index d98eec5b6..b33948fb1 100644 --- a/backend/plustek.c +++ b/backend/plustek.c @@ -32,6 +32,7 @@ * applied Michaels' patch to solve the sane_get_parameter problem * getting X-size of scan area from driver * applied Michaels´ patch for OPT_RESOLUTION (SANE_INFO_INEXACT stuff) + * 0.38 - now using the information from the driver * *............................................................................. * @@ -101,8 +102,8 @@ #include "sane/sanei_backend.h" #include "sane/sanei_config.h" -#include "plustek.h" #include "plustek-share.h" +#include "plustek.h" /*********************** the debug levels ************************************/ @@ -135,7 +136,7 @@ static ModeParam mode_params[] = {1, 16, COLOR_TRUE36}, }; -static ModeParam mode_9636_params[] = +static ModeParam mode_9800x_params[] = { {0, 1, COLOR_BW}, {0, 1, COLOR_HALFTONE}, @@ -154,7 +155,7 @@ static const SANE_String_Const mode_list[] = NULL }; -static const SANE_String_Const mode_9636_list[] = +static const SANE_String_Const mode_9800x_list[] = { "Binary", "Halftone", @@ -274,10 +275,9 @@ static pModeParam getModeList( Plustek_Scanner *scanner ) { pModeParam mp; - if((MODEL_OP_9636T == scanner->hw->model) || - (MODEL_OP_9636P == scanner->hw->model) || - (MODEL_OP_9636PP == scanner->hw->model)) { - mp = mode_9636_params; + if((_ASIC_IS_98003 == scanner->hw->caps.AsicID) || + (_ASIC_IS_98001 == scanner->hw->caps.AsicID)) { + mp = mode_9800x_params; } else { mp = mode_params; } @@ -437,7 +437,7 @@ static SANE_Status limitResolution( Plustek_Device *dev ) * Note: the limit for the Asic 96001/3 models is limited to the * X-Resolution */ - if( _ASIC_IS_98001 == dev->asic ) { + if( _ASIC_IS_98001 == dev->caps.AsicID ) { dev->dpi_range.max = lens.rDpiY.wPhyMax; } else { dev->dpi_range.max = lens.rDpiX.wPhyMax; @@ -492,10 +492,9 @@ static SANE_Status init_options( Plustek_Scanner *s ) s->opt[OPT_MODE].size = 32; s->opt[OPT_MODE].constraint_type = SANE_CONSTRAINT_STRING_LIST; - if((MODEL_OP_9636T == s->hw->model) || - (MODEL_OP_9636P == s->hw->model) || - (MODEL_OP_9636PP == s->hw->model)) { - s->opt[OPT_MODE].constraint.string_list = mode_9636_list; + if((_ASIC_IS_98001 == s->hw->caps.AsicID) || + (_ASIC_IS_98003 == s->hw->caps.AsicID)) { + s->opt[OPT_MODE].constraint.string_list = mode_9800x_list; } else { s->opt[OPT_MODE].constraint.string_list = mode_list; } @@ -612,8 +611,10 @@ static SANE_Status init_options( Plustek_Scanner *s ) s->opt[OPT_BR_Y].constraint.range = &s->hw->y_range; s->val[OPT_BR_Y].w = SANE_FIX(_DEFAULT_BRY); - /* CHANGE: disable some settings for the 9636T and the other models */ - if(MODEL_OP_9636T != s->hw->model) { + /* disable extended mode list for devices without TPA */ + DBG(_DBG_SANE_INIT, "0x%08lx\n", s->hw->caps.dwFlag ); + + if( 0 == (s->hw->caps.dwFlag & SFLAG_TPA)) { s->opt[OPT_EXT_MODE].cap |= SANE_CAP_INACTIVE; } @@ -684,12 +685,21 @@ static SANE_Status attach( const char *dev_name, Plustek_Device **devp ) dev->sane.vendor = "Plustek"; dev->sane.type = "flatbed scanner"; - /* save the info we got from the driver */ - dev->model = scaps.Model; - dev->asic = scaps.AsicID; - dev->max_x = scaps.wMaxExtentX*MM_PER_INCH/_MEASURE_BASE; - dev->max_y = scaps.wMaxExtentY*MM_PER_INCH/_MEASURE_BASE; + dev->caps = scaps; + + DBG( _DBG_INFO, "Scanner information:\n" ); + if( dev->caps.Model <= MODEL_OP_PT12 ) + DBG( _DBG_INFO, "Model : %s\n", ModelStr[dev->caps.Model] ); + else + DBG( _DBG_INFO, "Model : %s\n", ModelStr[0] ); + + DBG( _DBG_INFO, "Asic : 0x%02x\n", dev->caps.AsicID ); + DBG( _DBG_INFO, "Flags : 0x%08lx\n", dev->caps.dwFlag ); + DBG( _DBG_INFO, "Version: 0x%08x\n", dev->caps.Version ); + + dev->max_x = scaps.wMaxExtentX*MM_PER_INCH/_MEASURE_BASE; + dev->max_y = scaps.wMaxExtentY*MM_PER_INCH/_MEASURE_BASE; dev->res_list = (SANE_Int *) calloc(((lens.rDpiX.wMax -_DEF_DPI)/25 + 1), sizeof (SANE_Int)); /* one more to avoid a buffer overflow */ @@ -720,9 +730,9 @@ static SANE_Status attach( const char *dev_name, Plustek_Device **devp ) /* error, give asic # */ if (scaps.Model > sizeof (ModelStr) / sizeof (*ModelStr)) { - sprintf (str, "ASIC ID = 0x%x", scaps.AsicID); + sprintf(str, "ASIC ID = 0x%x", scaps.AsicID); } else { - sprintf (str, ModelStr[scaps.Model]); /* lookup model string */ + sprintf(str, ModelStr[scaps.Model]); /* lookup model string */ } dev->sane.model = str; @@ -1124,10 +1134,9 @@ SANE_Status sane_control_option( SANE_Handle handle, SANE_Int option, s->val[OPT_BR_X].w = SANE_FIX(_DEFAULT_BRX); s->val[OPT_BR_Y].w = SANE_FIX(_DEFAULT_BRY); - if((MODEL_OP_9636T == s->hw->model) || - (MODEL_OP_9636P == s->hw->model) || - (MODEL_OP_9636PP == s->hw->model)) { - s->opt[OPT_MODE].constraint.string_list = mode_9636_list; + if((_ASIC_IS_98001 == s->hw->caps.AsicID) || + (_ASIC_IS_98003 == s->hw->caps.AsicID)) { + s->opt[OPT_MODE].constraint.string_list = mode_9800x_list; } else { s->opt[OPT_MODE].constraint.string_list = mode_list; } @@ -1154,9 +1163,9 @@ SANE_Status sane_control_option( SANE_Handle handle, SANE_Int option, s->val[OPT_BR_Y].w = SANE_FIX(_DEFAULT_NEG_BRY); } - if( MODEL_OP_9636T == s->hw->model ) { + if( s->hw->caps.dwFlag & SFLAG_TPA ) { s->opt[OPT_MODE].constraint.string_list = - &mode_9636_list[_TPAModeSupportMin]; + &mode_9800x_list[_TPAModeSupportMin]; } else { s->opt[OPT_MODE].constraint.string_list = &mode_list[_TPAModeSupportMin]; diff --git a/backend/plustek.desc b/backend/plustek.desc index 19a32f991..85f1c7f24 100644 --- a/backend/plustek.desc +++ b/backend/plustek.desc @@ -10,7 +10,7 @@ ; :backend "plustek" ; name of backend -:version "0.37" ; version of backend +:version "0.38" ; version of backend :status :stable ; :alpha, :beta, :stable, :new :manpage "sane-plustek" ; name of manpage (if it exists) diff --git a/backend/plustek.h b/backend/plustek.h index 32f77edaa..065528a11 100644 --- a/backend/plustek.h +++ b/backend/plustek.h @@ -29,6 +29,7 @@ * moved fd from struct Plustek_Scanner to Plustek_Device * added next members to struct Plustek_Scanner and Plustek_Device * 0.37 - added max_x to struct Plustek_Scan + * 0.38 - added caps to struct Plustek_Scan * *............................................................................. * @@ -145,8 +146,6 @@ typedef struct Plustek_Device struct Plustek_Device *next; int fd; /* device handle */ SANE_Device sane; - SANE_Int model; - SANE_Int asic; SANE_Int max_x; SANE_Int max_y; SANE_Int level; @@ -155,6 +154,7 @@ typedef struct Plustek_Device SANE_Range y_range; SANE_Int *res_list; SANE_Int res_list_size; + ScannerCaps caps; /* caps reported by teh driver */ } Plustek_Device; typedef union diff --git a/doc/sane-plustek.man b/doc/sane-plustek.man index c9a9c1917..464e356f9 100644 --- a/doc/sane-plustek.man +++ b/doc/sane-plustek.man @@ -1,4 +1,4 @@ -.TH sane-plustek 5 "10 November 2000" +.TH sane-plustek 5 "30 November 2000" .IX sane-plustek .SH NAME sane-plustek - SANE backend for Plustek parallel port flatbed scanners @@ -124,7 +124,7 @@ See the plustek.conf file for examples. .SH CONFIGURATION .PP As the driver is a loadable kernel module, it is configured -by invoking insmod with the approriate parameters or +by invoking insmod with the appropriate parameters or appending the options to the file .B /etc/conf.modules .PP